diff --git a/hardware/arduino/sam/system/CMSIS/Device/ATMEL/sam3xa/source/gcc/startup_sam3xa.c b/hardware/arduino/sam/system/CMSIS/Device/ATMEL/sam3xa/source/gcc/startup_sam3xa.c index 55e9e8b50..224edaef3 100644 --- a/hardware/arduino/sam/system/CMSIS/Device/ATMEL/sam3xa/source/gcc/startup_sam3xa.c +++ b/hardware/arduino/sam/system/CMSIS/Device/ATMEL/sam3xa/source/gcc/startup_sam3xa.c @@ -44,7 +44,8 @@ extern uint32_t _estack; int main(void); /** \endcond */ -void __libc_init_array(void); +// Arduino: we must setup hardware before doing this +// void __libc_init_array(void); /* Default empty handler */ void Dummy_Handler(void); @@ -272,7 +273,9 @@ void Reset_Handler(void) } /* Initialize the C library */ - __libc_init_array(); + + // Arduino: we must setup hardware before doing this + //__libc_init_array(); /* Branch to main function */ main(); diff --git a/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a b/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a index a8f27438f..822990651 100644 Binary files a/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a and b/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a differ diff --git a/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a.txt b/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a.txt index 6ded8fa2f..1854c378a 100644 --- a/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a.txt +++ b/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a.txt @@ -288,7 +288,6 @@ startup_sam3xa.o: 00000000 W USART3_Handler 00000000 W UsageFault_Handler 00000000 W WDT_Handler - U __libc_init_array U _erelocate U _estack U _etext diff --git a/hardware/arduino/sam/variants/arduino_due_x/variant.cpp b/hardware/arduino/sam/variants/arduino_due_x/variant.cpp index 2f40e24e1..1719aca3e 100644 --- a/hardware/arduino/sam/variants/arduino_due_x/variant.cpp +++ b/hardware/arduino/sam/variants/arduino_due_x/variant.cpp @@ -338,7 +338,9 @@ void USART3_Handler( void ) extern "C" { #endif -extern void init( void ) +void __libc_init_array(void); + +void init( void ) { SystemInit() ; @@ -352,6 +354,9 @@ extern void init( void ) // Disable watchdog, common to all SAM variants WDT_Disable( WDT ) ; + // Initialize C library + __libc_init_array(); + // Initialize Serial port UART, common to all SAM3 variants PIO_Configure( g_APinDescription[PINS_UART].pPort,