mirror of https://github.com/ARMmbed/mbed-os.git
[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
parent
06910bdea5
commit
368f8eef93
|
@ -16,13 +16,6 @@
|
||||||
|
|
||||||
#include "cmsis.h"
|
#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)
|
void mbed_sdk_init(void)
|
||||||
{
|
{
|
||||||
|
@ -71,8 +64,3 @@ void mbed_sdk_init(void)
|
||||||
/* Lock protected registers */
|
/* Lock protected registers */
|
||||||
SYS_LockReg();
|
SYS_LockReg();
|
||||||
}
|
}
|
||||||
|
|
||||||
void mbed_sdk_init_forced(void)
|
|
||||||
{
|
|
||||||
mbed_sdk_init();
|
|
||||||
}
|
|
||||||
|
|
|
@ -62,12 +62,11 @@ extern uint32_t __bss_start__;
|
||||||
extern uint32_t __bss_end__;
|
extern uint32_t __bss_end__;
|
||||||
|
|
||||||
extern void uvisor_init(void);
|
extern void uvisor_init(void);
|
||||||
//#if defined(TOOLCHAIN_GCC_ARM)
|
#if defined(TOOLCHAIN_GCC_ARM)
|
||||||
//extern void _start(void);
|
extern void _start(void);
|
||||||
//#endif
|
#else
|
||||||
extern void software_init_hook(void) __attribute__((weak));
|
#error("For GCC toolchain, only support GNU ARM Embedded")
|
||||||
extern void __libc_init_array(void);
|
#endif
|
||||||
extern int main(void);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Default empty handler */
|
/* Default empty handler */
|
||||||
|
@ -370,19 +369,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
|
#endif
|
||||||
|
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
|
|
Loading…
Reference in New Issue