[M2351] Remove mbed_sdk_init_forced

1. mbed_sdk_init is called before C++ global obj constructor in OS 5
2. Refine startup file with GCC_ARM toolchain related to this modification.
pull/7302/head
cyliangtw 2017-07-12 10:19:38 +08:00 committed by ccli8
parent 06910bdea5
commit 368f8eef93
2 changed files with 7 additions and 31 deletions

View File

@ -16,13 +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)
{
@ -71,8 +64,3 @@ void mbed_sdk_init(void)
/* Lock protected registers */
SYS_LockReg();
}
void mbed_sdk_init_forced(void)
{
mbed_sdk_init();
}

View File

@ -62,12 +62,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 */
@ -370,19 +369,8 @@ void Reset_Handler(void)
}
}
//uvisor_init();
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();
}
_start();
#endif
/* Infinite loop */