From 739b24212c0beb48c569d24eaed0a337b9794e46 Mon Sep 17 00:00:00 2001 From: eightycc Date: Sat, 10 May 2025 15:56:21 -0700 Subject: [PATCH 1/2] Fix crashing bug in PR #10325 for RISC-V builds. --- supervisor/shared/cpu_regs.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/supervisor/shared/cpu_regs.h b/supervisor/shared/cpu_regs.h index aff0b69ebab0..335201fe9423 100644 --- a/supervisor/shared/cpu_regs.h +++ b/supervisor/shared/cpu_regs.h @@ -20,6 +20,13 @@ #endif #endif +#ifdef __riscv +#define INTEGER_REGS 12 +#ifdef __riscv_vector +#define FLOATING_POINT_REGS 12 +#endif +#endif + #ifndef INTEGER_REGS #define INTEGER_REGS 0 #endif From 1cca6916c2a2b0ad92c34b2ed0eed3193a62cf71 Mon Sep 17 00:00:00 2001 From: eightycc Date: Sat, 10 May 2025 16:26:00 -0700 Subject: [PATCH 2/2] Revert PR #10301, obsoleted by PR #10325. --- shared/runtime/pyexec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shared/runtime/pyexec.c b/shared/runtime/pyexec.c index df2b60e207c9..54384528a59a 100644 --- a/shared/runtime/pyexec.c +++ b/shared/runtime/pyexec.c @@ -91,9 +91,8 @@ static int parse_compile_execute(const void *source, mp_parse_input_kind_t input nlr_buf_t nlr; nlr.ret_val = NULL; if (nlr_push(&nlr) == 0) { - // CIRCUITPY-CHANGE: Made volatile to prevent gcc from re-ordering store of function pointer into stack frame - // after call to gc_collect. For RISC-V this was causing free of the compiled function before execution. - volatile mp_obj_t module_fun = mp_const_none; + // CIRCUITPY-CHANGE + mp_obj_t module_fun = mp_const_none; // CIRCUITPY-CHANGE #if CIRCUITPY_ATEXIT if (!(exec_flags & EXEC_FLAG_SOURCE_IS_ATEXIT))