mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-03 18:40:59 +02:00
Merge branch 'fix/panic_handler_reboot_before_halt_v5.4' into 'release/v5.4'
fix(panic_handler): Fixed a issue where the system reboots before halt (v5.4) See merge request espressif/esp-idf!41267
This commit is contained in:
@@ -262,6 +262,14 @@ static inline void disable_all_wdts(void)
|
|||||||
wdt_hal_write_protect_enable(&rtc_wdt_ctx);
|
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 **********************/
|
/********************** Panic handler functions **********************/
|
||||||
|
|
||||||
/* This function is called from the panic handler entry point to increment the panic entry count */
|
/* 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_print_str("Rebooting...\r\n");
|
||||||
panic_restart();
|
panic_restart();
|
||||||
#else /* CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT || CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT */
|
#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");
|
panic_print_str("CPU halted.\r\n");
|
||||||
esp_system_reset_modules_on_exit();
|
|
||||||
disable_all_wdts();
|
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_PRINT_REBOOT || CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT */
|
||||||
#endif /* CONFIG_ESP_SYSTEM_PANIC_GDBSTUB */
|
#endif /* CONFIG_ESP_SYSTEM_PANIC_GDBSTUB */
|
||||||
}
|
}
|
||||||
|
@@ -83,6 +83,10 @@ void test_setup_coredump_summary(void);
|
|||||||
void test_coredump_summary(void);
|
void test_coredump_summary(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT
|
||||||
|
void test_panic_halt(void);
|
||||||
|
#endif /* CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -127,6 +127,9 @@ void app_main(void)
|
|||||||
HANDLE_TEST(test_name, test_tcb_corrupted);
|
HANDLE_TEST(test_name, test_tcb_corrupted);
|
||||||
HANDLE_TEST(test_name, test_panic_handler_stuck0);
|
HANDLE_TEST(test_name, test_panic_handler_stuck0);
|
||||||
HANDLE_TEST(test_name, test_panic_handler_crash0);
|
HANDLE_TEST(test_name, test_panic_handler_crash0);
|
||||||
|
#if CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT
|
||||||
|
HANDLE_TEST(test_name, test_panic_halt);
|
||||||
|
#endif /* CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT */
|
||||||
#if CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH && CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF
|
#if CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH && CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF
|
||||||
HANDLE_TEST(test_name, test_setup_coredump_summary);
|
HANDLE_TEST(test_name, test_setup_coredump_summary);
|
||||||
HANDLE_TEST(test_name, test_coredump_summary);
|
HANDLE_TEST(test_name, test_coredump_summary);
|
||||||
|
@@ -443,3 +443,12 @@ void test_capture_dram(void)
|
|||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT
|
||||||
|
void test_panic_halt(void)
|
||||||
|
{
|
||||||
|
printf("Triggering panic. Device should print 'CPU halted.' and stop.\n");
|
||||||
|
fflush(stdout);
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT */
|
||||||
|
@@ -1237,3 +1237,12 @@ def test_tcb_corrupted(dut: PanicTestDut, target: str, config: str, test_func_na
|
|||||||
expected_backtrace=None,
|
expected_backtrace=None,
|
||||||
expected_coredump=coredump_pattern
|
expected_coredump=coredump_pattern
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.generic
|
||||||
|
@pytest.mark.supported_targets
|
||||||
|
@pytest.mark.parametrize('config', ['panic_halt'], indirect=True)
|
||||||
|
def test_panic_halt(dut: PanicTestDut) -> None:
|
||||||
|
dut.run_test_func('test_panic_halt')
|
||||||
|
dut.expect_exact('CPU halted.', timeout=30)
|
||||||
|
dut.expect_none(dut.REBOOT, timeout=3)
|
||||||
|
5
tools/test_apps/system/panic/sdkconfig.ci.panic_halt
Normal file
5
tools/test_apps/system/panic/sdkconfig.ci.panic_halt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Panic halt CI config
|
||||||
|
CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y
|
||||||
|
CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=n
|
||||||
|
CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=n
|
||||||
|
CONFIG_ESP_SYSTEM_PANIC_GDBSTUB=n
|
Reference in New Issue
Block a user