From 1f7952e749d02f74492605ed9a50bd73dd4b4ead Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Fri, 25 Jul 2025 11:49:23 +0200 Subject: [PATCH] rp2/mphalport: Fix building with USB CDC disabled. This commit fixes the linking issues in the RP2 port that arise when explicitly disabling USB CDC support. The console input ringbuffer needs to be made available if dupterm support is enabled, and the console character input function would always attempt to read from the input ringbuffer even if CDC support is disabled and the console isn't bound to any UART. Signed-off-by: Alessandro Gatti --- ports/rp2/mphalport.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ports/rp2/mphalport.c b/ports/rp2/mphalport.c index b581b3b59f..4dd510dea4 100644 --- a/ports/rp2/mphalport.c +++ b/ports/rp2/mphalport.c @@ -50,7 +50,7 @@ static uint64_t time_us_64_offset_from_epoch; #endif -#if MICROPY_HW_ENABLE_UART_REPL || MICROPY_HW_USB_CDC +#if MICROPY_HW_ENABLE_UART_REPL || MICROPY_HW_USB_CDC || MICROPY_PY_OS_DUPTERM_NOTIFY #ifndef MICROPY_HW_STDIN_BUFFER_LEN #define MICROPY_HW_STDIN_BUFFER_LEN 512 @@ -83,11 +83,12 @@ int mp_hal_stdin_rx_chr(void) { #if MICROPY_HW_USB_CDC mp_usbd_cdc_poll_interfaces(0); #endif - + #if MICROPY_HW_USB_CDC || MICROPY_HW_ENABLE_UART_REPL || MICROPY_PY_OS_DUPTERM_NOTIFY int c = ringbuf_get(&stdin_ringbuf); if (c != -1) { return c; } + #endif #if MICROPY_PY_OS_DUPTERM int dupterm_c = mp_os_dupterm_rx_chr(); if (dupterm_c >= 0) {