From 14ea6d7fd867557be3f801b5bb2d2e6e2721b3e7 Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Sat, 20 Dec 2025 10:10:14 +0100 Subject: [PATCH] esp8266/modesp: Allocate executable memory when needed. This commit lets the ESP8266 port use the new MICROPY_PERSISTENT_CODE_LOAD_NATIVE configuration entry. The ESP8266 port needs a special procedure to allocate memory used to hold executable native code. This functionality was gated behind the presence of a native emitter and thus its inclusion condition had to be updated. Signed-off-by: Alessandro Gatti --- ports/esp8266/modesp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/esp8266/modesp.c b/ports/esp8266/modesp.c index 724545202d..4b62175509 100644 --- a/ports/esp8266/modesp.c +++ b/ports/esp8266/modesp.c @@ -234,7 +234,7 @@ static mp_obj_t esp_esf_free_bufs(mp_obj_t idx_in) { } static MP_DEFINE_CONST_FUN_OBJ_1(esp_esf_free_bufs_obj, esp_esf_free_bufs); -#if MICROPY_EMIT_XTENSA || MICROPY_EMIT_INLINE_XTENSA +#if MICROPY_EMIT_XTENSA || MICROPY_EMIT_INLINE_XTENSA || MICROPY_PERSISTENT_CODE_LOAD_NATIVE // We provide here a way of committing executable data to a region from // which it can be executed by the CPU. There are 2 such writable regions: @@ -358,7 +358,7 @@ static const mp_rom_map_elem_t esp_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_malloc), MP_ROM_PTR(&esp_malloc_obj) }, { MP_ROM_QSTR(MP_QSTR_free), MP_ROM_PTR(&esp_free_obj) }, { MP_ROM_QSTR(MP_QSTR_esf_free_bufs), MP_ROM_PTR(&esp_esf_free_bufs_obj) }, - #if MICROPY_EMIT_XTENSA || MICROPY_EMIT_INLINE_XTENSA + #if MICROPY_EMIT_XTENSA || MICROPY_EMIT_INLINE_XTENSA || MICROPY_PERSISTENT_CODE_LOAD_NATIVE { MP_ROM_QSTR(MP_QSTR_set_native_code_location), MP_ROM_PTR(&esp_set_native_code_location_obj) }, #endif