core dump: move stack into the internal memory when dumping to flash

Since SPI flash operations can not be performed when the stack is in
external RAM, we need to switch to a different stack when doing a
core dump to flash. This is achieved by a pair of longjmp's, one of
which is crafted manually to jump into a designated function with a
specific stack set up.
The cost of this feature is a bit of IRAM, plus the DRAM required for
the extra stack.

Closes AUD-1355
This commit is contained in:
Ivan Grokhotkov
2020-03-11 20:27:26 +01:00
committed by maojianxin
parent a80cf2dc69
commit de662d5e11
7 changed files with 96 additions and 11 deletions

View File

@@ -621,11 +621,7 @@ static __attribute__((noreturn)) void commonErrorHandler(XtExcFrame *frame)
disableAllWdts();
s_dumping_core = true;
#if CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH
if (esp_ptr_external_ram(get_sp())) {
panicPutStr("Stack in PSRAM, skipping core dump to Flash.")
} else {
esp_core_dump_to_flash(frame);
}
esp_core_dump_to_flash(frame);
#endif
#if CONFIG_ESP32_ENABLE_COREDUMP_TO_UART && !CONFIG_ESP32_PANIC_SILENT_REBOOT
esp_core_dump_to_uart(frame);