How to update spiffs partition content

User avatar
Gfast2
Posts: 182
Joined: Fri Aug 11, 2017 1:52 am

How to update spiffs partition content

Postby Gfast2 » Fri Nov 17, 2017 9:00 am

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

User avatar
Gfast2
Posts: 182
Joined: Fri Aug 11, 2017 1:52 am

Re: How to update spiffs partition content

Postby Gfast2 » Fri Nov 17, 2017 9:01 am

Better wounld be two possibilities:

1. Through Serial Port.
2. Through OTA way

cheers

Gfast

User avatar
Gfast2
Posts: 182
Joined: Fri Aug 11, 2017 1:52 am

Re: How to update spiffs partition content

Postby Gfast2 » Fri Nov 17, 2017 8:42 pm

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.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: How to update spiffs partition content

Postby kolban » Fri Nov 17, 2017 11:44 pm

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.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

User avatar
Gfast2
Posts: 182
Joined: Fri Aug 11, 2017 1:52 am

Re: How to update spiffs partition content

Postby Gfast2 » Sat Nov 18, 2017 12:25 pm

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-)

Who is online

Users browsing this forum: No registered users and 60 guests