Accessing SPIFFS independently of loading program



  • I have some questions about SPIFFS.

    I think I understand how to access it from within my program (theoretically, I haven't tried this). But I've a couple of theoretical questions, and one practical one:

    Do the contents survive hard reset?
    Do the contents survive uploading new software?

    My interest is in using it to store font files for use on M5Paper. I've seen examples referencing a font file on SPIFFS. My practical question is how they get there! Is there a way to store data on SPIFFS independently of the program I upload. That is, can I upload some font files; and then access them regardless of the programs I'm uploading? Or does each program have to first download the font file from somewhere, store it on SPIFFS, so it can then access it?

    (Or do I need to write a program to load a file on to SPIFFS, run that, then overwrite it with the program that will use those files?)

    Apologies if this is covered somewhere in docs, I couldn't see it.

    TIA



  • Hello @Hamnet

    SPIFFS is just a chunk of the flash that has been put aside.

    • yes, its content survive a hard reset. (E.g. pressing the reset button or power loss.)
    • yes, its content survive uploading new firmware as long as the new firmware uses the same partition scheme. (Meaning the chunk of flash put aside is still at the same location in the flash.)
    • no, its content does not survive if you erase the flash chip.

    I also found these two tutorials which might help you:

    Thanks
    Felix



  • @felmue Thank you so much Felix, you've helped me again.