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>
This commit is contained in:
Damien George
2025-12-01 10:44:51 +11:00
parent eb5d89cd83
commit ff7f7449d2

View File

@@ -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;