Skip to content

Commit 9803b62

Browse files
committed
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.
1 parent 7669d7f commit 9803b62

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

hal/common/retarget.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,9 +609,11 @@ extern "C" void exit(int return_code) {
609609
#endif
610610

611611
#if DEVICE_STDIO_MESSAGES
612+
#if MBED_CONF_CORE_STDIO_FLUSH_AT_EXIT
612613
fflush(stdout);
613614
fflush(stderr);
614615
#endif
616+
#endif
615617

616618
#if DEVICE_SEMIHOST
617619
if (mbed_interface_connected()) {

mbed_lib.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
"stdio-baud-rate": {
1010
"help": "Baud rate for stdio",
1111
"value": 9600
12+
},
13+
14+
"stdio-flush-at-exit": {
15+
"help": "Enable or disable the flush of standard I/O's at exit.",
16+
"value": true
1217
}
1318
}
1419
}

0 commit comments

Comments
 (0)