app-flash and ota

a2800276
Posts: 78
Joined: Sat Jan 23, 2016 1:59 pm

app-flash and ota

Postby a2800276 » Sun May 22, 2022 12:28 pm

Is there a hidden option (aka "something I overlooked) to use use `app-flash` when using ota partitions?

Background: I'm using `idf.py app-flash` / `Ctl-T Ctl-A` in the serial monitor during development to speed up firmware flashing. Unfortunately, when I'm testing OTA, `app-flash` flashes to the `factory` partition, but the reboot will take place into an OTA partition. I'm aware I _could_ call `erase_otadata` to perform the next reboot from the factory partition, but I'd prefer avoiding the additional step: either a command that resets ota_data automatically, or just flashes the app into the next ota partition and updates ota_data to boot from there.

Any pointers? If this doesn't exist, would the IDF team be open for a patch?

Sorry if this is redundant: I'm having a bit of difficulty searching for this, I think both the forum and github issues don't handle '-' dashes well :( or, more likely, I'm an idiot.

ESP_Mahavir
Posts: 190
Joined: Wed Jan 24, 2018 6:51 am

Re: app-flash and ota

Postby ESP_Mahavir » Mon May 23, 2022 11:33 am

Hello,

Your understanding is correct and if you erase otadata partition then device shall bootup from factory partition again. Underlying `idf.py app-flash` is esptool based command itself and hence you can directly use esptool "write_flash" based command with appropriate flash offset to write firmware to desired partition. Please refer to https://docs.espressif.com/projects/esp ... rite-flash for underlying command related help.

either a command that resets ota_data automatically, or just flashes the app into the next ota partition and updates ota_data to boot from there
One option is to combine both commands as:

Code: Select all

idf.py erase-otadata app-flash
Alternate approach to follow policy similar to OTA updates (appropriate slot based write, update of otadata partition) shall add additional complexity at tooling level (IMO).

Hope this helps, please feel free to raise any additional questions!

Thanks.

a2800276
Posts: 78
Joined: Sat Jan 23, 2016 1:59 pm

Re: app-flash and ota

Postby a2800276 » Mon May 23, 2022 11:52 am

Thanks, Mahavirm, excellent answer!

Have to admit that I am lazy and was looking for a single command or, better yet, keyboard shortcut in `monitor`. Maybe I'll try my luck at putting that together.

I think I'll experiment with leaving out the factory partition enitrely. From the docs it sounds like app-flash would flash to ota if no factory partition exists. I never really saw the point in having three potential app partitions anyway ... (Not a question, just thinking out loud)

Who is online

Users browsing this forum: Majestic-12 [Bot], ok-home and 78 guests