From 9803b62b4d135048b228bb48b6a3f8faf621f693 Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Mon, 19 Sep 2016 10:33:48 +0100 Subject: [PATCH] Makes flush of IOs at exit configurable. This change allows program which doesn't use the IO subsystem to completelly get rid of it in the binary generated. IO's are still flushed by default but it can be overriden in configuration. --- hal/common/retarget.cpp | 2 ++ mbed_lib.json | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/hal/common/retarget.cpp b/hal/common/retarget.cpp index c42190fbc4..004f615022 100644 --- a/hal/common/retarget.cpp +++ b/hal/common/retarget.cpp @@ -609,9 +609,11 @@ extern "C" void exit(int return_code) { #endif #if DEVICE_STDIO_MESSAGES +#if MBED_CONF_CORE_STDIO_FLUSH_AT_EXIT fflush(stdout); fflush(stderr); #endif +#endif #if DEVICE_SEMIHOST if (mbed_interface_connected()) { diff --git a/mbed_lib.json b/mbed_lib.json index 6300a4b0f2..e524af3ddc 100644 --- a/mbed_lib.json +++ b/mbed_lib.json @@ -9,6 +9,11 @@ "stdio-baud-rate": { "help": "Baud rate for stdio", "value": 9600 + }, + + "stdio-flush-at-exit": { + "help": "Enable or disable the flush of standard I/O's at exit.", + "value": true } } }