Skip to content

Commit

Permalink
boards: use board common CDC ACM UART configuration
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jfischer-no committed Nov 13, 2024
1 parent c325303 commit 70aa27a
Show file tree
Hide file tree
Showing 55 changed files with 44 additions and 728 deletions.
2 changes: 2 additions & 0 deletions boards/adafruit/feather_nrf52840/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ if BOARD_ADAFRUIT_FEATHER_NRF52840
config BT_CTLR
default BT

source "${ZEPHYR_BASE}/boards/common/usb/Kconfig.cdc_acm_serial"

endif # BOARD_ADAFRUIT_FEATHER_NRF52840
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,12 @@
/dts-v1/;
#include "adafruit_feather_nrf52840_common.dtsi"
#include <nordic/nrf52840_partition_uf2_sdv6.dtsi>
#include <../boards/common/usb/cdc_acm_serial.dts>

/ {
model = "Adafruit Feather nRF52840 Sense";
compatible = "adafruit,feather-nrf52840-sense-uf2";

chosen {
zephyr,console = &cdc_acm_uart0;
zephyr,shell-uart = &cdc_acm_uart0;
zephyr,uart-mcumgr = &cdc_acm_uart0;
zephyr,bt-mon-uart = &cdc_acm_uart0;
zephyr,bt-c2h-uart = &cdc_acm_uart0;
};

leds {
led0: led_0 {
gpios = <&gpio1 9 0>;
Expand All @@ -34,9 +27,3 @@
reg = <0x44>;
};
};

zephyr_udc0: &usbd {
cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,5 @@ CONFIG_UART_CONSOLE=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

# Logger cannot use itself to log
CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF=y

# Enable USB
CONFIG_USB_DEVICE_STACK=y

# Build UF2 by default, supported by the Adafruit nRF52 Bootloader
CONFIG_BUILD_OUTPUT_UF2=y
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,15 @@
/dts-v1/;
#include "adafruit_feather_nrf52840_common.dtsi"
#include <nordic/nrf52840_partition_uf2_sdv6.dtsi>
#include <../boards/common/usb/cdc_acm_serial.dts>

/ {
model = "Adafruit Feather nRF52840 Express";
compatible = "adafruit,feather-nrf52840-uf2";

chosen {
zephyr,console = &cdc_acm_uart0;
zephyr,shell-uart = &cdc_acm_uart0;
zephyr,uart-mcumgr = &cdc_acm_uart0;
zephyr,bt-mon-uart = &cdc_acm_uart0;
zephyr,bt-c2h-uart = &cdc_acm_uart0;
};

leds {
led0: led_0 {
gpios = <&gpio1 15 0>;
};
};
};

zephyr_udc0: &usbd {
cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,5 @@ CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# Logger cannot use itself to log
CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF=y

# Enable USB
CONFIG_USB_DEVICE_STACK=y

# Build UF2 by default, supported by the Adafruit nRF52 Bootloader
CONFIG_BUILD_OUTPUT_UF2=y
9 changes: 0 additions & 9 deletions boards/adafruit/itsybitsy/Kconfig

This file was deleted.

42 changes: 1 addition & 41 deletions boards/adafruit/itsybitsy/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,6 @@ if BOARD_ADAFRUIT_ITSYBITSY
config BT_CTLR
default BT

if BOARD_SERIAL_BACKEND_CDC_ACM

config USB_DEVICE_STACK
default y

config USB_CDC_ACM
default SERIAL

config UART_CONSOLE
default CONSOLE

config USB_DEVICE_INITIALIZE_AT_BOOT
default y if CONSOLE

config SHELL_BACKEND_SERIAL_CHECK_DTR
default SHELL
depends on UART_LINE_CTRL

config UART_LINE_CTRL
default SHELL

config USB_DEVICE_REMOTE_WAKEUP
default n

if LOG

# Logger cannot use itself to log
config USB_CDC_ACM_LOG_LEVEL
default 0

# Set USB log level to error only
config USB_DEVICE_LOG_LEVEL
default 1

# Wait 1500ms at startup for logging
config LOG_PROCESS_THREAD_STARTUP_DELAY_MS
default 1500

endif # LOG

endif # BOARD_SERIAL_BACKEND_CDC_ACM
source "${ZEPHYR_BASE}/boards/common/usb/Kconfig.cdc_acm_serial"

endif # BOARD_ADAFRUIT_ITSYBITSY
10 changes: 1 addition & 9 deletions boards/adafruit/itsybitsy/adafruit_itsybitsy_nrf52840.dts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,13 @@
#include "adafruit_itsybitsy_nrf52840-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <zephyr/dt-bindings/led/led.h>
#include <../boards/common/usb/cdc_acm_serial.dts>

/ {
model = "Adafruit ItsyBitsy nRF52840 Express";
compatible = "adafruit,itsybitsy-nrf52840";

chosen {
zephyr,console = &cdc_acm_uart0;
zephyr,shell-uart = &cdc_acm_uart0;
zephyr,uart-mcumgr = &cdc_acm_uart0;
zephyr,bt-mon-uart = &cdc_acm_uart0;
zephyr,bt-c2h-uart = &cdc_acm_uart0;
zephyr,ieee802154 = &ieee802154;
};

Expand Down Expand Up @@ -155,8 +151,4 @@
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";

cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
};
};
30 changes: 1 addition & 29 deletions boards/arduino/opta/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,6 @@ config NET_L2_ETHERNET

endif # NETWORKING

if USB_DEVICE_STACK

config USB_DEVICE_PRODUCT
default "Arduino Opta"

config USB_DEVICE_PID
default 0x0164

config USB_DEVICE_VID
default 0x35d1

config USB_DEVICE_INITIALIZE_AT_BOOT
default y

if LOG

# Logger cannot use itself to log
choice USB_CDC_ACM_LOG_LEVEL_CHOICE
default USB_CDC_ACM_LOG_LEVEL_OFF
endchoice

# Set USB log level to error only
choice USB_DEVICE_LOG_LEVEL_CHOICE
default USB_DEVICE_LOG_LEVEL_ERR
endchoice

endif # LOG

endif # USB_DEVICE_STACK
source "${ZEPHYR_BASE}/boards/common/usb/Kconfig.cdc_acm_serial"

endif # BOARD_ARDUINO_OPTA
12 changes: 1 addition & 11 deletions boards/arduino/opta/arduino_opta_stm32h747xx_m7.dts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@
#include <st/h7/stm32h747xihx-pinctrl.dtsi>
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include "arduino_opta-common.dtsi"
#include <../boards/common/usb/cdc_acm_serial.dts>

/ {
model = "Arduino OPTA M7 core Programmable Logic Controller";
compatible = "arduino,opta-m7";

chosen {
zephyr,console = &cdc_acm_uart0;
zephyr,shell-uart = &cdc_acm_uart0;
zephyr,cdc-acm-uart0 = &cdc_acm_uart0;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
Expand All @@ -45,10 +43,6 @@ zephyr_udc0: &usbotg_fs {
pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
pinctrl-names = "default";
status = "okay";

cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
};
};

&clk_hse {
Expand Down Expand Up @@ -109,10 +103,6 @@ zephyr_udc0: &usbotg_fs {
status = "disabled";
};

&cdc_acm_uart0 {
status = "okay";
};

&mac {
pinctrl-0 = <
&eth_ref_clk_pa1
Expand Down
3 changes: 0 additions & 3 deletions boards/arduino/opta/arduino_opta_stm32h747xx_m7_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_UART_LINE_CTRL=y

# Enable USB Stack (needed for the console to work)
CONFIG_USB_DEVICE_STACK=y

# Enable regulator (needed to enable eth)
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED=y
30 changes: 1 addition & 29 deletions boards/arduino/portenta_h7/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,6 @@ config NET_L2_ETHERNET

endif # NETWORKING

if USB_DEVICE_STACK

config USB_DEVICE_PRODUCT
default "Arduino SA Portenta H7"

config USB_DEVICE_PID
default 0x035b

config USB_DEVICE_VID
default 0x2341

config USB_DEVICE_INITIALIZE_AT_BOOT
default y

if LOG

# Logger cannot use itself to log
choice USB_CDC_ACM_LOG_LEVEL_CHOICE
default USB_CDC_ACM_LOG_LEVEL_OFF
endchoice

# Set USB log level to error only
choice USB_DEVICE_LOG_LEVEL_CHOICE
default USB_DEVICE_LOG_LEVEL_ERR
endchoice

endif # LOG

endif # USB_DEVICE_STACK
source "${ZEPHYR_BASE}/boards/common/usb/Kconfig.cdc_acm_serial"

endif # BOARD_ARDUINO_PORTENTA_H7
3 changes: 0 additions & 3 deletions boards/arduino/portenta_h7/arduino_portenta_h7-common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,4 @@ zephyr_udc0: &usbotg_hs {
<&rcc STM32_SRC_HSI48 USB_SEL(3)>;
num-bidir-endpoints = < 4 >;
status = "okay";
cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
#include <st/h7/stm32h747Xi_m7.dtsi>
#include <st/h7/stm32h747xihx-pinctrl.dtsi>
#include "arduino_portenta_h7-common.dtsi"
#include <../boards/common/usb/cdc_acm_serial.dts>

/ {
model = "Arduino Portenta H7 board";
compatible = "arduino,portenta-h7";

/* HW resources are split between CM7 and CM4 */
chosen {
zephyr,console = &cdc_acm_uart0;
zephyr,shell-uart = &cdc_acm_uart0;
zephyr,cdc-acm-uart0 = &cdc_acm_uart0;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
Expand Down Expand Up @@ -98,10 +96,6 @@
status = "okay";
};

&cdc_acm_uart0 {
status = "okay";
};

&flash0 {
partitions {
compatible = "fixed-partitions";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,3 @@ CONFIG_UART_LINE_CTRL=y
# Enable regulator
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED=y

# Enable USB Stack
CONFIG_USB_DEVICE_STACK=y
25 changes: 1 addition & 24 deletions boards/atmarktechno/degu_evk/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,6 @@

if BOARD_DEGU_EVK

if USB_DEVICE_STACK

config USB_DEVICE_PRODUCT
default "Degu Evaluation Kit"

config UART_INTERRUPT_DRIVEN
default y

config UART_LINE_CTRL
default y

endif # USB_DEVICE_STACK

if LOG

# Logger cannot use itself to log
config USB_CDC_ACM_LOG_LEVEL
default 0

# Set USB log level to error only
config USB_DEVICE_LOG_LEVEL
default 1

endif # LOG
source "${ZEPHYR_BASE}/boards/common/usb/Kconfig.cdc_acm_serial"

endif # BOARD_DEGU_EVK
7 changes: 1 addition & 6 deletions boards/atmarktechno/degu_evk/degu_evk.dts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <nordic/nrf52840_qiaa.dtsi>
#include "degu_evk-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <../boards/common/usb/cdc_acm_serial.dts>

/ {
model = "Degu Evaluation Kit";
Expand All @@ -16,8 +17,6 @@
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &degu_cdc_acm_uart;
zephyr,shell-uart = &degu_cdc_acm_uart;
zephyr,code-partition = &slot0_partition;
zephyr,ieee802154 = &ieee802154;
};
Expand Down Expand Up @@ -173,8 +172,4 @@
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";

degu_cdc_acm_uart: degu_cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
Loading

0 comments on commit 70aa27a

Please sign in to comment.