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>
This commit is contained in:
parent
ee4b134dd6
commit
cac263ec3f
4 changed files with 65 additions and 0 deletions
36
snippets/cdc-acm-console/README.rst
Normal file
36
snippets/cdc-acm-console/README.rst
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
.. _snippet-cdc-acm-console:
|
||||||
|
|
||||||
|
CDC-ACM Console Snippet (cdc-acm-console)
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
west build -S cdc-acm-console [...]
|
||||||
|
|
||||||
|
Overview
|
||||||
|
********
|
||||||
|
|
||||||
|
This snippet redirects serial console output to a CDC ACM UART. The USB device
|
||||||
|
which should be used is configured using :ref:`devicetree`.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
************
|
||||||
|
|
||||||
|
Hardware support for:
|
||||||
|
|
||||||
|
- :kconfig:option:`CONFIG_USB_DEVICE_STACK`
|
||||||
|
- :kconfig:option:`CONFIG_SERIAL`
|
||||||
|
- :kconfig:option:`CONFIG_CONSOLE`
|
||||||
|
- :kconfig:option:`CONFIG_UART_CONSOLE`
|
||||||
|
- :kconfig:option:`CONFIG_UART_LINE_CTRL`
|
||||||
|
|
||||||
|
A devicetree node with node label ``zephyr_udc0`` that points to an enabled USB
|
||||||
|
device node with driver support. This should look roughly like this in
|
||||||
|
:ref:`your devicetree <get-devicetree-outputs>`:
|
||||||
|
|
||||||
|
.. code-block:: DTS
|
||||||
|
|
||||||
|
zephyr_udc0: usbd@deadbeef {
|
||||||
|
compatible = "vnd,usb-device";
|
||||||
|
/* ... */
|
||||||
|
};
|
8
snippets/cdc-acm-console/cdc-acm-console.conf
Normal file
8
snippets/cdc-acm-console/cdc-acm-console.conf
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
CONFIG_USB_DEVICE_STACK=y
|
||||||
|
CONFIG_USB_DEVICE_PRODUCT="Zephyr USB console sample"
|
||||||
|
CONFIG_USB_DEVICE_PID=0x0004
|
||||||
|
|
||||||
|
CONFIG_SERIAL=y
|
||||||
|
CONFIG_CONSOLE=y
|
||||||
|
CONFIG_UART_CONSOLE=y
|
||||||
|
CONFIG_UART_LINE_CTRL=y
|
17
snippets/cdc-acm-console/cdc-acm-console.overlay
Normal file
17
snippets/cdc-acm-console/cdc-acm-console.overlay
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021, 2023 Nordic Semiconductor ASA
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/ {
|
||||||
|
chosen {
|
||||||
|
zephyr,console = &snippet_cdc_acm_console_uart;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&zephyr_udc0 {
|
||||||
|
snippet_cdc_acm_console_uart: snippet_cdc_acm_console_uart {
|
||||||
|
compatible = "zephyr,cdc-acm-uart";
|
||||||
|
};
|
||||||
|
};
|
4
snippets/cdc-acm-console/snippet.yml
Normal file
4
snippets/cdc-acm-console/snippet.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
name: cdc-acm-console
|
||||||
|
append:
|
||||||
|
OVERLAY_CONFIG: cdc-acm-console.conf
|
||||||
|
DTC_OVERLAY_FILE: cdc-acm-console.overlay
|
Loading…
Add table
Add a link
Reference in a new issue