Skip to content

Commit d994e48

Browse files
committed
Delayed static object construction after hardware setup
1 parent 8cefac5 commit d994e48

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

hardware/arduino/sam/system/CMSIS/Device/ATMEL/sam3xa/source/gcc/startup_sam3xa.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ extern uint32_t _estack;
4444
int main(void);
4545
/** \endcond */
4646

47-
void __libc_init_array(void);
47+
// Arduino: we must setup hardware before doing this
48+
// void __libc_init_array(void);
4849

4950
/* Default empty handler */
5051
void Dummy_Handler(void);
@@ -272,7 +273,9 @@ void Reset_Handler(void)
272273
}
273274

274275
/* Initialize the C library */
275-
__libc_init_array();
276+
277+
// Arduino: we must setup hardware before doing this
278+
//__libc_init_array();
276279

277280
/* Branch to main function */
278281
main();
Binary file not shown.

hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ startup_sam3xa.o:
288288
00000000 W USART3_Handler
289289
00000000 W UsageFault_Handler
290290
00000000 W WDT_Handler
291-
U __libc_init_array
292291
U _erelocate
293292
U _estack
294293
U _etext

hardware/arduino/sam/variants/arduino_due_x/variant.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,9 @@ void USART3_Handler( void )
338338
extern "C" {
339339
#endif
340340

341-
extern void init( void )
341+
void __libc_init_array(void);
342+
343+
void init( void )
342344
{
343345
SystemInit() ;
344346

@@ -352,6 +354,9 @@ extern void init( void )
352354
// Disable watchdog, common to all SAM variants
353355
WDT_Disable( WDT ) ;
354356

357+
// Initialize C library
358+
__libc_init_array();
359+
355360
// Initialize Serial port UART, common to all SAM3 variants
356361
PIO_Configure(
357362
g_APinDescription[PINS_UART].pPort,

0 commit comments

Comments
 (0)