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 Dec 12, 2024
1 parent d422cee commit 5f39baa
Show file tree
Hide file tree
Showing 60 changed files with 70 additions and 747 deletions.
6 changes: 6 additions & 0 deletions boards/adafruit/feather_nrf52840/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@

if BOARD_ADAFRUIT_FEATHER_NRF52840

if BOARD_ADAFRUIT_FEATHER_NRF52840_NRF52840_UF2 || BOARD_ADAFRUIT_FEATHER_NRF52840_NRF52840_SENSE_UF2

source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig"

endif

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.dtsi>

/ {
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.dtsi>

/ {
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 @@ -5,46 +5,6 @@

if BOARD_ADAFRUIT_ITSYBITSY

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 "boards/common/usb/Kconfig.cdc_acm_serial.defconfig"

endif # BOARD_ADAFRUIT_ITSYBITSY
11 changes: 2 additions & 9 deletions boards/adafruit/itsybitsy/adafruit_itsybitsy_nrf52840.dts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
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 +150,6 @@
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";

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

#include <../boards/common/usb/cdc_acm_serial.dtsi>
30 changes: 3 additions & 27 deletions boards/arduino/opta/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,10 @@ config NET_L2_ETHERNET

endif # NETWORKING

if USB_DEVICE_STACK
if BOARD_ARDUINO_OPTA_STM32H747XX_M7

config USB_DEVICE_PRODUCT
default "Arduino Opta"
source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig"

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
endif # BOARD_ARDUINO_OPTA_STM32H747XX_M7

endif # BOARD_ARDUINO_OPTA
14 changes: 2 additions & 12 deletions boards/arduino/opta/arduino_opta_stm32h747xx_m7.dts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
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 @@ -29,12 +26,10 @@ 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";
};
};

#include <../boards/common/usb/cdc_acm_serial.dtsi>

&clk_hse {
clock-frequency = <DT_FREQ_M(25)>;
hse-bypass;
Expand Down Expand Up @@ -126,8 +121,3 @@ zephyr_udc0: &usbotg_fs {
status = "okay";
};
};

/* Assign USB serial (ACM) to M7 to have a working console out of the box */
&cdc_acm_uart0 {
status = "okay";
};
5 changes: 3 additions & 2 deletions boards/arduino/opta/arduino_opta_stm32h747xx_m7_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=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: 3 additions & 27 deletions boards/arduino/portenta_h7/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,10 @@ config NET_L2_ETHERNET

endif # NETWORKING

if USB_DEVICE_STACK
if BOARD_ARDUINO_PORTENTA_H7_STM32H747XX_M7

config USB_DEVICE_PRODUCT
default "Arduino SA Portenta H7"
source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig"

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
endif # BOARD_ARDUINO_PORTENTA_H7_STM32H747XX_M7

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.dtsi>

/ {
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 @@ -25,6 +25,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 "boards/common/usb/Kconfig.cdc_acm_serial.defconfig"

endif # BOARD_DEGU_EVK
8 changes: 2 additions & 6 deletions boards/atmarktechno/degu_evk/degu_evk.dts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,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 +171,6 @@
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";

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

#include <../boards/common/usb/cdc_acm_serial.dtsi>
Loading

0 comments on commit 5f39baa

Please sign in to comment.