Skip to content

Commit b419cfc

Browse files
author
Cruz Monrreal
authored
Merge pull request #10328 from kjbracey-arm/stdio_serial_option
Add option to disable default UART console
2 parents 49cae76 + f6456d8 commit b419cfc

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

platform/mbed_lib.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
},
1313

1414
"stdio-buffered-serial": {
15-
"help": "Use UARTSerial driver to obtain buffered serial I/O on stdin/stdout/stderr. If false, unbuffered serial_getc and serial_putc are used directly.",
15+
"help": "(Applies if target.console-uart is true.) Use UARTSerial driver to obtain buffered serial I/O on stdin/stdout/stderr. If false, unbuffered serial_getc and serial_putc are used directly.",
1616
"value": false
1717
},
1818

1919
"stdio-baud-rate": {
20-
"help": "Baud rate for stdio",
20+
"help": "(Applies if target.console-uart is true.) Baud rate for stdio",
2121
"value": 9600
2222
},
2323

platform/mbed_retarget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ MBED_WEAK FileHandle *mbed::mbed_override_console(int fd)
261261

262262
static FileHandle *default_console()
263263
{
264-
#if DEVICE_SERIAL
264+
#if MBED_CONF_TARGET_CONSOLE_UART && DEVICE_SERIAL
265265
# if MBED_CONF_PLATFORM_STDIO_BUFFERED_SERIAL
266266
static UARTSerial console(STDIO_UART_TX, STDIO_UART_RX, MBED_CONF_PLATFORM_STDIO_BAUD_RATE);
267267
# if CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_RTS
@@ -274,7 +274,7 @@ static FileHandle *default_console()
274274
# else
275275
static DirectSerial console(STDIO_UART_TX, STDIO_UART_RX, MBED_CONF_PLATFORM_STDIO_BAUD_RATE);
276276
# endif
277-
#else // DEVICE_SERIAL
277+
#else // MBED_CONF_TARGET_CONSOLE_UART && DEVICE_SERIAL
278278
static Sink console;
279279
#endif
280280
return &console;

targets/targets.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
"bootloader_supported": false,
1616
"static_memory_defines": true,
1717
"config": {
18+
"console-uart": {
19+
"help": "Target has UART console on pins STDIO_UART_TX, STDIO_UART_RX. Value is only significant if target has SERIAL device.",
20+
"value": true
21+
},
1822
"console-uart-flow-control": {
1923
"help": "Console hardware flow control. Options: null, RTS, CTS, RTSCTS.",
2024
"value": null

0 commit comments

Comments
 (0)