From 1fb82085b9e9f06fa1314eda03ff72e1186ae726 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 4 Mar 2020 11:19:00 +0100 Subject: [PATCH] core dump: skip core dump to flash if the stack pointer is in PSRAM Since flash operations disable the cache, we shouldn't try to run core dump to flash when the stack is in PSRAM. Ref. AUD-1355 --- components/esp32/panic.c | 6 +++++- components/freertos/include/freertos/task.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/esp32/panic.c b/components/esp32/panic.c index 8f105cac37..12aeff7531 100644 --- a/components/esp32/panic.c +++ b/components/esp32/panic.c @@ -612,7 +612,11 @@ static __attribute__((noreturn)) void commonErrorHandler(XtExcFrame *frame) disableAllWdts(); s_dumping_core = true; #if CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH - esp_core_dump_to_flash(frame); + if (esp_ptr_external_ram(get_sp())) { + panicPutStr("Stack in PSRAM, skipping core dump to Flash.") + } else { + 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); diff --git a/components/freertos/include/freertos/task.h b/components/freertos/include/freertos/task.h index 81f51e55b0..6989a1aa3c 100644 --- a/components/freertos/include/freertos/task.h +++ b/components/freertos/include/freertos/task.h @@ -985,7 +985,7 @@ void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ) PRIVILEGE * * @param uxNewPriority The priority to which the task will be set. */ -void vTaskPrioritySetCurrent( TaskHandle_t xTask, UBaseType_t uxNewPriority ) +void vTaskPrioritySetCurrent( TaskHandle_t xTask, UBaseType_t uxNewPriority ); /** * Suspend a task.