-
Notifications
You must be signed in to change notification settings - Fork 8.2k
usb: patches to resolve issues around Kconfig option USB_UART_CONSOLE #40220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ee570c8
b0dc396
623ace0
9b88cba
4d53a79
1d52620
a92896b
561c894
461b174
74b92d7
9c03497
105e3da
6c32698
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Copyright (c) 2021 Nordic Semiconductor ASA | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| if SHIELD_CDC_ACM_CONSOLE || SHIELD_CDC_ACM_SHELL || SHIELD_CDC_ACM_BT_C2H | ||
|
|
||
| # TEST_LOGGING_DEFAULTS option sets all log levels to INF, | ||
| # including the USB_CDC_ACM_LOG_LEVEL and that can not work. | ||
| config TEST_LOGGING_DEFAULTS | ||
| default n | ||
|
|
||
| config SERIAL | ||
| default y | ||
|
|
||
| config UART_LINE_CTRL | ||
| default y | ||
|
|
||
| config USB_DEVICE_STACK | ||
| default y | ||
|
|
||
| config USB_DEVICE_INITIALIZE_AT_BOOT | ||
| default y | ||
|
|
||
| endif #if SHIELD_CDC_ACM_CONSOLE || SHIELD_CDC_ACM_SHELL || ... | ||
|
|
||
| if SHIELD_CDC_ACM_CONSOLE | ||
|
|
||
| config CONSOLE | ||
| default y | ||
|
|
||
| config UART_CONSOLE | ||
| default y | ||
|
|
||
| endif #if SHIELD_CDC_ACM_CONSOLE | ||
|
|
||
| if SHIELD_CDC_ACM_SHELL | ||
|
|
||
| config SHELL_BACKEND_SERIAL_CHECK_DTR | ||
| default y | ||
|
|
||
| config LOG_PRINTK | ||
| default y | ||
|
|
||
| endif #if SHIELD_CDC_ACM_SHELL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Copyright (c) 2021 | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| config SHIELD_CDC_ACM_CONSOLE | ||
| def_bool $(shields_list_contains,cdc_acm_console) | ||
|
|
||
| config SHIELD_CDC_ACM_SHELL | ||
| def_bool $(shields_list_contains,cdc_acm_shell) | ||
|
|
||
| config SHIELD_CDC_ACM_BT_C2H | ||
| def_bool $(shields_list_contains,cdc_acm_bt_c2h) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| .. _cdc_acm_shield: | ||
|
|
||
| Generic shields for CDC ACM UART | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shields today are a piece of hardware you may attach to another board. This commit 4d53a79 uses the shield feature for something that is not a shield. That is a direction I dislike. It's another approach of #14740 and #33656, just through shield this time. Using shield this way makes it unclear what a shield is, and it also suffers the same disadvantage / complexity as mentioned here: #14740 (comment) If you would like to propose a solution like the shield then please make a dedicated PR with such proposal the can be discussed, also at dev-review. For example the Not being against such idea, my concern is still related to:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am convinced that shield approach is a better fit for CDC ACM UART, similar to how one would connect a real UART controller through I2C/SPI using a shield. |
||
| ################################ | ||
|
|
||
| Overview | ||
| ******** | ||
|
|
||
| This is a generic shield that provides devicetree and configuration overlays, | ||
| and configures USB device stack so that CDC ACM UART can be used as backend | ||
| for console, logging, and shell. It is mainly intended to be used with boards | ||
| that do not have a debug adapter or native UART, but do have a USB device | ||
| controller. | ||
| This approach allows us to avoid many identical overlays in samples and tests | ||
| directories (see :ref:`usb_device_cdc_acm` for more details). | ||
| It also simplifies the configuration of the above mentioned boards, | ||
| they can stay with the minimal configuration which minimizes the conflicts | ||
| especially with different in-tree samples. | ||
|
|
||
| These shields enable :kconfig:`CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT` and | ||
| configure USB device stack so that it is automatically initialized. | ||
| This is important for the boards like :ref:`nrf52840dongle_nrf52840`, | ||
| otherwise in-tree samples, that do not enable USB device support, are | ||
| not usable. But it also means that in-tree samples, like :ref:`usb_cdc-acm`, | ||
| that initialize USB device support themselves cannot be used with these shields. | ||
| This is a good compromise which provides maximum coverage of usable samples for | ||
| these specific USB dongles. | ||
|
|
||
| Current supported chosen properties | ||
| =================================== | ||
|
|
||
| +------------------------+---------------------+ | ||
| | Chosen property | Shield Designation | | ||
| | | | | ||
| +========================+=====================+ | ||
| | ``zephyr,console`` | ``cdc_acm_console`` | | ||
| +------------------------+---------------------+ | ||
| | ``zephyr,shell-uart`` | ``cdc_acm_shell`` | | ||
| +------------------------+---------------------+ | ||
| | ``zephyr,bt-c2h-uart`` | ``cdc_acm_bt_c2h`` | | ||
| +------------------------+---------------------+ | ||
|
|
||
| Requirements | ||
| ************ | ||
|
|
||
| This shield can only be used with a board which provides a USB device | ||
| controller. | ||
|
|
||
| Programming | ||
| *********** | ||
|
|
||
| Set ``-DSHIELD=cdc_acm_shell`` when you invoke ``west build``. For example: | ||
|
|
||
| .. zephyr-app-commands:: | ||
| :zephyr-app: samples/subsys/shell/shell_module | ||
| :board: nrf52840dongle_nrf52840 | ||
| :shield: cdc_acm_shell | ||
| :goals: build | ||
|
|
||
| Or ``-DSHIELD=cdc_acm_console``, for example: | ||
|
|
||
| .. zephyr-app-commands:: | ||
| :zephyr-app: samples/basic/threads | ||
| :board: nrf52840dongle_nrf52840 | ||
| :shield: cdc_acm_console | ||
| :goals: build | ||
|
|
||
| With ``-DSHIELD=cdc_acm_bt_c2h``, :ref:`bluetooth-hci-uart-sample` can use | ||
| CDC ACM UART as interface to the host: | ||
|
|
||
| .. zephyr-app-commands:: | ||
| :zephyr-app: samples/bluetooth/hci_uart | ||
| :board: nrf52840dongle_nrf52840 | ||
| :shield: cdc_acm_bt_c2h | ||
| :goals: build | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,7 @@ config CONSOLE_HANDLER | |
|
|
||
| config CONSOLE_INIT_PRIORITY | ||
| int "Console init priority" | ||
| default 95 if USB_UART_CONSOLE || UART_MUX | ||
| default 95 if UART_MUX | ||
|
||
| default 60 if UART_CONSOLE || XTENSA_SIM_CONSOLE | ||
| default KERNEL_INIT_PRIORITY_DEFAULT | ||
| help | ||
|
|
@@ -87,15 +87,6 @@ config UART_CONSOLE_INPUT_EXPIRED_TIMEOUT | |
| Fixed amount of time which unit is milliseconds to keep the UART | ||
| console in use flag true. | ||
|
|
||
| config USB_UART_CONSOLE | ||
| bool "Use USB port for console outputs" | ||
| select UART_CONSOLE | ||
| select USB_CDC_ACM | ||
| help | ||
| Enable this option to use the USB CDC ACM class for console. | ||
| As for the console driver, this option only changes the initialization | ||
| level. | ||
|
|
||
| config RAM_CONSOLE | ||
| bool "Use RAM console" | ||
| select CONSOLE_HAS_DRIVER | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,4 @@ tests: | |
| platform_allow: sensortile_box | ||
| tags: sensors | ||
| depends_on: i2c spi gpio | ||
| extra_args: SHIELD="cdc_acm_console" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so all boards cleaned up in this commit 9c03497 must now use
-DSHIELD=cdc_acm_consoleThat sounds like a step backward in user-friendliness if those boards are expected to always use the usb as console.
For example, this board
bl654_usbdoesn't seem to have any other option than using USB for console:https://docs.zephyrproject.org/latest/boards/arm/bl654_usb/doc/bl654_usb.html
@kieran-mackey FYI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it is a step forward, only with these patches it becomes possible to use CDC ACM UART (not usb) as backend for console. The configuration of this board in the tree is not usable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which board or all boards ?
Read my comment:
i'm refering to the entire commit 9c03497, not a single board, but github requires me to put the comment on a single line.
That is, my comment covers all those boards you are modifying in that commit:
are you saying that the current configuration in Zephyr of those boards are not working for any of them ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as far as I'm aware, the general problem started with this cleanup:
d12331e
which again was fixing:
#38403
caused by this:
#37512
So maybe we should go back to the origin of the problem, instead of completely changing how users must use the boards.