From ba97e1b8353b8250f086eea9258e09fcdbc28b42 Mon Sep 17 00:00:00 2001 From: Bogdan Marinescu Date: Mon, 11 Jan 2016 17:23:44 +0200 Subject: [PATCH 1/2] Changed console initialization All the initialization related to console operations (stdout/stderr/stdin) now happens in retarget.cpp. The relevant parts will be removed from the target specific code in subsequent commits. --- source/retarget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/retarget.cpp b/source/retarget.cpp index bdbd5307..8e7b2680 100644 --- a/source/retarget.cpp +++ b/source/retarget.cpp @@ -24,6 +24,7 @@ #include "mbed-drivers/app.h" #include "minar/minar.h" #include "mbed-hal/init_api.h" +#include "mbed-hal/serial_api.h" #include "core_generic.h" #if defined(__ARMCC_VERSION) @@ -102,8 +103,8 @@ FileHandle::~FileHandle() { } #if DEVICE_SERIAL -extern int stdio_uart_inited; -extern serial_t stdio_uart; +static int stdio_uart_inited; +static serial_t stdio_uart; #endif static void init_serial() { From b6dfee04494cea81aa8e43dc2d627afdd0197de9 Mon Sep 17 00:00:00 2001 From: Bogdan Marinescu Date: Tue, 12 Jan 2016 13:10:10 +0200 Subject: [PATCH 2/2] Fixed stdio initialization sequence --- source/retarget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/retarget.cpp b/source/retarget.cpp index 8e7b2680..e221b5e5 100644 --- a/source/retarget.cpp +++ b/source/retarget.cpp @@ -112,6 +112,7 @@ static void init_serial() { if (stdio_uart_inited) return; serial_init(&stdio_uart, STDIO_UART_TX, STDIO_UART_RX); serial_baud(&stdio_uart, STDIO_DEFAULT_BAUD); + stdio_uart_inited = 1; #endif }