From f3de4bc529c2ca46b203ec237fd6354b7a8eb7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20L=C3=B8ve=20Selvik?= Date: Tue, 29 Jul 2014 11:27:24 +0200 Subject: [PATCH] Bugfix: Make redirected stdio write initialize UART Calling a scanf before the first printf would end up calling serial_getc without initializing the UART. --- libraries/mbed/common/retarget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/mbed/common/retarget.cpp b/libraries/mbed/common/retarget.cpp index 168d319a97..57bf22f29c 100644 --- a/libraries/mbed/common/retarget.cpp +++ b/libraries/mbed/common/retarget.cpp @@ -227,6 +227,7 @@ extern "C" int PREFIX(_read)(FILEHANDLE fh, unsigned char *buffer, unsigned int if (fh < 3) { // only read a character at a time from stdin #if DEVICE_SERIAL + if (!stdio_uart_inited) init_serial(); *buffer = serial_getc(&stdio_uart); #endif n = 1;