diff --git a/py/asmbase.h b/py/asmbase.h
index bfc8ac7ff230b9d7443bed43138dfb310313ac10..06fdd4b909a2e3808092e1ca56b30f26eb08bb76 100644
--- a/py/asmbase.h
+++ b/py/asmbase.h
@@ -62,7 +62,11 @@ static inline size_t mp_asm_base_get_code_size(mp_asm_base_t *as) {
 }
 
 static inline void *mp_asm_base_get_code(mp_asm_base_t *as) {
+    #if defined(MP_PLAT_COMMIT_EXEC)
+    return MP_PLAT_COMMIT_EXEC(as->code_base, as->code_size);
+    #else
     return as->code_base;
+    #endif
 }
 
 #endif // MICROPY_INCLUDED_PY_ASMBASE_H