File tree 1 file changed +9
-0
lines changed 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,15 @@ rt_hw_interrupt_enable:
49
49
rt_hw_context_switch_to:
50
50
la t0, __rt_rvstack
51
51
#ifdef SOC_RISCV_FAMILY_CH32
52
+ /*
53
+ * if it is an assembly entry code, the SP offset value is determined by the assembly code,
54
+ * but the C code is determined by the compiler, so we subtract 512 here as a reservation.
55
+ * When entering the interrupt function of C code, the compiler automatically presses the stack
56
+ * into the task stack. We can only change the SP value used by the calling function after switching
57
+ * the interrupt stack.This problem can be solved by modifying the interrupt to the assembly entry,
58
+ * and there is no need to reserve 512 bytes. You only need to switch the interrupt stack at the
59
+ * beginning of the interrupt function
60
+ */
52
61
addi t0, t0, -512 // for ch32
53
62
#endif /* SOC_RISCV_FAMILY_CH32 */
54
63
csrw mscratch,t0
You can’t perform that action at this time.
0 commit comments