How to debug application in OTA1 partition

dalmat
Posts: 3
Joined: Sun Apr 24, 2016 1:04 pm

How to debug application in OTA1 partition

Postby dalmat » Mon Oct 02, 2023 4:36 pm

I am using an ESP32C3 processor. IDE is Visual Studio 2022 with VisualGDB. I'm making an application that has a bootloader and a webserver application - These are my partitions:

# Name, Type, SubType, Offset, Size, Flags
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap

nvs, data, nvs, , 0x6000,
phy_init, data, phy, , 0x1000,
factory, app, factory, , 1M,
webserver, app, ota_1, , 0x100000,

The bootloader should be in the "factory" partition and the webserver in the "webserver" ota_1 partition. How do I compile a webserver application to be downloaded and executed from the ota_1 partition. I tried various combinations, but it always downloads to the "factory" partition.

ESP_Sprite
Posts: 9568
Joined: Thu Nov 26, 2015 4:08 am

Re: How to debug application in OTA1 partition

Postby ESP_Sprite » Tue Oct 03, 2023 1:44 am

There's no difference in how the binaries for the two partitions get compiled; the toolchain simply isn't made to flash your binary to an OTA partition when a factory partition is available. You can get around it by using esptool.py to manually flash the webserver binary to the correct offset.

boarchuz
Posts: 598
Joined: Tue Aug 21, 2018 5:28 am

Re: How to debug application in OTA1 partition

Postby boarchuz » Tue Oct 03, 2023 4:03 am

You can give this a try: https://github.com/boarchuz/bo_cflash
I've only used it with ESP32, in VS Code, and likely with a different IDF version to yours, so expect some obstacles.

Anyway, if it works, it allows you to select the app partition you want to flash to and optionally update ota_data at the same time to make that partition active.

jenschr
Posts: 7
Joined: Sun Sep 17, 2023 12:40 pm

Re: How to debug application in OTA1 partition

Postby jenschr » Wed Aug 14, 2024 9:58 am

Old topic, but it shows up on Google so I'll update it with an answer. Be advised that for OTA, you'll need TWO ota partitions as per the documentation: https://docs.espressif.com/projects/esp ... m/ota.html

The reason is that once you flash an OTA app to ota_0 - where will you store the next update? The ESP will automatically toggle/cycle between the two (or more) OTA partitions, so you always have a way to receive the next update :D

Who is online

Users browsing this forum: Google Adsense [Bot] and 109 guests