From f6e1a12b3460a5a2efd1da3d97581342e2b7e7d2 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 19 Dec 2019 23:24:28 +0100 Subject: [PATCH] esp32: panic: do digital reset if cache error interrupt is set Even if frame->exccause != PANIC_RSN_CACHEERR, it is possible that the cache error interrupt status is set. For example, this may happen due to an invalid cache access in the panic handler itself. Check cache error interrupt status instead of frame->exccause to decide whether to do CPU reset or digital reset. Also remove unnecessary esp_dport_access_int_pause from esp_cache_err_get_cpuid, since the panic handler already calls esp_dport_access_int_abort on entry. --- components/esp32/cache_err_int.c | 1 - components/esp32/panic.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/components/esp32/cache_err_int.c b/components/esp32/cache_err_int.c index a6de81ce65..c2a43929ef 100644 --- a/components/esp32/cache_err_int.c +++ b/components/esp32/cache_err_int.c @@ -73,7 +73,6 @@ void esp_cache_err_int_init() int IRAM_ATTR esp_cache_err_get_cpuid() { - esp_dport_access_int_pause(); const uint32_t pro_mask = DPORT_PRO_CPU_DISABLED_CACHE_IA_DRAM1 | DPORT_PRO_CPU_DISABLED_CACHE_IA_DROM0 | diff --git a/components/esp32/panic.c b/components/esp32/panic.c index 64383f5624..15455c42dc 100644 --- a/components/esp32/panic.c +++ b/components/esp32/panic.c @@ -623,7 +623,7 @@ static __attribute__((noreturn)) void commonErrorHandler(XtExcFrame *frame) rtc_wdt_disable(); #if CONFIG_ESP32_PANIC_PRINT_REBOOT || CONFIG_ESP32_PANIC_SILENT_REBOOT panicPutStr("Rebooting...\r\n"); - if (frame->exccause != PANIC_RSN_CACHEERR) { + if (esp_cache_err_get_cpuid() == -1) { esp_restart_noos(); } else { // The only way to clear invalid cache access interrupt is to reset the digital part