I have an ESP32 that I want to be able to upload new firmware with both OTA updates and serial uploading. After an OTA update the active partition changes from ota_0 to ota_1. If the ESP32 is running off of ota_1 and upload new firmware over serial, the new firmware goes onto ota_0, but the ESP32 will continue to use ota_1 after reset.
Is there a flag or build option I can use to set the active partition to ota_0 after serial firmware upload?
Change the upload offset to the OTA partition you want per this. The address should be calculatable through the given partition table.
I guess the issue I have is that I don’t know at the time of upload whether the ESP32 is set to boot off of ota_0 or ota_1, it depends on how many OTA updates have been applied since the device has last been locally updated.
Right now the only way I can for sure upload to the correct partition is to erase the flash first, then upload to ota_0 and also reupload the SPIFFS, but that means I cannot store anything specific to that device on SPIFFS because it could be erased with a local upload process.