1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

Delayed static object construction after hardware setup

This commit is contained in:
Cristian Maglie
2012-09-19 16:23:39 +02:00
parent 8cefac5d3b
commit d994e48c55
4 changed files with 11 additions and 4 deletions

View File

@ -44,7 +44,8 @@ extern uint32_t _estack;
int main(void); int main(void);
/** \endcond */ /** \endcond */
void __libc_init_array(void); // Arduino: we must setup hardware before doing this
// void __libc_init_array(void);
/* Default empty handler */ /* Default empty handler */
void Dummy_Handler(void); void Dummy_Handler(void);
@ -272,7 +273,9 @@ void Reset_Handler(void)
} }
/* Initialize the C library */ /* Initialize the C library */
__libc_init_array();
// Arduino: we must setup hardware before doing this
//__libc_init_array();
/* Branch to main function */ /* Branch to main function */
main(); main();

View File

@ -288,7 +288,6 @@ startup_sam3xa.o:
00000000 W USART3_Handler 00000000 W USART3_Handler
00000000 W UsageFault_Handler 00000000 W UsageFault_Handler
00000000 W WDT_Handler 00000000 W WDT_Handler
U __libc_init_array
U _erelocate U _erelocate
U _estack U _estack
U _etext U _etext

View File

@ -338,7 +338,9 @@ void USART3_Handler( void )
extern "C" { extern "C" {
#endif #endif
extern void init( void ) void __libc_init_array(void);
void init( void )
{ {
SystemInit() ; SystemInit() ;
@ -352,6 +354,9 @@ extern void init( void )
// Disable watchdog, common to all SAM variants // Disable watchdog, common to all SAM variants
WDT_Disable( WDT ) ; WDT_Disable( WDT ) ;
// Initialize C library
__libc_init_array();
// Initialize Serial port UART, common to all SAM3 variants // Initialize Serial port UART, common to all SAM3 variants
PIO_Configure( PIO_Configure(
g_APinDescription[PINS_UART].pPort, g_APinDescription[PINS_UART].pPort,