summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Leech <andrew.leech@planetinnovation.com.au>2024-10-08 17:19:34 +1100
committerDamien George <damien@micropython.org>2024-10-09 23:34:27 +1100
commit55dc482d3e439885bd38072bc602c3e0828f2406 (patch)
tree79cb2bcf0b426c401792db5bf1d81f1e48235836
parentce397d85af2dc94e7136ee96b35f7678d1a52f0d (diff)
esp32/sdkconfig: Disable PMP_IDRAM_SPLIT to fix native emit support.
Signed-off-by: Andrew Leech <andrew@alelec.net>
-rw-r--r--ports/esp32/boards/sdkconfig.base6
-rw-r--r--ports/esp32/mpconfigport.h8
2 files changed, 14 insertions, 0 deletions
diff --git a/ports/esp32/boards/sdkconfig.base b/ports/esp32/boards/sdkconfig.base
index 84a423fa0..c7d326c89 100644
--- a/ports/esp32/boards/sdkconfig.base
+++ b/ports/esp32/boards/sdkconfig.base
@@ -127,3 +127,9 @@ CONFIG_ETH_SPI_ETHERNET_DM9051=y
# formatting in ROM instead and should override this, check
# ESP_ROM_HAS_NEWLIB_NANO_FORMAT.
CONFIG_NEWLIB_NANO_FORMAT=y
+
+# IRAM/DRAM split protection is a memory protection feature on some parts
+# that support SOC_CPU_IDRAM_SPLIT_USING_PMP, eg. C2, C5, C6, H2
+# Due to limitations in the PMP system this feature breaks native emitters
+# so is disabled by default.
+CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT=n
diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h
index 1c5789d0b..e36d12bc0 100644
--- a/ports/esp32/mpconfigport.h
+++ b/ports/esp32/mpconfigport.h
@@ -42,7 +42,11 @@
// emitters
#define MICROPY_PERSISTENT_CODE_LOAD (1)
#if CONFIG_IDF_TARGET_ARCH_RISCV
+#if CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT
+#define MICROPY_EMIT_RV32 (0)
+#else
#define MICROPY_EMIT_RV32 (1)
+#endif
#else
#define MICROPY_EMIT_XTENSAWIN (1)
#endif
@@ -263,8 +267,12 @@
// type definitions for the specific machine
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p)))
+#if SOC_CPU_IDRAM_SPLIT_USING_PMP && !CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT
+// On targets with this configuration all RAM is executable so no need for a custom commit function.
+#else
void *esp_native_code_commit(void *, size_t, void *);
#define MP_PLAT_COMMIT_EXEC(buf, len, reloc) esp_native_code_commit(buf, len, reloc)
+#endif
#define MP_SSIZE_MAX (0x7fffffff)
#if MICROPY_PY_SOCKET_EVENTS