-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
Introduction
There is ambiguity of "serial output" in the Bord porting "General recommendations".
Problem description
Bord porting General recommendations contains a list of items to follow, the first of which is [0] "Unless explicitly recommended otherwise by this section, leave peripherals and their drivers disabled by default.". One of the recommended exceptions is [1] "If available, configure and enable a serial output for the console using the zephyr,console chosen node in the devicetree.".
(The same rule applies to the shields.)
Although not explicitly stated, we can infer from [0] that subsystems must not be enabled by default. Mainly to avoid unnecessary bloat and conflicts in the samples and tests, and to keep the samples and tests configuration as generic as possible.
[1] seems to be a valid exception, since most of the samples and tests use serial peripheral to provide output/input to the user but it does not explicitly describe what type of "serial output" is allowed. We can see that most boards use a hardware UART controller for the console. A few boards use the virtual UART controller provided by the USB CDC ACM, and to make it work they enable the USB device subsystem (CONFIG_USB_DEVICE_STACK=y). The motivation is obviously to get samples like hello_world to work out of the box. But it leads to a conflict in the USB device support samples and other subsystems samples that use the USB device stack for their own purposes. This is not unique to USB support, we would have a similar problem if there would be a virtual UART controller provided by e.g. Bluetooth support.
Proposed change
The suggestion is to change [0] to "Leave all subsystems disabled by default. Unless explicitly recommended otherwise by this section, leave peripherals and their drivers disabled by default. "
and in [1] clearly describe what kind of hardware is meant by "serial output", e.g. hardware UART controller.
Kconfig options CONFIG_USB_DEVICE_STACK or CONFIG_USB_CDC_ACM should not be enabled by any board. Board should not chosen property like zephyr,console = &usb_cdc_acm_uart;. The approach of using CDC ACM UART as a console is completely generic, so the code is the same for every board. The solution to this (although not as complete as shield approach proposed in #40645) is already in the form of "CDC-ACM Console Snippet" in the tree and can be used. What is missing is a documentation/intruction (maybe as template) to use snippet where it is appropriate e.g. hello_world sample and where it is not e.g. samples/subsys/usb/console.
Dependencies
Concerns
One could say that it can be annoying to have to specify, or even know about, e.g. -S cdc-acm-console ... to build options. I think it is acceptable if it is clearly pointed out in the board documentation, and if you work with Zephyr, you will have to learn pretty quickly that you need to enter additional arguments, and they will not get any shorter (e.g. EXTRA_DTC_OVERLAY_CONFIG).
Alternatives
chaos
Metadata
Metadata
Assignees
Labels
Type
Projects
Status