this is my first post on the ESP32 forums. I'm a 21y old computer science student from Germany and very much into software and hardware engineering.
I've just started building my first projects with the ESP32 and realized that there seems to be not tool to create FatFs images with wear levelling suppport for the new wear levelling format.
Thus I've created mk_esp32fat.
It can create fully fledged FatFs images right on your build machine with full wear levelling support.
IMPORTANT: This tool will most probably only work on Linux machines.
This tool has been inspired by ESP32_mkfatfs
Features:
- - Preparing FatFs images on your build machine
- Translating directory structures into FatFs file systems
- Wear levelling support
Requirements
Building mk_esp32fat requires an up to date esp-idf. Using the current stable (v3.1) won't suffice. You'll have to use the latest version from the master branch. See README#Requirements for further details
Configuration
Change the content of partitions.csv to match the partition layout of your ESP32.
There are some more options you can tweak in sdkconfig/sdkconfig.h . Most notably there is the option CONFIG_ESPTOOLPY_FLASHSIZE. I've set it to 4MB by default to match most WROOM32, but you might want to change it depending on the hardware you are working with.
Compiling
After initial configuration compilation of the tool itself should be straight forward. Just run
Code: Select all
make
Usage
Quick start
In case you are familiar with filesystem structures and commandline tools just take a look at README#Usage
Example
For the following example we will assume that the fatfs root directory is called 'image', located directly inside the cloned git repo and the default partition table from the mk_esp32fat repo is used.
- Create the directory stucture you want to have inside the fatFs in the 'image' directory
- Copy all files you want to have in your fatFs into the directory structure
- Run mk_esp32fat using './mkfatfs -c image fatfs.img', this will create the file 'fatfs.img'
- Flash the fatFs image to the ESP using
Code: Select all
python2 "$IDF_PATH"/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 230400 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 4MB 0x130000 fatfs.img
There are still some limitations to this tool. At the moment it can only handle a sector size of 4096 byte and there is no proper menuconfig for configuring it.
I think this tool will be useful to a lot of people wanting a proper directory structure on their ESP32s.
Cheers,
Tobias