feat(coredump): add coredump_extram attribute

Closes https://github.com/espressif/esp-idf/issues/15429

(cherry picked from commit 5ba3e9df98)
This commit is contained in:
Erhan Kurubas
2026-09-09 11:34:05 +02:00
parent 16cd970a43
commit eb67fea33d
9 changed files with 89 additions and 2 deletions
@@ -87,6 +87,10 @@ void test_panic_print_backtrace(void);
void test_panic_halt(void);
#endif /* CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT */
#if CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY && CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY
void test_panic_extram_attr(void);
#endif
#ifdef __cplusplus
}
#endif
@@ -222,5 +222,9 @@ void app_main(void)
#endif
#endif
#if CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY && CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY
HANDLE_TEST(test_name, test_panic_extram_attr);
#endif
die("Unknown test name");
}
@@ -430,6 +430,16 @@ void test_capture_dram(void)
}
#endif
#if CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY && CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY
COREDUMP_EXTRAM_ATTR uint32_t g_extram_bss_var;
COREDUMP_EXTRAM_NOINIT_ATTR uint32_t g_extram_noinit_var;
void test_panic_extram_attr(void)
{
g_extram_bss_var = 123456;
g_extram_noinit_var = 789012;
assert(0);
}
#endif
#if CONFIG_ESP_SYSTEM_USE_FRAME_POINTER
@@ -285,6 +285,25 @@ def test_panic_extram_stack(dut: PanicTestDut, config: str) -> None:
common_test(dut, config, expected_backtrace=None, expected_coredump=[coredump_pattern])
@pytest.mark.psram
@idf_parametrize('config, target', [('coredump_flash_extram_attr_esp32', 'esp32')], indirect=['config', 'target'])
def test_panic_extram_attr(dut: PanicTestDut, config: str) -> None:
dut.run_test_func('test_panic_extram_attr')
regex_pattern = rb'assert failed:[\s\w()]*?\s[.\w/]*\.(?:c|cpp|h|hpp):\d.*$'
dut.expect(re.compile(regex_pattern, re.MULTILINE))
dut.expect_backtrace()
dut.expect_elf_sha256()
dut.expect_none(['Guru Meditation', 'Re-entered core dump'])
expect_coredump_flash_write_logs(dut, config)
core_elf_file = dut.process_coredump_flash()
dut.start_gdb_for_coredump(core_elf_file)
assert dut.gdb_data_eval_expr('g_extram_bss_var') == '123456'
assert dut.gdb_data_eval_expr('g_extram_noinit_var') == '789012'
@pytest.mark.generic
@idf_parametrize('config, target', CONFIGS, indirect=['config', 'target'])
def test_int_wdt(dut: PanicTestDut, target: str, config: str, test_func_name: str) -> None:
@@ -0,0 +1,12 @@
CONFIG_IDF_TARGET="esp32"
CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=y
# We need to have the coredump info log
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
CONFIG_SPIRAM=y
CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM=y
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y
CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY=y
CONFIG_ESP_COREDUMP_USE_STACK_SIZE=y
CONFIG_ESP_COREDUMP_CAPTURE_DRAM=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_capture_dram.csv"