diff options
-rw-r--r-- | ports/esp32/boards/sdkconfig.base | 6 | ||||
-rw-r--r-- | ports/esp32/mpconfigport.h | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/ports/esp32/boards/sdkconfig.base b/ports/esp32/boards/sdkconfig.base index 84a423fa0a..c7d326c89e 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 1c5789d0bd..e36d12bc05 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 |