ESP32 OTA firmware update simple example #9579
Unanswered
chaseadam
asked this question in
Hardware & Peripherals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Here is a basic example of an OTA Partitions update for Micropython firmware on the ESP32. There are several solutions for updating the code running on the device, but I didn't find an end to end example using the OTA functions to update the firmware. Hope this is useful to others.
This was the most basic end to end example I could build. There are likely many layers (i.e. verification, etc.) and likely improvements (python structure) to be made.
Uses
socket
esp32.Partition
The following will take whatever is streamed over the socket and write it to the "next" partition. I created a socket server with the following:
I found the micropython.bin in
./build-GENERIC_OTA/
after building micropython withBOARD=GENERIC_OTA make
. This represents the Partition contents whereas the firmware.bin includes all the partitions and bootloader.I have hard coded port 8889.
The default partition table allows for 384 sectors per partition. Sectors are 4096 bytes, so this should work for any micropython.bin file which is less than 1572864 bytes (latest upstream build used 368 sectors).
My replconf.py file contains:
otaplay.py
Run with:
If you want to boot to the other partition:
and if you wish to not rollback to the previous partition after boot, you must call
currentPartition.mark_app_valid_cancel_rollback()
Beta Was this translation helpful? Give feedback.
All reactions