diff --git a/components/esp32/dport_access.c b/components/esp32/dport_access.c index af6c92e1a..6abc51dbd 100644 --- a/components/esp32/dport_access.c +++ b/components/esp32/dport_access.c @@ -194,6 +194,15 @@ void IRAM_ATTR esp_dport_access_int_pause(void) portEXIT_CRITICAL_ISR(&g_dport_mux); } +//Used in panic code: the enter_critical stuff may be messed up so we just stop everything without checking the mux. +void IRAM_ATTR esp_dport_access_int_abort(void) +{ + dport_core_state[0] = DPORT_CORE_STATE_IDLE; +#ifndef CONFIG_FREERTOS_UNICORE + dport_core_state[1] = DPORT_CORE_STATE_IDLE; +#endif +} + void IRAM_ATTR esp_dport_access_int_resume(void) { portENTER_CRITICAL_ISR(&g_dport_mux); diff --git a/components/esp32/include/esp_dport_access.h b/components/esp32/include/esp_dport_access.h index 49e15f697..3acf80688 100644 --- a/components/esp32/include/esp_dport_access.h +++ b/components/esp32/include/esp_dport_access.h @@ -27,6 +27,10 @@ void esp_dport_access_int_init(void); void esp_dport_access_int_pause(void); void esp_dport_access_int_resume(void); +//This routine does not stop the dport routines in any way that is recoverable. Please +//only call in case of panic(). +void esp_dport_access_int_abort(void); + #if defined(BOOTLOADER_BUILD) || defined(CONFIG_FREERTOS_UNICORE) || !defined(ESP_PLATFORM) #define DPORT_STALL_OTHER_CPU_START() #define DPORT_STALL_OTHER_CPU_END() diff --git a/components/esp32/panic.c b/components/esp32/panic.c index 940c3f8b4..906e1ee36 100644 --- a/components/esp32/panic.c +++ b/components/esp32/panic.c @@ -211,7 +211,7 @@ void panicHandler(XtExcFrame *frame) return; } haltOtherCore(); - esp_dport_access_int_pause(); + esp_dport_access_int_abort(); panicPutStr("Guru Meditation Error: Core "); panicPutDec(core_id); panicPutStr(" panic'ed ("); @@ -264,7 +264,7 @@ void panicHandler(XtExcFrame *frame) void xt_unhandled_exception(XtExcFrame *frame) { haltOtherCore(); - esp_dport_access_int_pause(); + esp_dport_access_int_abort(); if (!abort_called) { panicPutStr("Guru Meditation Error of type "); int exccause = frame->exccause;