Update ARMCC pre_main to be in C

Switch pre_main from assembly to C for ARMCC.  This function does not
need to be in assembly.
pull/2158/head
Russ Butler 2016-07-12 17:34:29 -05:00
parent 38ae4f9289
commit d4627176da
2 changed files with 12 additions and 36 deletions

View File

@ -33,6 +33,7 @@
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
#if defined (__CC_ARM) #if defined (__CC_ARM)
#include <rt_misc.h>
#pragma O3 #pragma O3
#define __USED __attribute__((used)) #define __USED __attribute__((used))
#elif defined (__GNUC__) #elif defined (__GNUC__)
@ -442,25 +443,12 @@ void pre_main()
void * armcc_heap_base; void * armcc_heap_base;
void * armcc_heap_top; void * armcc_heap_top;
__asm void pre_main (void) int main(void);
{
IMPORT __rt_lib_init
IMPORT main
IMPORT armcc_heap_base
IMPORT armcc_heap_top
LDR R0,=armcc_heap_base void pre_main (void)
LDR R1,=armcc_heap_top {
LDR R0,[R0] __rt_lib_init((unsigned)armcc_heap_base, (unsigned)armcc_heap_top);
LDR R1,[R1] main();
/* Save link register (keep 8 byte alignment with dummy R4) */
PUSH {R4, LR}
BL __rt_lib_init
BL main
/* Return to the thread destroy function.
*/
POP {R4, PC}
ALIGN
} }
__asm void __rt_entry (void) { __asm void __rt_entry (void) {

View File

@ -34,6 +34,7 @@
#include "mbed_error.h" #include "mbed_error.h"
#if defined (__CC_ARM) #if defined (__CC_ARM)
#include <rt_misc.h>
#pragma O3 #pragma O3
#define __USED __attribute__((used)) #define __USED __attribute__((used))
#elif defined (__GNUC__) #elif defined (__GNUC__)
@ -593,25 +594,12 @@ void pre_main()
void * armcc_heap_base; void * armcc_heap_base;
void * armcc_heap_top; void * armcc_heap_top;
__asm void pre_main (void) int main(void);
{
IMPORT __rt_lib_init
IMPORT main
IMPORT armcc_heap_base
IMPORT armcc_heap_top
LDR R0,=armcc_heap_base void pre_main (void)
LDR R1,=armcc_heap_top {
LDR R0,[R0] __rt_lib_init((unsigned)armcc_heap_base, (unsigned)armcc_heap_top);
LDR R1,[R1] main();
/* Save link register (keep 8 byte alignment with dummy R4) */
PUSH {R4, LR}
BL __rt_lib_init
BL main
/* Return to the thread destroy function.
*/
POP {R4, PC}
ALIGN
} }
/* The single memory model is checking for stack collision at run time, verifing /* The single memory model is checking for stack collision at run time, verifing