]> granicus.if.org Git - esp-idf/commitdiff
Merge branch 'bugfix/panic_dport_no_mutex' into 'master'
authorJeroen Domburg <jeroen@espressif.com>
Thu, 14 Sep 2017 10:07:06 +0000 (18:07 +0800)
committerJeroen Domburg <jeroen@espressif.com>
Thu, 14 Sep 2017 10:07:06 +0000 (18:07 +0800)
Panic: stop dport access handler without trying to use a lock

See merge request !1244

components/esp32/dport_access.c
components/esp32/include/esp_dport_access.h
components/esp32/panic.c

index af6c92e1abc59f8b2db4734d8fe84f6b482cfdde..6abc51dbdef3fa4cf615ef12be872b4599f61f18 100644 (file)
@@ -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);
index 49e15f69721f45a3363418a2e6ddfeaf8e6947d0..3acf806888be94530779c44335186e9b51b9b4b6 100644 (file)
@@ -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()
index 940c3f8b485bd0283f5a376bced57ba0257e4445..906e1ee3657a92a96be0796435bf1e5eeb84c668 100644 (file)
@@ -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;