ARMCC ulib - initalize RTOS before the standard library C++ init

Initialize the RTOS before initializing the standard library.  This
allows C++ constructors to be called in a well defined thread context.
Martin Kojtal 2016-04-28 13:48:22 -05:00 committed by Russ Butler
parent 02ba7ea857
commit e01bcdc95a
1 changed files with 17 additions and 0 deletions

View File

@ -433,7 +433,11 @@ void set_main_stack(void) {
#if defined (__CC_ARM)
#ifdef __MICROLIB
int main(void);
void _main_init (void) __attribute__((section(".ARM.Collect$$$$000000FF")));
void $Super$$__cpp_initialize__aeabi_(void);
void _main_init (void) {
osKernelInitialize();
#ifdef __MBED_CMSIS_RTOS_CM
@ -443,6 +447,19 @@ void _main_init (void) {
osKernelStart();
for (;;);
}
void $Sub$$__cpp_initialize__aeabi_(void)
{
// this should invoke C++ initializers prior _main_init, we keep this empty and
// invoke them after _main_init (=starts RTX kernel)
}
void pre_main()
{
$Super$$__cpp_initialize__aeabi_();
main();
}
#else
void * armcc_heap_base;