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: improve support for OTA updates
This PR adds several small items to improve the support for OTA updates:
- a partition table for 4MB flash modules that has two OTA partitions ready to go to do updates
- a GENERIC_OTA board that uses that partition table and that enables automatic roll-back in the bootloader
- a new
esp32.Partition.boot_ok()function to signal that the boot is successful and should not be rolled back at the next reset - documentation updates
I have manually tested the roll-back stuff and I have also tested the OTA process in general, however only with ESP-IDF v4. I'm not sure how to construct an automated test for OTA without a lot of effort.