Skip to content

Commit ff7f744

Browse files
committed
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 <[email protected]>
1 parent eb5d89c commit ff7f744

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

py/emitglue.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <assert.h>
3333

3434
#include "py/emitglue.h"
35+
#include "py/mphal.h"
3536
#include "py/runtime0.h"
3637
#include "py/bc.h"
3738
#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
126127
"mcr p15, 0, r0, c7, c7, 0\n" // invalidate I-cache and D-cache
127128
: : : "r0", "cc");
128129
#endif
130+
#elif (MICROPY_EMIT_RV32 || MICROPY_EMIT_INLINE_RV32) && defined(MP_HAL_CLEAN_DCACHE)
131+
// Flush the D-cache.
132+
MP_HAL_CLEAN_DCACHE(fun_data, fun_len);
129133
#endif
130134

131135
rc->kind = kind;

0 commit comments

Comments
 (0)