Problem Details:
OTA update writes the new firmware to ota_1 and marks it as the boot partition successfully.
Calls to esp_ota_get_boot_partition() confirm that the boot partition has been updated to ota_1 post-update.
On reboot, the ESP32 always boots from ota_0 (instead of ota_1 as intended)
Environment:
Board: ESP32-S3-WROOM-2-N32R8V (32MB Flash, 8MB PSRAM Octal)
Platform: PlatformIO (VSCode)
Framework: Arduino
Partition Table:
Code: Select all
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xE000, 0x2000,
app0, app, ota_0, 0x10000, 0xBB0000,
app1, app, ota_1, 0xBC0000, 0xBB0000,
nvm, data, nvs, 0x1770000, 0x890000,
The following analysis has been conducted:
1. Find the current boot partition (before update)
Code: Select all
esp_ota_get_boot_partition()
2. Check if ota partition is bootable
Code: Select all
if (_partitionIsBootable(_partition) == true) {
Serial.println("[Updater] Partition is bootable.");
}
3. Checked the ota partition's address
Code: Select all
Serial.println("[Updater] New partition address: " + String(_partition->address));
4. Verified result on setting boot partition
Code: Select all
esp_err_t result = esp_ota_set_boot_partition(_partition);
5. Forced the ota partition to mark app as valid after verification.
Code: Select all
if (esp_partition_verify(_partition)) {
// Mark the newly flashed partition as valid, if partition is valid
esp_err_t err = esp_ota_mark_app_valid_cancel_rollback();
if (err != ESP_OK) {
Serial.println("[Updater] Error: Partition not valid.");
Serial.println("[Updater] Error marking app valid! Code: " + String(err));
} else {
Serial.println("[Updater] Partition is valid.");
Serial.println("[Updater] App marked as valid. OK! Code: " + String(err));
}
}
6. Read-out the contents of ota_data partition
The following data is stored in the otadata partition (address: 0xE000, length 0x2000)
Code: Select all
01 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 9A 98 43 47
Question
How come that my ESP32 is still booting from partition app0 after reboot / power cycle?
The serial output confirms:
Code: Select all
Currently running from partition: Type: 0, Subtype: 16, Address: 0x10000
Thanks a lot for your help!