First, you need a partition table that allows some storage for SPIFFS files. The default one, partitions_singleapp.csv, has no spiffs partition (see PlatformIO docs). So, I copied that file into my project and, adapting from the Arduino file here,
I wrote my partitions_custom.csv as
# Name, Type, SubType, Offset, Size, Flags
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
nvs, data, nvs, , 0x6000,
phy_init, data, phy, , 0x1000,
factory, app, factory, , 1M,
spiffs, data, spiffs, , 1M
for a 1MB SPIFFS into the root of my project folder.
Further I need to tell PlatformIO and the ESP-IDF tools that that is now my partition table, so I add
board_build.partitions = partitions_custom.csv
to my platformio.ini and use the “Run Menuconfig” project task to go into “Partition Table” and change it to a custom partition with the file name I have chosen.
And I quit-and-save out of that. Further, as per docs linked above, I now modify the CMakeLists.txt file in the root of my project to tell it that I want to build the SPIFFS partition binary from a certain folder in my project, by adding
and the bottom to fill the spiffs partition with the files from data. I then create a data folder in my project and put in a index.html with some file content.
I use the project task “Build Filesystem Image” and…
Thank you for your reply.
I figured out the same solution after turning to official ESP-IDF VSCode extension.
If it can detect missing the partition table, it will help new user locating the root cause.
Not as far as I know, Max. The Extensions window on my VS Code/PlatformIO screen shows Arduino, C/C++, Jupyter, markdownlint, PlatformIO IDE and Python. I haven’t explicitly installed any of those, other than PlatformIO and Python.
For the time being, I’m using the solution mentioned earlier - setting up a dummy Arduino .ino file with a data sub-folder and then using my Arduino app’s Sketch Data Upload facility - but this is cumbersome, doing half the work in PlatformIO and half in Arduino, since this seemed to involve closing one app and opening the other at each stage, to avoid “port in use”-type messages.
I didn’t get around to trying this, Max, since Sara Santos supplied a solution which allowed me to progress with my task of working through one of the Random Nerd Tutorial eBooks on ESP32 Webservers. Thanks anyway.