drivers: uart_mcumgr: remove CONFIG_UART_MCUMGR_ON_DEV_NAME

Remove CONFIG_UART_MCUMGR_ON_DEV_NAME and use
DEVICE_DT_GET(DT_CHOSEN(zephyr_uart_mcumgr)).
Add usb.overlay, which contains chosen node and cdc-acm-uart node,
to smp_svr sample.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This commit is contained in:
Johann Fischer 2021-08-02 11:35:21 +02:00 committed by Christopher Friedt
commit c179d83e72
6 changed files with 24 additions and 17 deletions

View file

@ -50,6 +50,8 @@ Removed APIs in this release
* Removed ``CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM`` and * Removed ``CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM`` and
``CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME`` Kconfig options ``CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME`` Kconfig options
in favor of chosen node ``zephyr,ot-uart``. in favor of chosen node ``zephyr,ot-uart``.
* Removed ``CONFIG_UART_MCUMGR_ON_DEV_NAME`` Kconfig option
in favor of direct use of chosen node ``zephyr,uart-mcumgr``.
============================ ============================

View file

@ -246,17 +246,6 @@ config UART_MCUMGR
if UART_MCUMGR if UART_MCUMGR
# Workaround for not being able to have commas in macro arguments
DT_CHOSEN_Z_UART_MCUMGR := zephyr,uart-mcumgr
config UART_MCUMGR_ON_DEV_NAME
string "Device Name of UART Device for mcumgr UART"
default "$(dt_chosen_label,$(DT_CHOSEN_Z_UART_MCUMGR))" if HAS_DTS
default "UART_0"
help
This option specifies the name of UART device to be used
for mcumgr UART.
config UART_MCUMGR_RX_BUF_SIZE config UART_MCUMGR_RX_BUF_SIZE
int "Size of receive buffer for mcumgr fragments received over UART, in bytes" int "Size of receive buffer for mcumgr fragments received over UART, in bytes"
default 128 default 128

View file

@ -246,9 +246,9 @@ void uart_mcumgr_register(uart_mcumgr_recv_fn *cb)
{ {
uart_mgumgr_recv_cb = cb; uart_mgumgr_recv_cb = cb;
uart_mcumgr_dev = device_get_binding(CONFIG_UART_MCUMGR_ON_DEV_NAME); uart_mcumgr_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_uart_mcumgr));
if (uart_mcumgr_dev != NULL) { if (device_is_ready(uart_mcumgr_dev)) {
uart_mcumgr_setup(uart_mcumgr_dev); uart_mcumgr_setup(uart_mcumgr_dev);
} }
} }

View file

@ -1,9 +1,6 @@
# Enable USB subsystem # Enable USB subsystem
CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_CDC_ACM=y CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_LINE_CTRL=y CONFIG_UART_LINE_CTRL=y
# USB backend is serial device # USB backend is serial device
CONFIG_MCUMGR_SMP_UART=y CONFIG_MCUMGR_SMP_UART=y
# Choose USB serial device for backend (CDC_ACM)
CONFIG_UART_MCUMGR_ON_DEV_NAME="CDC_ACM_0"

View file

@ -18,6 +18,7 @@ tests:
platform_allow: frdm_k64f platform_allow: frdm_k64f
sample.mcumg.smp_svr.cdc: sample.mcumg.smp_svr.cdc:
extra_args: OVERLAY_CONFIG="overlay-cdc.conf" extra_args: OVERLAY_CONFIG="overlay-cdc.conf"
DTC_OVERLAY_FILE="usb.overlay"
platform_allow: nrf52833dk_nrf52820 nrf52833dk_nrf52833 nrf52840dk_nrf52840 nrf5340dk_nrf5340_cpuapp platform_allow: nrf52833dk_nrf52820 nrf52833dk_nrf52833 nrf52840dk_nrf52840 nrf5340dk_nrf5340_cpuapp
sample.mcumg.smp_svr.serial: sample.mcumg.smp_svr.serial:
extra_args: OVERLAY_CONFIG="overlay-serial.conf" extra_args: OVERLAY_CONFIG="overlay-serial.conf"

View file

@ -0,0 +1,18 @@
/*
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
zephyr,uart-mcumgr = &cdc_acm_uart0;
};
};
&zephyr_udc0 {
cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
label = "CDC_ACM_0";
};
};