Better support for OTA updates on esp32
I work on an esp32 based device where we rely heavily on MicroPython for our development workflow and device code. We started using MicroPython around 2 years ago, and during that time we have developed a decent amount of MicroPython code. Part of that code is to support OTA (Over the Air) updates. Our current OTA Update system code was developed around 2 years ago for MicroPython v1.12 and is entirely written in python.
We have recently identified our propriety code as somewhat of a risk, and we want to rewrite the code to use more native espressif functions. Ideally, we want to contribute this code back to the community as we also rely on their work for our platform to function.
Is better support for OTA updates on esp32 something that should be added to MicroPython, and if so in what capacity?
The OTA update is specific to the firmware application, not files on the file system. We intend to develop a system that can download the update from both http and https sources.
I'm interested to hear what you think about this change.
esp32: Add bootloader rollback support for all boards.
This PR adds support for OTA rollback to the bootloader for all ESP32 builds:
- Add
CONFIG_BOOTLOADER_ROLLBACK_ENABLE=ytoports/esp32/boards/sdkconfig.baseso that all micropython esp32 images support OTA rollback in the bootloader.
With this change:
- Base micropython images for boards can be converted to OTA-capable images with app rollback support by user tools (eg. https://github.com/glenn20/mp-image-tool-esp32).
- Deployed devices can be hot-converted to OTA-enabled devices (with rollback support) be re-writing the partition table using tools, such as https://github.com/glenn20/micropython-esp32-ota.
There appears to be no detrimental impact arising rom enabling this feature in all ESP32 builds (see Espressif's App Rollback documentation).
This can also eliminate the need to build OTA variants of all esp32 boards for distribution if desired.