-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
boards: add common configuration for CDC ACM UART
Many boards have similar code to configure the USB and CDC ACM UART that they want to use as a logging or shell backend. Some of them have an incorrect or incomplete configuration. These boards do not have a built-in debug adapter, but a SoC with a USB device controller and a bootloader with USB device support. Introduce common CDC ACM UART configuration that these boards should use for logging or shell backend to avoid duplicate or incorrect configuration. Signed-off-by: Johann Fischer <[email protected]>
- Loading branch information
1 parent
e1b4320
commit d422cee
Showing
3 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright (c) 2023-2024 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config BOARD_REQUIRES_SERIAL_BACKEND_CDC_ACM | ||
default y | ||
|
||
if BOARD_SERIAL_BACKEND_CDC_ACM | ||
|
||
config SERIAL | ||
default y | ||
|
||
config CONSOLE | ||
default y | ||
|
||
config UART_CONSOLE | ||
default CONSOLE | ||
|
||
config SHELL_BACKEND_SERIAL_CHECK_DTR | ||
default SHELL | ||
depends on UART_LINE_CTRL | ||
|
||
config UART_LINE_CTRL | ||
default SHELL | ||
|
||
config USB_DEVICE_STACK | ||
default y | ||
|
||
config USB_DEVICE_INITIALIZE_AT_BOOT | ||
default y if !MCUBOOT | ||
|
||
config USB_DEVICE_REMOTE_WAKEUP | ||
default n | ||
|
||
if LOG | ||
|
||
choice USB_CDC_ACM_LOG_LEVEL_CHOICE | ||
default USB_CDC_ACM_LOG_LEVEL_OFF | ||
endchoice | ||
|
||
choice USB_DEVICE_LOG_LEVEL_CHOICE | ||
default USB_DEVICE_LOG_LEVEL_OFF | ||
endchoice | ||
|
||
# Wait 4000ms at startup for logging | ||
config LOG_PROCESS_THREAD_STARTUP_DELAY_MS | ||
default 4000 | ||
|
||
endif # LOG | ||
|
||
endif # BOARD_SERIAL_BACKEND_CDC_ACM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/ { | ||
chosen { | ||
zephyr,console = &board_cdc_acm_uart; | ||
zephyr,shell-uart = &board_cdc_acm_uart; | ||
zephyr,uart-mcumgr = &board_cdc_acm_uart; | ||
zephyr,bt-mon-uart = &board_cdc_acm_uart; | ||
zephyr,bt-c2h-uart = &board_cdc_acm_uart; | ||
}; | ||
}; | ||
|
||
&zephyr_udc0 { | ||
board_cdc_acm_uart: board_cdc_acm_uart { | ||
compatible = "zephyr,cdc-acm-uart"; | ||
}; | ||
}; |