esp32c3: Do not enable memory protection under debugger
#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) {
