Skip to content

Commit 0742135

Browse files
authored
Merge pull request #14457 from ARMmbed/uart-stdio-alias
Update UART pin names & add MBED_CONF_TARGET_STDIO_UART overrides
2 parents 6d1a6da + 9cc2deb commit 0742135

File tree

176 files changed

+1007
-499
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+1007
-499
lines changed

TEST_APPS/device/nanostack_mac_tester/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#endif
4545

4646
extern mac_api_s *mac_interface;
47-
UnbufferedSerial pc(USBTX, USBRX);
47+
UnbufferedSerial pc(CONSOLE_TX, CONSOLE_RX);
4848
osThreadId_t main_thread;
4949
static CircularBuffer<uint8_t, RX_BUFFER_SIZE> rx_buffer;
5050
static uint8_t ns_heap[HEAP_FOR_MAC_TESTER_SIZE];

drivers/docs/serial/serial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Other alternatives to printing to stdout are by calling `puts` or `write`.
232232
puts("Hello");
233233
```
234234
```C
235-
BufferedSerial pc(USBTX, USBRX);
235+
BufferedSerial pc(CONSOLE_TX, CONSOLE_RX);
236236
pc.write("Hello", 6);
237237
```
238238

drivers/tests/TESTS/mbed_drivers/buffered_serial/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ using namespace utest::v1;
4949

5050

5151
static BufferedSerial buffered_serial_obj(
52-
USBTX, USBRX, MBED_CONF_PLATFORM_STDIO_BAUD_RATE
52+
CONSOLE_TX, CONSOLE_RX, MBED_CONF_PLATFORM_STDIO_BAUD_RATE
5353
);
5454

5555

drivers/tests/TESTS/mbed_drivers/unbuffered_serial/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ using namespace utest::v1;
4747

4848

4949
static UnbufferedSerial unbuffered_serial_obj(
50-
USBTX, USBRX, MBED_CONF_PLATFORM_STDIO_BAUD_RATE
50+
CONSOLE_TX, CONSOLE_RX, MBED_CONF_PLATFORM_STDIO_BAUD_RATE
5151
);
5252

5353
static ssize_t unbuffered_serial_read(void *buffer, ssize_t length)

features/frameworks/greentea-client/source/greentea_test_env.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ static void greentea_write_int(const int val)
284284
* \brief Encapsulate and send key-value message from DUT to host
285285
*
286286
* This function uses underlying functions to write directly
287-
* to the serial port, (USBTX). This allows KVs to be used
287+
* to the serial port, (CONSOLE_TX). This allows KVs to be used
288288
* from within interrupt context.
289289
*
290290
* \param key Message key (message/event name)
@@ -305,7 +305,7 @@ extern "C" void greentea_send_kv(const char *key, const char *val) {
305305
* \brief Encapsulate and send key-value message from DUT to host
306306
*
307307
* This function uses underlying functions to write directly
308-
* to the serial port, (USBTX). This allows KVs to be used
308+
* to the serial port, (CONSOLE_TX). This allows KVs to be used
309309
* from within interrupt context.
310310
* Last value is an integer to avoid integer to string conversion
311311
* made by the user.
@@ -328,7 +328,7 @@ void greentea_send_kv(const char *key, const int val) {
328328
* \brief Encapsulate and send key-value-value message from DUT to host
329329
*
330330
* This function uses underlying functions to write directly
331-
* to the serial port, (USBTX). This allows KVs to be used
331+
* to the serial port, (CONSOLE_TX). This allows KVs to be used
332332
* from within interrupt context.
333333
* Last value is an integer to avoid integer to string conversion
334334
* made by the user.
@@ -355,7 +355,7 @@ void greentea_send_kv(const char *key, const char *val, const int result) {
355355
* \brief Encapsulate and send key-value-value-value message from DUT to host
356356
*
357357
* This function uses underlying functions to write directly
358-
* to the serial port, (USBTX). This allows KVs to be used
358+
* to the serial port, (CONSOLE_TX). This allows KVs to be used
359359
* from within interrupt context.
360360
* Last 2 values are integers to avoid integer to string conversion
361361
* made by the user.
@@ -389,7 +389,7 @@ void greentea_send_kv(const char *key, const char *val, const int passes, const
389389
* \brief Encapsulate and send key-value-value message from DUT to host
390390
*
391391
* This function uses underlying functions to write directly
392-
* to the serial port, (USBTX). This allows key-value-value to be used
392+
* to the serial port, (CONSOLE_TX). This allows key-value-value to be used
393393
* from within interrupt context.
394394
* Both values are integers to avoid integer to string conversion
395395
* made by the user.

hal/docs/0002-pinmap-extension.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Some boards have pins which cannot be tested without causing problems elsewhere.
7474
MBED_WEAK const PinList *pinmap_restricted_pins()
7575
{
7676
static const PinName pins[] = {
77-
USBTX, USBRX
77+
CONSOLE_TX, CONSOLE_RX
7878
};
7979
static const PinList pin_list = {
8080
sizeof(pins) / sizeof(pins[0]),

hal/include/hal/PinNameAliases.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,8 @@
2121
#define MBED_PIN_NAME_ALIASES_H
2222

2323
/* Aliases for legacy reasons. To be removed in the next Mbed OS version */
24-
#if defined (CONSOLE_TX) && (CONSOLE_RX)
2524
#define USBTX CONSOLE_TX
2625
#define USBRX CONSOLE_RX
27-
#else
28-
#define CONSOLE_TX USBTX
29-
#define CONSOLE_RX USBRX
30-
#endif
3126

3227
#if defined (TARGET_FF_ARDUINO) || (TARGET_FF_ARDUINO_UNO)
3328

hal/include/hal/pinmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ bool pinmap_list_has_peripheral(const PeripheralList *list, int peripheral);
143143
*
144144
* The restricted pin list is used to indicate to testing
145145
* that a pin should be skipped due to some caveat about it.
146-
* For example, using USBRX and USBTX during tests will interfere
146+
* For example, using CONSOLE_RX and CONSOLE_TX during tests will interfere
147147
* with the test runner and should be avoided.
148148
*
149149
* Targets should override the weak implementation of this

targets/TARGET_ARM_FM/TARGET_FVP_MPS2/PeripheralNames.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,23 @@ typedef enum {
7575
PWM_11
7676
} PWMName;
7777

78-
#define STDIO_UART_TX USBTX
79-
#define STDIO_UART_RX USBRX
78+
#if defined(MBED_CONF_TARGET_STDIO_UART_TX)
79+
#define STDIO_UART_TX MBED_CONF_TARGET_STDIO_UART_TX
80+
#else
81+
#define STDIO_UART_TX CONSOLE_TX
82+
#endif
83+
#if defined(MBED_CONF_TARGET_STDIO_UART_RX)
84+
#define STDIO_UART_RX MBED_CONF_TARGET_STDIO_UART_RX
85+
#else
86+
#define STDIO_UART_RX CONSOLE_RX
87+
#endif
8088
#define STDIO_UART UART_0
8189

82-
#define MBED_UART0 USBTX, USBRX
90+
#define MBED_UART0 CONSOLE_TX, CONSOLE_RX
8391
#define MBED_UART1 XB_TX, XB_RX
8492
#define MBED_UART2 SH0_TX, SH0_RX
8593
#define MBED_UART3 SH1_TX, SH1_RX
86-
#define MBED_UARTUSB USBTX, USBRX
94+
#define MBED_UARTUSB CONSOLE_TX, CONSOLE_RX
8795

8896
#ifdef __cplusplus
8997
}

targets/TARGET_ARM_FM/TARGET_FVP_MPS2/PinNames.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ typedef enum {
156156
ADC_SSEL = 653,
157157

158158
//MPS2 Uart
159-
USBTX = 400,
160-
USBRX = 401,
159+
CONSOLE_TX = 400,
160+
CONSOLE_RX = 401,
161161
XB_TX = 402,
162162
XB_RX = 403,
163163
UART_TX2 = 404,

0 commit comments

Comments
 (0)