diff --git a/targets/TARGET_STM/serial_api.c b/targets/TARGET_STM/serial_api.c index b7ce63f546..9875c6ed5e 100644 --- a/targets/TARGET_STM/serial_api.c +++ b/targets/TARGET_STM/serial_api.c @@ -205,6 +205,7 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) uint8_t stdio_config = false; +#if defined(MBED_CONF_TARGET_CONSOLE_UART) if ((tx == CONSOLE_TX) || (rx == CONSOLE_RX)) { stdio_config = true; } else { @@ -212,6 +213,7 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) error("Error: new serial object is using same UART as STDIO"); } } +#endif const serial_pinmap_t explicit_uart_pinmap = {peripheral, tx, tx_function, rx, rx_function, stdio_config};