PlatformIO Community

Querying Flash size for "upload"

How do you determine the max size for the SPIFFS on the flash? When I pick different partitions from I am not able to see what the size PlatformIO thinks it has when it complains that the image I am trying to upload is too large?

For instance, using no_ota.csv, it’s my understanding that 0x1F0000 is just below 2MB - but I cannot upload 1.5MB - the max size is closer to 1.2MB, so I’m unsure how PlatformIO is determining the size of the Flash for upload.

Here’s my very simple platformio.ini file:

platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
lib_deps = earlephilhower/ESP8266Audio@^1.9.6
monitor_speed = 115200
board_build.partitions = no_ota.csv

EDIT: Changed GB to MB - woops!

PlatformIO invokes mkspiffs with the given parameters

to generate a spiffs.bin. If that does not fit within the allocated size → error. The maximum size of the SPIFFS partition is not the maximum size of the uploaded file, this ignores the filesystem overhead.

What’s the size of the partitions.bin given a particular filesize where it later fails to upload? (Inside .pio/build/<env>)

Thanks @maxgerhardt - that helps understanding what is going on, but it doesn’t really explain the overhead:

$ /home/xxxx/.arduino15/packages/esp32/tools/mkspiffs/0.2.3/mkspiffs -l  .pio/build/esp32doit-devkit-v1/spiffs.bin
1228800	/bla.bin
12	/hello.txt
$ stat  .pio/build/esp32doit-devkit-v1/spiffs.bin
  File: .pio/build/esp32doit-devkit-v1/spiffs.bin
  Size: 2031616   	Blocks: 3968       IO Block: 4096   regular file
Device: fd02h/64770d	Inode: 36084       Links: 1
Access: (0664/-rw-rw-r--)  Uid: (1601400001/   xxxx)   Gid: (1601400001/   xxxx)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2022-03-06 19:32:42.832750405 -0500
Modify: 2022-03-06 19:32:42.828750413 -0500
Change: 2022-03-06 19:32:42.828750413 -0500
 Birth: 2022-03-06 19:32:42.721750642 -0500

This is test-data I BARELY can push with the 0x1f0000 size SPIFFS partition. Anything larger and it fails. And while I understand that overhead is unavoidable, having almost 50% overhead makes no sense. 1200KB taking 2000KB of structural data is QUITE the overhead.

It’s worth noting that with the old Arduino IDE I can push 1.5MB files to the same storage size just fine. So perhaps the constants used by platformio is part of the issue here.

Outside of using the partition table setup, is there a way for me to manipulate/control the size here - ie can I override the variables you list from platformio.ini ??

Hm not sure, you could try an extra_scripts (post) script that overwrites the value of env["SPIFFS_BLOCK"] and env["SPIFFS_PAGE"], but the values like 0x1000 (4096) are based on the flash’s properties (e.g. this).

That’s intersting, can post the exact version of which Arduino-ESP32 and possibly SPIFFS plugin you’re using there and for which filesize PlatformIO fails but the Arduino IDE does not?