Skip to content
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

boards: add common configuration for CDC ACM UART #81308

Conversation

jfischer-no
Copy link
Collaborator

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.

Derived from #81220 and #81228, as first step (or alternative).

rerickson1
rerickson1 previously approved these changes Nov 12, 2024
Copy link
Member

@rerickson1 rerickson1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ezurio boards look ok

};

zephyr_udc0: &usbd {
cdc_acm_uart: cdc_acm_uart {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this not be cdc_acm_uart0 if it supports multiple instances?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cdc_acm_uart0 is likely to conflict with samples or user applications, we should rather name it board_cdc_acm_uart, like we prefix snippets and shields.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

board_* prefix sounds good

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also moved them to boards/common/usb/

endif # LOG

endif # USB_DEVICE_STACK
source "${ZEPHYR_BASE}/boards/common/Kconfig.cdc_acm_serial"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick:
Harmonize path between Kconfig and dts:
source "../boards/common/Kconfig.cdc_acm_serial"
#include <../boards/common/cdc_acm_serial.dts>
or
source "${ZEPHYR_BASE}/boards/common/Kconfig.cdc_acm_serial"
#include <${ZEPHYR_BASE}/boards/common/cdc_acm_serial.dts>

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${ZEPHYR_BASE} cannot be resolved in dt.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we then use ../boards/common for Kconfig ?

nordicjm
nordicjm previously approved these changes Nov 13, 2024
Copy link
Member

@carlescufi carlescufi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for the approach

compatible = "zephyr,cdc-acm-uart";
};
};
- through common CDC ACM UART backend configuraiton for all boards

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This typo caught my eye, and has at least one other instance in this PR.

Suggested change
- through common CDC ACM UART backend configuraiton for all boards
- through common CDC ACM UART backend configuration for all boards

tejlmand
tejlmand previously approved these changes Dec 12, 2024
Copy link
Collaborator

@tejlmand tejlmand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

Still some minor details, but those are very much depending on the perspective from where the solution is seen, so not something which should block this PR.

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]>
@jfischer-no jfischer-no force-pushed the pr-boards-common-cdc_acm_serial-only branch from 21bf925 to ae8123a Compare December 12, 2024 14:57
@jfischer-no jfischer-no force-pushed the pr-boards-common-cdc_acm_serial-only branch from ae8123a to 4c74867 Compare December 12, 2024 22:34
@jfischer-no jfischer-no requested a review from tejlmand December 12, 2024 22:34
@carlescufi
Copy link
Member

@rerickson1 @nordicjm @tejlmand @erwango could you take another look?

tejlmand
tejlmand previously approved these changes Dec 16, 2024
Remove all USB and CDC ACM configuration in favor of common
configuraiton.

Do not adapt board-specific configurations such as unknown PID/VID or
string descriptors. There is no justification for using them on specific
boards, and we do not have formal approval to use them in the project
tree. Also, we need more uniform configuration, since the main reason
for enabling CDC ACM here is to allow users to run examples like
hello_world right out of the box. Of course, anyone is free to customize
these settings in their fork or downstream project.

Signed-off-by: Johann Fischer <[email protected]>
The board hardware has no network interfaces, although the ECM/EEM class
implementation can provide Ethernet-like functionality and export it to
the host, this is no reason to default to a specific USB class
implementation.We do not make this kind of configuration for other
boards that have a USB device controller. Also, it may not be what a
user expects when using these boards with networking and a USB stack.

Signed-off-by: Johann Fischer <[email protected]>
@nordicjm nordicjm requested a review from tejlmand December 16, 2024 14:12
@kartben kartben merged commit 2ddb576 into zephyrproject-rtos:main Dec 16, 2024
26 checks passed
@jfischer-no jfischer-no deleted the pr-boards-common-cdc_acm_serial-only branch December 17, 2024 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.