We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 61552db commit 3960e2dCopy full SHA for 3960e2d
libraries/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h
@@ -560,15 +560,18 @@ __attribute__((naked)) void pre_main (void) {
560
".syntax unified\n"
561
".thumb\n"
562
/* Save link register (keep 8 byte alignment with dummy r4) */
563
- "push {r4, lr}\n"
+ "push {r4, r5}\n"
564
+ "mov r4, lr\n"
565
"ldr r0,= __libc_fini_array\n"
566
"bl atexit\n"
567
"bl __libc_init_array\n"
568
/* Restore link register and branch so when main returns it
569
* goes to the thread destroy function.
570
*/
- "pop {r4, lr}\n"
571
- "b main\n"
+ "mov lr, r4\n"
572
+ "pop {r4, r5}\n"
573
+ "ldr r0,=main\n"
574
+ "bx r0\n"
575
);
576
}
577
0 commit comments