Fix start_new_application compile error on Cortex-M23

With "mov r2, #0", compile OK with GCC_ARM, but failed with ARMC6.
With "ldr r2, =0", compile OK with ARMC6, but failed with GCC_ARM.
Finally, with "movw r2, #0"/"movt r2, #0", compile OK with both ARMC6 and GCC_ARM.
pull/6949/head
ccli8 2018-05-21 17:39:09 +08:00
parent b3f17a9e01
commit 646f61400a
1 changed files with 4 additions and 12 deletions

View File

@ -117,20 +117,13 @@ __asm static void start_new_application(void *sp, void *pc)
void start_new_application(void *sp, void *pc)
{
__asm volatile (
#if defined(__CORTEX_M23)
__asm volatile (
"ldr r2, =0 \n"
"msr control, r2 \n" // Switch to main stack
"mov sp, %0 \n"
"msr primask, r2 \n" // Enable interrupts
"bx %1 \n"
:
: "l" (sp), "l" (pc)
: "r2", "cc", "memory"
);
"movw r2, #0 \n"
"movt r2, #0 \n"
#else
__asm volatile (
"mov r2, #0 \n"
#endif
"msr control, r2 \n" // Switch to main stack
"mov sp, %0 \n"
"msr primask, r2 \n" // Enable interrupts
@ -139,7 +132,6 @@ void start_new_application(void *sp, void *pc)
: "l" (sp), "l" (pc)
: "r2", "cc", "memory"
);
#endif
}
#else