From bb58c69d388952f0cf0aaebdfba78c4d47b0b31d Mon Sep 17 00:00:00 2001 From: torlando-tech Date: Mon, 23 Feb 2026 16:57:05 -0500 Subject: [PATCH] Add core dump partition for crash analysis Carve 64KB from SPIFFS for a coredump partition at 0x7F0000. On any crash (panic, WDT, assert), the ESP32 writes CPU state and backtrace to flash, readable on next boot with espcoredump. Co-Authored-By: Claude Opus 4.6 --- partitions.csv | 3 ++- sdkconfig.defaults | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/partitions.csv b/partitions.csv index eb0ce2fd..e11f4430 100644 --- a/partitions.csv +++ b/partitions.csv @@ -4,4 +4,5 @@ nvs, data, nvs, 0x9000, 0x5000, otadata, data, ota, 0xe000, 0x2000, app0, app, ota_0, 0x10000, 0x300000, app1, app, ota_1, 0x310000, 0x300000, -spiffs, data, spiffs, 0x610000, 0x1F0000, +spiffs, data, spiffs, 0x610000, 0x1E0000, +coredump, data, coredump,0x7F0000, 0x10000, diff --git a/sdkconfig.defaults b/sdkconfig.defaults index a9676aba..c30db98d 100644 --- a/sdkconfig.defaults +++ b/sdkconfig.defaults @@ -84,3 +84,12 @@ CONFIG_ESP_TASK_WDT_EN=y CONFIG_ESP_TASK_WDT_TIMEOUT_S=30 CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y + +# ============================================================================ +# Core Dump — writes CPU state + backtrace to flash on crash +# Read with: espcoredump.py info_corefile -t raw -c 0x7F0000 -s 0x10000 +# ============================================================================ +CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=y +CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF=y +CONFIG_ESP_COREDUMP_CHECKSUM_SHA256=y +CONFIG_ESP_COREDUMP_MAX_TASKS_NUM=64