The default SVC handler: vPortSVCHandler is making an exception due to lr error on the CM3/4 with armgcc.
The implementation of the vPortSVCHandler() is simplely adding a function in the main.c:
When entering the SVC mode, beginning address of SVC_Handler(), the lr value is correct: 0xfffffff9. But when stepping in, after entering vPortSVCHandler, the lr will changed to the SVC_Handler() ! It is supposed to 0xffffff9 as the default SVC handler code:
" orr r14, #0xd \n"
" bx r14 \n"
So is this a compiler issue or code issue? If we add a “mov r14, #0xfffffff9 \n” before the “orr r14, #0xd \n”, the code will working. But the same code works on the IAR EWARM and codesourcery.
The armgcc version is arm-none-eabi-gcc.exe (crosstool-NG 1.13.1 - Atmel build: 13) 4.6.1