diff --git a/cores/arduino/cortex_handlers.c b/cores/arduino/cortex_handlers.c index 4192690d3..6c45c6395 100644 --- a/cores/arduino/cortex_handlers.c +++ b/cores/arduino/cortex_handlers.c @@ -134,7 +134,6 @@ __attribute__ ((section(".isr_vector"))) const DeviceVectors exception_table = }; extern int main(void); -extern void __libc_init_array(void); /* This is called on processor reset to initialize the device and call main() */ void Reset_Handler(void) @@ -156,9 +155,6 @@ void Reset_Handler(void) *pDest = 0; } - /* Initialize the C library */ - __libc_init_array(); - SystemInit(); main(); diff --git a/cores/arduino/main.cpp b/cores/arduino/main.cpp index 8af01b573..49ebc27f5 100644 --- a/cores/arduino/main.cpp +++ b/cores/arduino/main.cpp @@ -24,6 +24,9 @@ void initVariant() __attribute__((weak)); void initVariant() { } +// Initialize C library +extern "C" void __libc_init_array(void); + /* * \brief Main entry point of Arduino application */ @@ -31,6 +34,8 @@ int main( void ) { init(); + __libc_init_array(); + initVariant(); delay(1);