tinyusb
tinyusb copied to clipboard
Building for RP2040 with STDIO_UART disabled fails (when using -DLIB_PICO_STDIO_UART=0 instead of -ULIB_PICO_STDIO_UART)
Operating System
Linux
Board
RP2040
Firmware
N/A
What happened ?
There's a discrepancy in how TinyUSB and PICO_SDK check if stdio to UART is enabled.
From https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/pico_stdlib/stdlib.c
void setup_default_uart(void) {
#if LIB_PICO_STDIO_UART
stdio_uart_init();
#elif defined(PICO_DEFAULT_UART_BAUD_RATE) && defined(PICO_DEFAULT_UART_TX_PIN) && defined(PICO_DEFAULT_UART_RX_PIN)
...
#endif
while TinyUSB uses **defined**(LIB_PICO_STDIO_UART)
https://github.com/hathach/tinyusb/blob/master/hw/bsp/rp2040/family.c
#if !defined(UART_DEV) && defined(PICO_DEFAULT_UART) && defined(LIB_PICO_STDIO_UART) && \
defined(PICO_DEFAULT_UART_TX_PIN) && defined(PICO_DEFAULT_UART_RX_PIN)
#define UART_DEV PICO_DEFAULT_UART
#define UART_TX_PIN PICO_DEFAULT_UART_TX_PIN
#define UART_RX_PIN PICO_DEFAULT_UART_RX_PIN
#endif
Can we remove defined() to make handling of the compiler flags consistent?
(I'd be happy to send a PR)
How to reproduce ?
Build with -DLIB_PICO_STDIO_UART=0
Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)
external/pico-sdk++_repo_rules2+tinyusb/hw/bsp/rp2040/family.c:165:3: error: call to undeclared function 'stdio_uart_init_full'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
165 | stdio_uart_init_full(uart_inst, CFG_BOARD_UART_BAUDRATE, UART_TX_PIN, UART_RX_PIN);
| ^
Screenshots
No response
I have checked existing issues, dicussion and documentation
- [x] I confirm I have checked existing issues, dicussion and documentation.
sure, please make the PR