Search code examples
esp8266spiffs

With SPIFFS or LittleFS, on an ESP8266, is it possible to write a filesystem to flash, and then later create/modify files from the firmware?


To clarify, I'm working on a project on an esp8266 (specifically an esp-12s using NodeMCU 1.0).

I have a bunch of html files and images that I bundle into a LittleFS binary that gets written to the flash using esptool (or the arduino ide, which uses esptool internally anyway).

To store the user's settings, I also create a file with the intention of serialising that data to the file.

Unfortunately it crashes and resets as soon as I call LittleFS.open(path, "w");.

So I just need to know, if I compile and upload a filesystem, is that filesystem "Read only"?

(If the answer is yes, then I know I need to use a different method to save user data, if it's no, then there's a bug in my code somewhere)


Solution

  • No, a filesystem image written to flash is not read-only. It's usable exactly as if it had been created by the firmware. There is no discernible difference to the software running on the ESP8266.