Skip to content

Commit c457401

Browse files
de-nordictejlmand
authored andcommitted
[nrf fromtree] zephyr: serial_recovery: Fix broken CDC device selection
When using CDC only and CONFIG_SERIAL is not enabled in Zephyr, but there is chosen zephyr,mcumgr-uart, the chosen takes precedence over CDC and directs MCUmgr to that uart. This causes two issues: first the CDC is ignored if chosen exists, and makes build fail because drivers are not built. (cherry picked from commit 5397c13) Signed-off-by: Dominik Ermel <[email protected]>
1 parent 4d30b55 commit c457401

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

boot/zephyr/serial_adapter.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,21 @@ boot_uart_fifo_getline(char **line)
199199
static int
200200
boot_uart_fifo_init(void)
201201
{
202+
203+
#if defined(CONFIG_BOOT_SERIAL_UART)
204+
202205
#if DT_HAS_CHOSEN(zephyr_uart_mcumgr)
203206
uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_uart_mcumgr));
204207
#else
205-
206-
#if defined(CONFIG_BOOT_SERIAL_UART)
207208
uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
209+
#endif
210+
208211
#elif defined(CONFIG_BOOT_SERIAL_CDC_ACM)
209212
uart_dev = DEVICE_DT_GET_ONE(zephyr_cdc_acm_uart);
213+
#else
214+
#error No serial recovery device selected
210215
#endif
211216

212-
#endif
213217

214218
if (!device_is_ready(uart_dev)) {
215219
return (-1);

0 commit comments

Comments
 (0)