Flash ESP32 image and SPIFFS data at the same time?

When using the ESP-IDF tools to build a project for ESP32, it is possible to make the idf.py flash command write both the application image and a SPIFFS partition content image in one shot by adding the following to project root directory’s CMakeLists.txt file:

spiffs_create_partition_image(spiffs spiffs FLASH_IN_PROJECT)

Is there an equivalent in PlatformIO that would allow me to flash the SPIFFS data directory at the same as the application? I am using a custom partitions.csv file that includes a SPIFFS partition.

1 Like

As far as I know the firmware upload and SPIFFS / file system upload are two seperate targets that are not merged (also see code).

You can still execute them in sequence by giving multiple target switches: pio run -t upload -t uploadfs (docs) will compile the firmware if changed, upload the FW and build and upload the filesystem. If you are working in VSCode, see adding custom tasks.

I’m sure a feature can be added that combines the upload and uploadfs in one flash command which has everything for some potential time save. You can request it at GitHub - platformio/platform-espressif32: Espressif 32: development platform for PlatformIO. Until that you can use the method above.