mbed library sources. Supersedes mbed-src.
Fork of mbed by
Diff: targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_GCC_CR/startup_lpc407x_8x.cpp
- Revision:
- 147:30b64687e01f
- Parent:
- 144:ef7eb2e8f9f7
diff -r 11f9a9a04805 -r 30b64687e01f targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_GCC_CR/startup_lpc407x_8x.cpp --- a/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_GCC_CR/startup_lpc407x_8x.cpp Thu Sep 08 15:05:30 2016 +0100 +++ b/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_GCC_CR/startup_lpc407x_8x.cpp Fri Sep 16 16:24:25 2016 +0100 @@ -260,7 +260,8 @@ // library. //***************************************************************************** -extern "C" void software_init_hook(void) __attribute__((weak)); +extern "C" void software_init_hook(void); +extern "C" void pre_main(void) __attribute__((weak)); __attribute__ ((section(".after_vectors"))) void @@ -319,26 +320,15 @@ *pSCB_VTOR = (unsigned int)g_pfnVectors; } -//#ifdef __USE_CMSIS - SystemInit(); -//#endif - if (software_init_hook) // give control to the RTOS - software_init_hook(); // this will also call __libc_init_array - else { -#if defined (__cplusplus) - // - // Call C++ library initialisation - // - __libc_init_array(); + SystemInit(); + if (pre_main) { // give control to the RTOS + software_init_hook(); // this will also call __libc_init_array + } + else { // for BareMetal (non-RTOS) build + __libc_init_array(); + main(); #endif - -#if defined (__REDLIB__) - // Call the Redlib library, which in turn calls main() - __main() ; -#else - main(); -#endif - } + } // // main() shouldn't return, but if it does, we'll just enter an infinite loop //