mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-02 10:00:57 +02:00
fix(panic_handler): Fixed a issue where the system reboots before halt
This commit fixes an issue where the panic handler may reboot even if it is configured to halt the CPU. Closes https://github.com/espressif/esp-idf/issues/17260
This commit is contained in:
@@ -262,6 +262,14 @@ static inline void disable_all_wdts(void)
|
||||
wdt_hal_write_protect_enable(&rtc_wdt_ctx);
|
||||
}
|
||||
|
||||
/* IRAM-only halt stub: reset modules, then loop */
|
||||
void IRAM_ATTR esp_panic_handler_reset_modules_on_exit_and_halt(void)
|
||||
{
|
||||
// Do not print or call non-IRAM functions beyond this point
|
||||
esp_system_reset_modules_on_exit();
|
||||
ESP_INFINITE_LOOP();
|
||||
}
|
||||
|
||||
/********************** Panic handler functions **********************/
|
||||
|
||||
/* This function is called from the panic handler entry point to increment the panic entry count */
|
||||
@@ -455,10 +463,10 @@ void esp_panic_handler(panic_info_t *info)
|
||||
panic_print_str("Rebooting...\r\n");
|
||||
panic_restart();
|
||||
#else /* CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT || CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT */
|
||||
esp_panic_handler_feed_wdts();
|
||||
panic_print_str("CPU halted.\r\n");
|
||||
esp_system_reset_modules_on_exit();
|
||||
disable_all_wdts();
|
||||
ESP_INFINITE_LOOP();
|
||||
esp_panic_handler_reset_modules_on_exit_and_halt();
|
||||
#endif /* CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT || CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT */
|
||||
#endif /* CONFIG_ESP_SYSTEM_PANIC_GDBSTUB */
|
||||
}
|
||||
|
Reference in New Issue
Block a user