refactor: Remove static CDC ACM logging nodes.
* To avoid spurious CDC ACM instances when usint CDC ACM for something other than logging, move to the approach used by Zephyr of using a snippet to redirect console output to a CDC ACM node added by the snippet. Remove all the existing static CDC ACM nodes. * Add new `zmk-usb-logging` snippet that mirrors the upstream `cdc-acm-logging` snippet, but still does our extra USB logging configuration. * Updated logging docs accordingly. Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
This commit is contained in:
parent
7c09eb217e
commit
a080b5287f
35 changed files with 62 additions and 210 deletions
|
@ -4,6 +4,4 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "usb_console.dtsi"
|
||||
|
||||
&xiao_serial { status = "disabled"; };
|
||||
|
|
|
@ -4,6 +4,4 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "usb_console.dtsi"
|
||||
|
||||
&pro_micro_serial { status = "disabled"; };
|
||||
|
|
|
@ -4,6 +4,4 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "usb_console.dtsi"
|
||||
|
||||
&xiao_serial { status = "disabled"; };
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,backlight = &backlight;
|
||||
zmk,battery = &vbatt;
|
||||
|
@ -90,11 +89,8 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
chosen {
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,kscan = &kscan;
|
||||
zmk,underglow = &led_strip;
|
||||
};
|
||||
|
@ -106,13 +105,10 @@
|
|||
apb1-prescaler = <1>;
|
||||
};
|
||||
|
||||
&usb {
|
||||
zephyr_udc0: &usb {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
|
||||
pinctrl-names = "default";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
&rtc {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,battery = &vbatt;
|
||||
};
|
||||
|
||||
|
@ -82,11 +81,8 @@
|
|||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,battery = &vbatt;
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix-transform = &default_transform;
|
||||
|
@ -70,11 +69,8 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
zephyr,flash = &flash0;
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,display = &epd;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,matrix-transform = &default_transform;
|
||||
};
|
||||
|
||||
|
@ -76,11 +75,8 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
chosen {
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix-transform = &default_transform;
|
||||
};
|
||||
|
@ -65,11 +64,8 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,5) RC(
|
|||
|
||||
};
|
||||
|
||||
&usb {
|
||||
zephyr_udc0: &usb {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
chosen {
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,kscan = &kscan;
|
||||
zmk,matrix-transform = &transform;
|
||||
/* TODO: Enable once we support the IC for underglow
|
||||
|
@ -110,14 +109,11 @@
|
|||
};
|
||||
};
|
||||
|
||||
&usb {
|
||||
zephyr_udc0: &usb {
|
||||
status = "okay";
|
||||
|
||||
pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
|
||||
pinctrl-names = "default";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
&clk_hsi {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
};
|
||||
|
||||
default_transform: keymap_transform_0 {
|
||||
|
@ -59,11 +58,8 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
chosen {
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zephyr,shell-uart = &cdc_acm_uart;
|
||||
zephyr,code-partition = &code_partition;
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix-transform = &default_transform;
|
||||
|
@ -108,11 +106,8 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,6) RC(4,8) RC(4,9)
|
|||
};
|
||||
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,battery = &vbatt;
|
||||
};
|
||||
|
||||
|
@ -81,11 +80,8 @@
|
|||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,battery = &vbatt;
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix-transform = &default_transform;
|
||||
|
@ -129,11 +128,8 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,5) R
|
|||
};
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
};
|
||||
|
||||
leds {
|
||||
|
@ -65,11 +64,8 @@
|
|||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,battery = &vbatt;
|
||||
};
|
||||
|
||||
|
@ -57,12 +56,9 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
compatible = "nordic,nrf-usbd";
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
};
|
||||
|
||||
leds {
|
||||
|
@ -69,11 +68,8 @@
|
|||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
};
|
||||
|
||||
leds {
|
||||
|
@ -69,11 +68,8 @@
|
|||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,battery = &vbatt;
|
||||
};
|
||||
|
||||
|
@ -81,11 +80,8 @@
|
|||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,battery = &vbatt;
|
||||
};
|
||||
|
||||
|
@ -81,11 +80,8 @@
|
|||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,battery = &vbatt;
|
||||
};
|
||||
|
||||
|
@ -83,11 +82,8 @@
|
|||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
chosen {
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix-transform = &layout_grid_transform;
|
||||
};
|
||||
|
@ -96,13 +95,10 @@ layout_2x2u_transform:
|
|||
};
|
||||
};
|
||||
|
||||
&usb {
|
||||
zephyr_udc0: &usb {
|
||||
pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
&clk_hse {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
chosen {
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix-transform = &layout_grid_transform;
|
||||
};
|
||||
|
@ -90,13 +89,10 @@
|
|||
};
|
||||
};
|
||||
|
||||
&usb {
|
||||
zephyr_udc0: &usb {
|
||||
pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
&clk_hse {
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
chosen {
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart0;
|
||||
};
|
||||
|
||||
aliases {
|
||||
|
@ -66,13 +65,10 @@
|
|||
apb2-prescaler = <1>;
|
||||
};
|
||||
|
||||
&usb {
|
||||
zephyr_udc0: &usb {
|
||||
pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
cdc_acm_uart0: cdc_acm_uart0 {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
&rtc {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,battery = &vbatt;
|
||||
};
|
||||
|
||||
|
@ -72,11 +71,8 @@
|
|||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,battery = &vbatt;
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix-transform = &default_transform;
|
||||
|
@ -93,11 +92,8 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
|
|
|
@ -4,6 +4,4 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "usb_console.dtsi"
|
||||
|
||||
&pro_micro_serial { status = "disabled"; };
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2023 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "usb_console.dtsi"
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2022 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
};
|
||||
};
|
||||
|
||||
&usb0 {
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zmk,battery = &vbatt;
|
||||
};
|
||||
|
||||
|
@ -24,12 +23,6 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
&usbd {
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
&qspi {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&qspi_default>;
|
||||
|
|
|
@ -4,6 +4,4 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "usb_console.dtsi"
|
||||
|
||||
&xiao_serial { status = "disabled"; };
|
||||
|
|
|
@ -4,6 +4,4 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "usb_console.dtsi"
|
||||
|
||||
&pro_micro_serial { status = "disabled"; };
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2023 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
};
|
||||
};
|
||||
|
||||
&usbd {
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
|
@ -18,26 +18,33 @@ It is recommended to only enable logging when needed, and not leaving it on by d
|
|||
|
||||
:::
|
||||
|
||||
## Kconfig
|
||||
## USB Logging Snippet
|
||||
|
||||
The `CONFIG_ZMK_USB_LOGGING` Kconfig enables USB logging. This can be set at the keyboard level, typically in the `config/<your_keyboard>.conf`
|
||||
file if you are using a [user config repository](user-setup.mdx). It can also be enabled at the ZMK level using the `app/prj.conf` file, or other
|
||||
search locations described in the [configuration overview](config/index.md#config-file-locations).
|
||||
The `zmk-usb-logging` snippet is used to enable logging.
|
||||
|
||||
If using GitHub Actions to build your firmware, enabling logging
|
||||
requires adding a `snippet: zmk-usb-logging` to your `build.yaml` file for any build you want logging enabled, e.g.
|
||||
|
||||
```yaml
|
||||
---
|
||||
include:
|
||||
- board: nice_nano_v2
|
||||
shield: corne_left
|
||||
snippet: zmk-usb-logging
|
||||
```
|
||||
|
||||
When building locally, the `-S`/`--snippet` flag can be passed to `west build` to enable the snippet, e.g.
|
||||
|
||||
```sh
|
||||
west build -b nice_nano_v2 -S zmk-usb-logging -- -DSHIELD="corne_left"
|
||||
```
|
||||
|
||||
### Additional Config
|
||||
|
||||
Logging can be further configured using Kconfig described in [the Zephyr documentation](https://docs.zephyrproject.org/3.5.0/services/logging/index.html).
|
||||
For instance, setting `CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS` to a large value such as `8000` might help catch issues that happen near keyboard
|
||||
boot, before you can connect to view the logs.
|
||||
|
||||
:::note
|
||||
In Github Actions, you can check the `<Keyboard> Kconfig file` step output to verify the options above have been enabled
|
||||
for you successfully.
|
||||
:::
|
||||
|
||||
```ini
|
||||
# Turn on logging, and set ZMK logging to debug output
|
||||
CONFIG_ZMK_USB_LOGGING=y
|
||||
```
|
||||
|
||||
## Viewing Logs
|
||||
|
||||
After flashing the updated ZMK image, the board should expose a USB CDC ACM device that you can connect to and view the logs.
|
||||
|
@ -89,27 +96,29 @@ From there, you should see the various log messages from ZMK and Zephyr, dependi
|
|||
|
||||
Standard boards such as the nice!nano and Seeeduino XIAO family have the necessary configuration for logging already added, however if you are developing your own standalone board you may wish to add the ability to use USB logging in the future.
|
||||
|
||||
To add USB logging to a board you need to define the USB CDC ACM device that the serial output gets piped to, as well as adding the console in the `chosen` node inside `<board>.dts`.
|
||||
To do so, you need to follow the upstream Zephyr [`cdc-acm-console` snippet requirements](https://docs.zephyrproject.org/3.5.0/snippets/cdc-acm-console/README.html#requirements) steps.
|
||||
|
||||
Inside the USB device (`&usbd`), add the CDC ACM node:
|
||||
Usually, this just requires ensuring that the USB node has been tagged with the `zephyr_udc0` label, e.g.
|
||||
|
||||
```dts
|
||||
&usbd {
|
||||
zephyr_udc0: &usbd {
|
||||
status = "okay";
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
Then you can add the `zephyr,console` binding in the `chosen` node:
|
||||
## Enabling Logging on Older Boards
|
||||
|
||||
```dts
|
||||
/ {
|
||||
chosen {
|
||||
...
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
};
|
||||
...
|
||||
};
|
||||
Previously, enabling logging required setting the `CONFIG_ZMK_USB_LOGGING` Kconfig symbol. If for whatever reason
|
||||
a custom board definition does not support the new `zmk-usb-logging` snippet, you can try setting this symbol at the keyboard level, typically in the `config/<your_keyboard>.conf`
|
||||
file if you are using a [user config repository](user-setup.mdx). It can also be enabled at the ZMK level using the `app/prj.conf` file, or other
|
||||
search locations described in the [configuration overview](config/index.md#config-file-locations).
|
||||
|
||||
:::note
|
||||
In Github Actions, you can check the `<Keyboard> Kconfig file` step output to verify the options above have been enabled
|
||||
for you successfully.
|
||||
:::
|
||||
|
||||
```ini
|
||||
# Turn on logging, and set ZMK logging to debug output
|
||||
CONFIG_ZMK_USB_LOGGING=y
|
||||
```
|
||||
|
|
Loading…
Add table
Reference in a new issue