Skip to content

[rtos] Fixed registers clobbered SVC_Handler in IAR #1905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rtos/rtx/TARGET_CORTEX_M/rt_CMSIS.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ static inline t __##f (t1 a1, t2 a2, t3 a3, t4 a4) { \
#define SVC_Setup(f) \
__asm( \
"mov r12,%0\n" \
:: "r"(&f): "r12" \
:: "r"(&f): "r0", "r1", "r2", "r3", "r12" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to add "memory" to the clobber list as well. This will force all global variables to be written out before the call.

Copy link
Contributor Author

@geky geky Jun 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is emitting an IAR specific __swi function declaration and call for each svc, so the compiler should be able to handle the memory ordering appropriately. The issue is that the functions are emitted with fewer arguments than are clobbered in the svc handler.

_Pragma("swi_number=0") __swi t _##f (t1 a1);

rt_CMSIS.c#L323

);

#define SVC_Ret3() \
Expand Down