[NANO130] Remove mbed_sdk_init_forced()

1. With mbed OS 5, mbed_sdk_init() is ensured to call before C++ global object constructor.
2. Refine startup file with GCC_ARM toolchain related to this modification.
pull/4631/head
MS30 CCChang12 2017-07-11 17:50:20 +08:00
parent 127a09cbde
commit 3bbacad6a7
2 changed files with 6 additions and 36 deletions

View File

@ -16,14 +16,6 @@
#include "cmsis.h"
// NOTE: Ensurce mbed_sdk_init() will get called before C++ global object constructor.
#if defined(__CC_ARM) || defined(__GNUC__)
void mbed_sdk_init_forced(void) __attribute__((constructor(101)));
#elif defined(__ICCARM__)
// TODO: How to achieve it in IAR?
#endif
void mbed_sdk_init(void)
{
// NOTE: Support singleton semantics to be called from other init functions
@ -70,8 +62,3 @@ void mbed_sdk_init(void)
/* Lock protected registers */
SYS_LockReg();
}
void mbed_sdk_init_forced(void)
{
mbed_sdk_init();
}

View File

@ -61,12 +61,11 @@ extern uint32_t __bss_start__;
extern uint32_t __bss_end__;
extern void uvisor_init(void);
//#if defined(TOOLCHAIN_GCC_ARM)
//extern void _start(void);
//#endif
extern void software_init_hook(void) __attribute__((weak));
extern void __libc_init_array(void);
extern int main(void);
#if defined(TOOLCHAIN_GCC_ARM)
extern void _start(void);
#else
#error("For GCC toolchain, only support GNU ARM Embedded")
#endif
#endif
/* Default empty handler */
@ -203,11 +202,6 @@ void Reset_Handler(void)
/* Enable register write-protection function */
SYS_LockReg();
/**
* Because EBI (external SRAM) init is done in SystemInit(), SystemInit() must be called at the very start.
*/
//SystemInit();
#if defined(__CC_ARM)
__main();
@ -235,19 +229,8 @@ void Reset_Handler(void)
}
}
//uvisor_init();
_start();
if (software_init_hook) {
/**
* Give control to the RTOS via software_init_hook() which will also call __libc_init_array().
* Assume software_init_hook() is defined in libraries/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h.
*/
software_init_hook();
}
else {
__libc_init_array();
main();
}
#endif
/* Infinite loop */