Skip to content

Commit

Permalink
[nrf fromtree] zephyr: serial_recovery: Fix broken CDC device selection
Browse files Browse the repository at this point in the history
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 <dominik.ermel@nordicsemi.no>
  • Loading branch information
de-nordic authored and tejlmand committed May 3, 2023
1 parent 4d30b55 commit c457401
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions boot/zephyr/serial_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,21 @@ boot_uart_fifo_getline(char **line)
static int
boot_uart_fifo_init(void)
{

#if defined(CONFIG_BOOT_SERIAL_UART)

#if DT_HAS_CHOSEN(zephyr_uart_mcumgr)
uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_uart_mcumgr));
#else

#if defined(CONFIG_BOOT_SERIAL_UART)
uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
#endif

#elif defined(CONFIG_BOOT_SERIAL_CDC_ACM)
uart_dev = DEVICE_DT_GET_ONE(zephyr_cdc_acm_uart);
#else
#error No serial recovery device selected
#endif

#endif

if (!device_is_ready(uart_dev)) {
return (-1);
Expand Down

0 comments on commit c457401

Please sign in to comment.