summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/esp32/main.c10
-rw-r--r--ports/esp32/mpconfigport.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/ports/esp32/main.c b/ports/esp32/main.c
index 7106e0bf5..b0d1b1537 100644
--- a/ports/esp32/main.c
+++ b/ports/esp32/main.c
@@ -172,3 +172,13 @@ void nlr_jump_fail(void *val) {
void mbedtls_debug_set_threshold(int threshold) {
(void)threshold;
}
+
+void *esp_native_code_commit(void *buf, size_t len) {
+ len = (len + 3) & ~3;
+ uint32_t *p = heap_caps_malloc(len, MALLOC_CAP_EXEC);
+ if (p == NULL) {
+ m_malloc_fail(len);
+ }
+ memcpy(p, buf, len);
+ return p;
+}
diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h
index 1c0d8700f..63657741c 100644
--- a/ports/esp32/mpconfigport.h
+++ b/ports/esp32/mpconfigport.h
@@ -20,6 +20,9 @@
// emitters
#define MICROPY_PERSISTENT_CODE_LOAD (1)
+#define MICROPY_EMIT_XTENSAWIN (1)
+void *esp_native_code_commit(void*, size_t);
+#define MP_PLAT_COMMIT_EXEC(buf, len) esp_native_code_commit(buf, len)
// compiler configuration
#define MICROPY_COMP_MODULE_CONST (1)