OTA LittleFS filesystem updates #1590
-
Dear @earlephilhower, maybe a silly question, but have compressed (gzip -9) and non-compressed LittleFS filesystem updates using OTA been verified to work? The docu states that the core can do this, but it is a bit confusing as it mentions functionality from the esp8266 core (the eboot bootloader) which is not present in the pico core. I am asking because i have been trying without success to update the LittleFS filesystem of my pico using a HTTP web server. These problems could well be my own fault; i took the HTTPUpdate, Updater and HTTPClient classes and made some modifications to get it to work with Ethernet instead of WiFi. Updating the sketch works fine, both compressed and non-compressed. I got non-compressed filesystem updating to work, but had to make a modification for that. In the compressed case, I did define ATOMIC_FS_UPDATE. The file is downloaded and the (compressed) data written to flash, after rebooting i cannot read the filesystem anymore, which has then compressed size (FSInfo.usedBytes). I could give more details, but first i wanted to make sure whether the problems i have are self-made or not :) Thank you for this great core! Best, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
I haven't tried it in a while, so there may be some bit rot, but I think this is the root cause:
For ATOMIC updates (the only way to do a FS upgrade) the OTA code simply writes the data directly into flash as-received. Only the bootloader has gunzip support, not the main core (it's ~10K of code and ~40Kof RAM required so non-trivial). The core ATOMIC_xx OTA code just writes bytes as-received. Can you try a FS upload uncompressed, instead? |
Beta Was this translation helpful? Give feedback.
-
Please note my previous comment:
Unfortunately i cannot test this with the original codebase, as i do not have a pico with wifi support. In case you encounter the same error in the future, the modification i described above fixed it in my case. |
Beta Was this translation helpful? Give feedback.
Looks like I should a) finish at least one coffee and b) read the code before commenting. 😆
Any ATOMIC_FS_UPDATE reference here should be deleted from the code, it's just not supported. On the 8266 there's a separate, unused area of flash for OTA binaries so with this flag you can tell the main app OTA code to stuff a FS image into this spot, instead of overwriting the actual FS region. Then, on the 8266 the eboot will decompress and write from the OTA area into the FS area.
On this core I chose to do something different w/OTA. Because most boards will be stuck w/2MB of flash I didn't want to waste so much area and limit FS and app size. So instead of the bootloader reading an unused regi…