esptool and OTA conflict

ThorstenS
Posts: 3
Joined: Sun Sep 17, 2017 11:52 am

esptool and OTA conflict

Postby ThorstenS » Sun Sep 17, 2017 12:00 pm

I am developing code, so the ESP32 checks a remote webserver for updated firmware. If a newer version is available, it downloads and flashes it via OTA.


After the first update to partition OTA 1, when I use "make flash" the esptool writes to partition OTA 0. But OTA 1 is still the active boot partition, so the device always reboots into OTA 1.

Is there a tool - or a command line option for esptool - to set OTA 0 as boot partition?

In my opinion, this is a bug. When esptool flashes to a partition, it should make it automatically the boot partition.

WiFive
Posts: 1160
Joined: Tue Dec 01, 2015 7:35 am

Re: esptool and OTA conflict

Postby WiFive » Sun Sep 17, 2017 7:59 pm

Erase otadata partition

ESP_Angus
Posts: 571
Joined: Sun May 08, 2016 4:11 am

Re: esptool and OTA conflict

Postby ESP_Angus » Mon Sep 18, 2017 1:43 am

Thanks for pointing this out. We're aware of this limitation and we're planning a fix, but we don't have an ETA yet.

The underlying issue is, at the moment the IDF build system doesn't know about OTA. Specifically, it doesn't know if there's an OTA data partition or where it is. It needs to parse the partition table in order to know this information. Then we can add options to automatically clear ota_data on serial flash (and/or to serial flash into an OTA slot instead of into "factory").

In the meantime, you can use manual esptool.py commands to clear ota_data. Either of the following will work:

Code: Select all

esptool.py --port PORT erase_region <address of ota_data> 0x2000


OR

Code: Select all

esptool.py erase_flash


(Second option only useful if you don't need any of the other contents of the flash.)

ThorstenS
Posts: 3
Joined: Sun Sep 17, 2017 11:52 am

Re: esptool and OTA conflict

Postby ThorstenS » Mon Sep 18, 2017 7:33 pm

Thanks for the info. erase_region will help. I used erase_flash once before, but deleting everything is not what I want.

Who is online

Users browsing this forum: No registered users and 1 guest