OTA update spiffs

chegewara
Posts: 2375
Joined: Wed Jun 14, 2017 9:00 pm

OTA update spiffs

Postby chegewara » Tue Nov 28, 2017 11:40 pm

Is there some way to OTA update spiffs partition?

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: OTA update spiffs

Postby loboris » Wed Nov 29, 2017 8:33 am

chegewara wrote:Is there some way to OTA update spiffs partition?
Of course, it should be quite simple.
Use the OTA example as the base and esp_partition API to erase/write the partition.
- Put your spiffs image file on some http server.
- First find your spiffs partition using esp_partition_find(), get the start address and size.
- Erase the whole partition using esp_partition_erase_range().
- Download the chunks of spiffs image file and write to the partition using esp_partition_write().
- You can optionally use md5 checksum file to validate the written data (use md5 API and esp_partition_read().

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

Re: OTA update spiffs

Postby Gfast2 » Sat Dec 02, 2017 10:35 am

loboris wrote:
chegewara wrote:Is there some way to OTA update spiffs partition?
Of course, it should be quite simple.
Use the OTA example as the base and esp_partition API to erase/write the partition.
- Put your spiffs image file on some http server.
- First find your spiffs partition using esp_partition_find(), get the start address and size.
- Erase the whole partition using esp_partition_erase_range().
- Download the chunks of spiffs image file and write to the partition using esp_partition_write().
- You can optionally use md5 checksum file to validate the written data (use md5 API and esp_partition_read().
Did you try your solution in code? AFAIK, OTA uses partition type APP, Spiffs ueses type Data. Would it works too?

Cheers

Su

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: OTA update spiffs

Postby WiFive » Sat Dec 02, 2017 11:13 am

That is why he said use esp_partition_write instead of esp_ota_write, etc...

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

Re: OTA update spiffs

Postby Gfast2 » Sat Dec 02, 2017 1:22 pm

WiFive wrote:That is why he said use esp_partition_write instead of esp_ota_write, etc...
Nice, If I get chance to try this out in code. I'll be back. 8-)

Cheers

Gfast2

zhivko
Posts: 23
Joined: Tue Dec 01, 2015 12:02 pm

Re: OTA update spiffs

Postby zhivko » Sat Dec 07, 2019 7:05 am

Have you done it? Could you share code if possible?

dmaxben
Posts: 108
Joined: Thu Nov 16, 2017 6:04 pm

Re: OTA update spiffs

Postby dmaxben » Tue Jan 07, 2020 7:26 pm

Anyone else had luck updating SPIFFS via OTA? I cant seem to find much information on it...

How hard is it to have the ESP32 download a compressed SPIFFS image via OTA, and then unpack it and write it into SPIFFS? Im using a 16MB flash unit, and downloading/writing a full uncompressed 11MB bin will take quite a while...

User avatar
AndyFreund
Posts: 2
Joined: Sun Apr 26, 2020 7:16 am

Re: OTA update spiffs

Postby AndyFreund » Sun Apr 26, 2020 7:36 am

I used this tool https://github.com/chrisjoyce911/esp32FOTA with success in my application.
It works well with an esp32 for OTA-update of firmware as well as for a SPIFFS partition update.

espFOTA.cpp includes update.h
To start an update they use

Code: Select all

bool canBegin = Update.begin(contentLength);
.

If you use

Code: Select all

bool canBegin = Update.begin(contentLength, U_FLASH);
you update OTA partitions.
If you use

Code: Select all

bool canBegin = Update.begin(contentLength, U_SPIFFS);
you update an data spiffs partition.

Contact me, if you need more information.

miracle0419
Posts: 1
Joined: Fri Oct 30, 2020 9:04 pm

Re: OTA update spiffs

Postby miracle0419 » Fri Oct 30, 2020 9:36 pm

I will contact you after seeing your post on "Re: OTA update spiffs."
Currently working on several project with ESP32. So, please let us know if we have any problem about the OTA Processor via SPIFFS.
- Flash Size : 4Mb(32MB)
- Partition Scheme : No OTA (2MB APP/2MB SPIFFS)
- Size of APP Binary : 1.5 MB

1. App binary file copy to SPIFFS via UART
2. Update.begin(contentLength, U_SPIFFS);
3. Update.write("Apps.bin", size);
4. Update.end();
5. Rebooting...

Thanks CK

pedros89
Posts: 4
Joined: Tue Aug 03, 2021 9:28 am

Re: OTA update spiffs

Postby pedros89 » Tue Aug 03, 2021 9:33 am

Hello, you may find a repository to do OTA update spiffs with code for Arduino IDE here:

https://github.com/pedros89/ESP32-OTA-u ... th-Arduino

Who is online

Users browsing this forum: Google [Bot] and 367 guests