Pārlūkot izejas kodu

esp32c3: Do not enable memory protection under debugger

Alexey Gerenkov 4 gadi atpakaļ
vecāks
revīzija
792461aa99
1 mainītis faili ar 7 papildinājumiem un 0 dzēšanām
  1. 7 0
      components/esp32c3/memprot.c

+ 7 - 0
components/esp32c3/memprot.c

@@ -28,6 +28,8 @@
 #include "esp32c3/rom/ets_sys.h"
 #include "esp_log.h"
 
+#include "soc/cpu.h"
+
 extern int _iram_text_end;
 static const char *TAG = "memprot";
 
@@ -532,6 +534,11 @@ void esp_memprot_set_prot_int(bool invoke_panic_handler, bool lock_feature, void
         esp_memprot_set_monitor_en(MEMPROT_DRAM0_SRAM, false);
     }
 
+    // do not enable if being debugged
+    if (esp_cpu_in_ocd_debug_mode()) {
+        return;
+    }
+
     //panic handling
     if (invoke_panic_handler) {
         if (use_iram0) {