ffat, data, fat, 0x111000,0x2EF000,
If you pull https://github.com/espressif/arduino-esp32/ master and select esp32-dev, you will see easy to select partition splits for code vs FFat.
More details here: https://github.com/marcmerlin/esp32_fatfsimage/blob/master/README.md , and at the top level, there is a pre-generated fatfsimage that lets you build a fatfs image:
# replace 3004 with the size of your partition. In the 1/3MB split, the fatfs partition is # 0x2EF000 = 3076096 . 3076096/1024 = 3004 fatfsimage -l5 img.ffat 3004 datadir
Once the image is built
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 write_flash 0x111000 img.ffat
Example
I put together some code you can run to verify the partition list and get a file listing: https://github.com/marcmerlin/esp32_fatfsimage/blob/master/arduino/ffat/ffat.ino .Here is the output:
partition addr: 0x010000; size: 0x100000; label: app0 partition addr: 0x009000; size: 0x005000; label: nvs partition addr: 0x00e000; size: 0x002000; label: otadata partition addr: 0x110000; size: 0x001000; label: eeprom partition addr: 0x111000; size: 0x2ef000; label: ffatTrying to mount ffat partition if present File system mounted Total space: 3018752 Free space: 1429504 Listing directory: /gifs64 FILE: /gifs64/ani-bman-BW.gif SIZE: 4061 FILE: /gifs64/087_net.gif SIZE: 46200 (...)
More details and code here: https://github.com/marcmerlin/esp32_fatfsimage
Memory Use
The FFAT module uses 8KB plus 4KB per concurrent file that can be opened. By default, it allows 10 files to be opened, which means it uses 48KB. IF you want to reduce its memory use, you can tell it to only support one file, and you will save 36KB, leaving you with only 12KB used.if (!FFat.begin(0, "", 1)) die("Fat FS mount failed. Not enough RAM?");
Newer Solution, Consider this Instead
After I wrote all this, a better solution came up: https://github.com/lorol/arduino-esp32fs-plugin I recommend you install this instead and then grab a mkfatfs binary (it's a bit of a pain to build) from:
This will integrate with the arduino GUI and likely do what you want. That said, if you'd like to create your FatFS image from a makefile and upload it via esptool, then my repo explained above, does this fine.