summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2025-12-01 10:44:51 +1100
committerDamien George <damien@micropython.org>2025-12-01 13:10:08 +1100
commitff7f7449d2c40a3aa1e16abf7fc337d1ee43d712 (patch)
tree7968fd1b6f5c1b0f8a418e3936cd0ceb435812bd
parenteb5d89cd8324407eda67066292d4cabbc4ce4cd4 (diff)
py/emitglue: Add hook for RV32 arch to flush D-cache for native emitter.
Eventually this cache flushing mechanism should be generalised to work the same way for all architectures. But for now, this allows ESP32 RV32 SoCs to flush the D-cache whenn needed. Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r--py/emitglue.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/emitglue.c b/py/emitglue.c
index 27cbb349e..8a32b227f 100644
--- a/py/emitglue.c
+++ b/py/emitglue.c
@@ -32,6 +32,7 @@
#include <assert.h>
#include "py/emitglue.h"
+#include "py/mphal.h"
#include "py/runtime0.h"
#include "py/bc.h"
#include "py/objfun.h"
@@ -126,6 +127,9 @@ void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, cons
"mcr p15, 0, r0, c7, c7, 0\n" // invalidate I-cache and D-cache
: : : "r0", "cc");
#endif
+ #elif (MICROPY_EMIT_RV32 || MICROPY_EMIT_INLINE_RV32) && defined(MP_HAL_CLEAN_DCACHE)
+ // Flush the D-cache.
+ MP_HAL_CLEAN_DCACHE(fun_data, fun_len);
#endif
rc->kind = kind;