Skip to content

Commit 70ebb6f

Browse files
committed
[rtos] Fixed registers clobbered SVC_Handler in IAR
The rtx SVC_Handler for IAR clobbers r0-r3 despite the number of arguments. However, in the SVC calls, the __swi function is declared with fewer arguments. IAR doesn't understand that the other registers are clobbered and stores variables in r0-r3 when multiple SVCs are dispatched in a single function. This bug was noticed in osThreadExit, which hard-faults on IAR, preventing any threads from exiting.
1 parent 52e93ae commit 70ebb6f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rtos/rtx/TARGET_CORTEX_M/rt_CMSIS.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ static inline t __##f (t1 a1, t2 a2, t3 a3, t4 a4) { \
302302
#define SVC_Setup(f) \
303303
__asm( \
304304
"mov r12,%0\n" \
305-
:: "r"(&f): "r12" \
305+
:: "r"(&f): "r0", "r1", "r2", "r3", "r12" \
306306
);
307307

308308
#define SVC_Ret3() \

0 commit comments

Comments
 (0)