diff --git a/samples/subsys/usb/shell/README.rst b/samples/subsys/usb/shell/README.rst index beadad6007bf4..73e16c3b7edba 100644 --- a/samples/subsys/usb/shell/README.rst +++ b/samples/subsys/usb/shell/README.rst @@ -14,23 +14,39 @@ drivers and new USB support. Building and flashing ********************* +The shell can be built with host and/or device stack support by selecting the +:ref:`application-file-suffixes`, where ``-DFILE_SUFFIX=`` selects +``prj_.conf``. + Assuming the board has a supported USB device controller, the example can be built like: .. zephyr-app-commands:: :zephyr-app: samples/subsys/usb/shell :board: reel_board + :gen-args: -DFILE_SUFFIX=device + :goals: flash + :compact: + +Assuming the board has a supported USB host controller, the example can be +built like: + +.. zephyr-app-commands:: + :zephyr-app: samples/subsys/usb/shell + :board: nrf52840dk/nrf52840 + :shield: sparkfun_max3421e + :gen-args: -DFILE_SUFFIX=host :goals: flash :compact: -For the USB host functionality a supported host controller is required, -currently it is only MAX3421E. The example can be built as follows: +Assuming the board has a supported USB device and host controller, +the example can be built like: .. zephyr-app-commands:: :zephyr-app: samples/subsys/usb/shell :board: nrf52840dk/nrf52840 :shield: sparkfun_max3421e - :gen-args: -DCONFIG_UHC_DRIVER=y -DCONFIG_USB_HOST_STACK=y + :gen-args: -DFILE_SUFFIX=device_and_host :goals: flash :compact: @@ -41,7 +57,7 @@ the platform has already defined or not ``zephyr_uhc0`` or ``zephyr_udc0`` nodel .. zephyr-app-commands:: :zephyr-app: samples/subsys/usb/shell :board: nrf52840dk/nrf52840 - :gen-args: -DEXTRA_CONF_FILE=virtual.conf -DDTC_OVERLAY_FILE=virtual.overlay + :gen-args: -DFILE_SUFFIX=device_and_host -DDTC_OVERLAY_FILE=virtual.overlay :goals: flash :compact: diff --git a/samples/subsys/usb/shell/boards/qemu_cortex_m3.conf b/samples/subsys/usb/shell/boards/qemu_cortex_m3.conf deleted file mode 100644 index 58132f17be8c8..0000000000000 --- a/samples/subsys/usb/shell/boards/qemu_cortex_m3.conf +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2022 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_UHC_DRIVER=y -CONFIG_USB_HOST_STACK=y diff --git a/samples/subsys/usb/shell/boards/qemu_cortex_m3.overlay b/samples/subsys/usb/shell/boards/qemu_cortex_m3.overlay deleted file mode 100644 index 5136e0a0b476a..0000000000000 --- a/samples/subsys/usb/shell/boards/qemu_cortex_m3.overlay +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - zephyr_uhc0: uhc_vrt0 { - compatible = "zephyr,uhc-virtual"; - - zephyr_udc0: udc_vrt0 { - compatible = "zephyr,udc-virtual"; - num-bidir-endpoints = <8>; - maximum-speed = "high-speed"; - }; - - udc1: udc_vrt1 { - compatible = "zephyr,udc-virtual"; - num-bidir-endpoints = <8>; - maximum-speed = "full-speed"; - }; - }; -}; diff --git a/samples/subsys/usb/shell/prj.conf b/samples/subsys/usb/shell/prj_device.conf similarity index 100% rename from samples/subsys/usb/shell/prj.conf rename to samples/subsys/usb/shell/prj_device.conf diff --git a/samples/subsys/usb/shell/device_and_host_prj.conf b/samples/subsys/usb/shell/prj_device_and_host.conf similarity index 100% rename from samples/subsys/usb/shell/device_and_host_prj.conf rename to samples/subsys/usb/shell/prj_device_and_host.conf diff --git a/samples/subsys/usb/shell/prj_host.conf b/samples/subsys/usb/shell/prj_host.conf new file mode 100644 index 0000000000000..76bfc777619f9 --- /dev/null +++ b/samples/subsys/usb/shell/prj_host.conf @@ -0,0 +1,8 @@ +CONFIG_SHELL=y + +CONFIG_USB_HOST_STACK=y +CONFIG_USBH_SHELL=y + +CONFIG_LOG=y +CONFIG_USBH_LOG_LEVEL_WRN=y +CONFIG_UHC_DRIVER_LOG_LEVEL_WRN=y diff --git a/samples/subsys/usb/shell/sample.yaml b/samples/subsys/usb/shell/sample.yaml index a0a03a8c4c51b..898f0b5398124 100644 --- a/samples/subsys/usb/shell/sample.yaml +++ b/samples/subsys/usb/shell/sample.yaml @@ -1,10 +1,13 @@ sample: name: USB support shell sample -common: - depends_on: - - usbd tests: sample.usbd.shell: + depends_on: + - usbd + tags: + - usb + extra_args: + - FILE_SUFFIX=device integration_platforms: - nrf52840dk/nrf52840 - nrf54h20dk/nrf54h20/cpuapp @@ -12,20 +15,35 @@ tests: - mimxrt685_evk/mimxrt685s/cm33 - mimxrt1060_evk/mimxrt1062/qspi harness: keyboard - tags: usb sample.usbh.shell: + depends_on: + - usbh + tags: + - usb + extra_args: + - FILE_SUFFIX=host + platform_allow: + - rd_rw612_bga + build_only: true + sample.usbh.shell.shield: + depends_on: + - usbd tags: - usb - shield extra_args: - - CONF_FILE="device_and_host_prj.conf" + - FILE_SUFFIX=device_and_host - SHIELD="sparkfun_max3421e" platform_allow: - nrf52840dk/nrf52840 - frdm_k64f build_only: true sample.usbh.shell.virtual: - tags: usb - extra_args: CONF_FILE="device_and_host_prj.conf" - platform_allow: qemu_cortex_m3 + tags: + - usb + extra_args: + - FILE_SUFFIX=device_and_host + - EXTRA_DTC_OVERLAY_FILE="virtual.overlay" + platform_allow: + - native_sim/native/64 build_only: true diff --git a/samples/subsys/usb/shell/virtual.conf b/samples/subsys/usb/shell/virtual.conf deleted file mode 100644 index 58132f17be8c8..0000000000000 --- a/samples/subsys/usb/shell/virtual.conf +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2022 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_UHC_DRIVER=y -CONFIG_USB_HOST_STACK=y