Skip to content

Commit 55dc482

Browse files
pi-anldpgeorge
authored andcommitted
esp32/sdkconfig: Disable PMP_IDRAM_SPLIT to fix native emit support.
Signed-off-by: Andrew Leech <[email protected]>
1 parent ce397d8 commit 55dc482

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

ports/esp32/boards/sdkconfig.base

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,9 @@ CONFIG_ETH_SPI_ETHERNET_DM9051=y
127127
# formatting in ROM instead and should override this, check
128128
# ESP_ROM_HAS_NEWLIB_NANO_FORMAT.
129129
CONFIG_NEWLIB_NANO_FORMAT=y
130+
131+
# IRAM/DRAM split protection is a memory protection feature on some parts
132+
# that support SOC_CPU_IDRAM_SPLIT_USING_PMP, eg. C2, C5, C6, H2
133+
# Due to limitations in the PMP system this feature breaks native emitters
134+
# so is disabled by default.
135+
CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT=n

ports/esp32/mpconfigport.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@
4242
// emitters
4343
#define MICROPY_PERSISTENT_CODE_LOAD (1)
4444
#if CONFIG_IDF_TARGET_ARCH_RISCV
45+
#if CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT
46+
#define MICROPY_EMIT_RV32 (0)
47+
#else
4548
#define MICROPY_EMIT_RV32 (1)
49+
#endif
4650
#else
4751
#define MICROPY_EMIT_XTENSAWIN (1)
4852
#endif
@@ -263,8 +267,12 @@
263267
// type definitions for the specific machine
264268

265269
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p)))
270+
#if SOC_CPU_IDRAM_SPLIT_USING_PMP && !CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT
271+
// On targets with this configuration all RAM is executable so no need for a custom commit function.
272+
#else
266273
void *esp_native_code_commit(void *, size_t, void *);
267274
#define MP_PLAT_COMMIT_EXEC(buf, len, reloc) esp_native_code_commit(buf, len, reloc)
275+
#endif
268276
#define MP_SSIZE_MAX (0x7fffffff)
269277

270278
#if MICROPY_PY_SOCKET_EVENTS

0 commit comments

Comments
 (0)