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 <a.gatti@frob.it>
This commit is contained in:
Alessandro Gatti
2025-12-20 10:10:14 +01:00
parent ecf8873293
commit 14ea6d7fd8

View File

@@ -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