8000 esp32: Enable native emitter. · jimmo/micropython@917f027 · GitHub
[go: up one dir, main page]

Skip to content

Commit 917f027

Browse files
committed
esp32: Enable native emitter.
1 parent 9adedce commit 917f027

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

ports/esp32/main.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,13 @@ void nlr_jump_fail(void *val) {
172172
void mbedtls_debug_set_threshold(int threshold) {
173173
(void)threshold;
174174
}
175+
176+
void *esp_native_code_commit(void *buf, size_t len) {
177+
len = (len + 3) & ~3;
178+
uint32_t *p = heap_caps_malloc(len, MALLOC_CAP_EXEC);
179+
if (p == NULL) {
180+
m_malloc_fail(len);
181+
}
182+
memcpy(p, buf, len);
183+
return p;
184+
}

ports/esp32/mpconfigport.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
// emitters
2222
#define MICROPY_PERSISTENT_CODE_LOAD (1)
23+
#define MICROPY_EMIT_XTENSAWIN (1)
24+
void *esp_native_code_commit(void*, size_t);
25+
#define MP_PLAT_COMMIT_EXEC(buf, len) esp_native_code_commit(buf, len)
2326

2427
// compiler configuration
2528
#define MICROPY_COMP_MODULE_CONST (1)

0 commit comments

Comments
 (0)
0