From dccc57433d2bb6b8e33502e5380ca9a974869d87 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 21 Apr 2016 09:54:15 +1000 Subject: [PATCH] Move static constructor calls to after PHY, clock & baud rate are setup Otherwise anything printed inside the constructor happens at unexpected baud rate. Ref #128 --- core/app_main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/app_main.c b/core/app_main.c index a6e0f49..2f4f7f1 100644 --- a/core/app_main.c +++ b/core/app_main.c @@ -440,12 +440,6 @@ static void user_start_phase2(void) { uart_flush_txfifo(0); uart_flush_txfifo(1); - // Call gcc constructor functions - void (**ctor)(void); - for ( ctor = &__init_array_start; ctor != &__init_array_end; ++ctor) { - (*ctor)(); - } - if (phy_info[0] != 5) { // Bad version byte. Discard what we read and use default values // instead. @@ -453,6 +447,13 @@ static void user_start_phase2(void) { } init_networking(phy_info, sdk_info.sta_mac_addr); free(phy_info); + + // Call gcc constructor functions + void (**ctor)(void); + for ( ctor = &__init_array_start; ctor != &__init_array_end; ++ctor) { + (*ctor)(); + } + tcpip_init(NULL, NULL); sdk_wdt_init(); xTaskCreate(sdk_user_init_task, (signed char *)"uiT", 1024, 0, 14, &sdk_xUserTaskHandle);