papadeltasierra wrote: ↑Thu Dec 07, 2023 9:32 am
Is it possible to use OTA with an ESP32c3 that has only 2MB of flash? I have seen partition tables where OTA1 and OTA2 seem to be the same address so is this possible on the understanding that if it failed, we're "in trouble"? Is there any recovery mechanism possible that does NOT require cables and flashing from a local system?
I don't think that's realistically possible because
1) an application (or bootloader) cannot overwrite its own code while it is running (unless it runs completely from IRAM)
2) the bootloader could overwrite any application partition, but
3) if a bootloader were to use WiFi or Bluetooth for OTA, you'd end up with a ~1MB bootloader
Thinking about it, it may be possible to do a 'hybrid' OTA where the application retrieves the
update data in compressed form and stores the compressed data to a flash partition, and the bootloader takes that data from flash, uncompresses it and updates the application on the next boot.
This may save a lot of flash memory because it doesn't require storing a full second copy of an application in flash, and 'only' the code for decompressing the update has to be added to the bootloader.
Edit: Ah, no, probably also not realistic as-is. The binary delta will need the full previous version of the application intact until completely 'decompressed'.