Page 1 of 1

How to update spiffs partition content

Posted: Fri Nov 17, 2017 9:00 am
by Gfast2
Hi EPS-IDF,

I know I did not investigate enough time with google around this question 8-)

But is there a way to update the content (not Software, but only bunch of configuration files) of a spiffs partition of the spi flash chip?

cheers

Gfast2

Re: How to update spiffs partition content

Posted: Fri Nov 17, 2017 9:01 am
by Gfast2
Better wounld be two possibilities:

1. Through Serial Port.
2. Through OTA way

cheers

Gfast

Re: How to update spiffs partition content

Posted: Fri Nov 17, 2017 8:42 pm
by Gfast2
I think I have some ideas to deploy the OTA update mechanism to update the spiffs partition first. But how to access / write spiffs through serial port is stil unclear.

Re: How to update spiffs partition content

Posted: Fri Nov 17, 2017 11:44 pm
by kolban
I personally haven't looked into that area in depth .. but my loose thinking would be that since SPIFFs data is held in a partition and a partition is merely/just an area of flash memory that is "cataloged" then any data you receive (be it through WiFi, BLE, Serial, SPI, I2C or other mechanism) can be used as the new data to replace the existing content of that flash memory. The ESP-IDF APIs provide mechanisms to change the flash memory (re-write it) at run time.

That would seem to imply that arbitrary logic such as:

Code: Select all

while (notFinished) {
   read a block of data from source;
   write the block of memory to flash;
}
The choice of "source" becomes your own code. If this holds water, then the story splits into two areas. How do we get the source data and the second would be which APIs to use to write to flash.

Re: How to update spiffs partition content

Posted: Sat Nov 18, 2017 12:25 pm
by Gfast2
kolban wrote:I personally haven't looked into that area in depth .. but my loose thinking would be that since SPIFFs data is held in a partition and a partition is merely/just an area of flash memory that is "cataloged" then any data you receive (be it through WiFi, BLE, Serial, SPI, I2C or other mechanism) can be used as the new data to replace the existing content of that flash memory. The ESP-IDF APIs provide mechanisms to change the flash memory (re-write it) at run time.

That would seem to imply that arbitrary logic such as:

Code: Select all

while (notFinished) {
   read a block of data from source;
   write the block of memory to flash;
}
The choice of "source" becomes your own code. If this holds water, then the story splits into two areas. How do we get the source data and the second would be which APIs to use to write to flash.
Hi Kolban,

Huge thanks for your advice again!!!

Image I burn spi flash in batch. If I can't burn the spiffs partition in batch. I'd write code that do the writing job as you said, which increase the comlexity of the code which may be less cool as it can be. 8-)