硬件:esp32 dwod
idf v4.4
参照例子:native_ota_example写的ota程序,升级完成后,重启进入:
const esp_partition_t *running = esp_ota_get_running_partition();
esp_ota_img_states_t ota_state;
if (esp_ota_get_state_partition(running, &ota_state) == ESP_OK) {
if (ota_state == ESP_OTA_IMG_PENDING_VERIFY) {
// run diagnostic function ...
bool diagnostic_is_ok = diagnostic();
if (diagnostic_is_ok) {
ESP_LOGI(TAG, "Diagnostics completed successfully! Continuing execution ...");
esp_ota_mark_app_valid_cancel_rollback();
} else {
ESP_LOGE(TAG, "Diagnostics failed! Start rollback to the previous version ...");
esp_ota_mark_app_invalid_rollback_and_reboot();
}
}
}
校验成功,执行:esp_ota_mark_app_valid_cancel_rollback() 时,esp32直接重启:
I (1302) ESP32: SHA-256 for the partition table: : fbd17bd5dfe30a5b41cf748df6b67972d33699e18ba40e10005d93b46fa471bb
I (1304) ESP32: SHA-256 for bootloader: : 153f40bd798f490dc753ef5ddbe383adb144b40ea7af2af5cc96c413327099c3
I (1314) ESP32: Running partion:ota_0
I (1320) ESP32: SHA-256 for current firmware: : f2bfa8da66d1ddc01adfc6cd55194908894d4c6ead21fd598fa1e313e738d340
I (1339) ESP32: Running partition is verfying ...
I (1340) ESP32: Diagnostics completed successfully! Continuing execution ...
ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6612
load:0x40078000,len:14880
ho 0 tail 12 room 4
load:0x40080400,len:3792
entry 0x40080694
I (29) boot: ESP-IDF v4.4-dirty 2nd stage bootloader
I (29) boot: compile time 09:33:57
I (29) boot: chip revision: 3
I (32) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (39) boot.esp32: SPI Speed : 40MHz
I (44) boot.esp32: SPI Mode : DIO
I (49) boot.esp32: SPI Flash Size : 8MB
I (53) boot: Enabling RNG early entropy source...
然后继续使用升级前的分区,升级失败。
什么原因导致毫无征兆的重启呢?
OTA升级,确定运行分区时重启
Re: OTA升级,确定运行分区时重启
不是函数的原因,硬件看门狗导致.close this issuse.
Who is online
Users browsing this forum: Bing [Bot] and 84 guests