Skip to content

Commit cac263e

Browse files
mbolivar-nordiccarlescufi
authored andcommitted
snippets: add cdc-acm-console
This snippet is based on samples/subsys/usb/console. Since it's a snippet, it can be used in any application as long as its requirements are met. This makes it more general purpose. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
1 parent ee4b134 commit cac263e

File tree

4 files changed

+65
-0
lines changed

4 files changed

+65
-0
lines changed

snippets/cdc-acm-console/README.rst

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.. _snippet-cdc-acm-console:
2+
3+
CDC-ACM Console Snippet (cdc-acm-console)
4+
#########################################
5+
6+
.. code-block:: console
7+
8+
west build -S cdc-acm-console [...]
9+
10+
Overview
11+
********
12+
13+
This snippet redirects serial console output to a CDC ACM UART. The USB device
14+
which should be used is configured using :ref:`devicetree`.
15+
16+
Requirements
17+
************
18+
19+
Hardware support for:
20+
21+
- :kconfig:option:`CONFIG_USB_DEVICE_STACK`
22+
- :kconfig:option:`CONFIG_SERIAL`
23+
- :kconfig:option:`CONFIG_CONSOLE`
24+
- :kconfig:option:`CONFIG_UART_CONSOLE`
25+
- :kconfig:option:`CONFIG_UART_LINE_CTRL`
26+
27+
A devicetree node with node label ``zephyr_udc0`` that points to an enabled USB
28+
device node with driver support. This should look roughly like this in
29+
:ref:`your devicetree <get-devicetree-outputs>`:
30+
31+
.. code-block:: DTS
32+
33+
zephyr_udc0: usbd@deadbeef {
34+
compatible = "vnd,usb-device";
35+
/* ... */
36+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CONFIG_USB_DEVICE_STACK=y
2+
CONFIG_USB_DEVICE_PRODUCT="Zephyr USB console sample"
3+
CONFIG_USB_DEVICE_PID=0x0004
4+
5+
CONFIG_SERIAL=y
6+
CONFIG_CONSOLE=y
7+
CONFIG_UART_CONSOLE=y
8+
CONFIG_UART_LINE_CTRL=y
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2021, 2023 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
chosen {
9+
zephyr,console = &snippet_cdc_acm_console_uart;
10+
};
11+
};
12+
13+
&zephyr_udc0 {
14+
snippet_cdc_acm_console_uart: snippet_cdc_acm_console_uart {
15+
compatible = "zephyr,cdc-acm-uart";
16+
};
17+
};

snippets/cdc-acm-console/snippet.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name: cdc-acm-console
2+
append:
3+
OVERLAY_CONFIG: cdc-acm-console.conf
4+
DTC_OVERLAY_FILE: cdc-acm-console.overlay

0 commit comments

Comments
 (0)