From f13ae0fc08d37066a805d4a08e5859df45df9b9d Mon Sep 17 00:00:00 2001 From: Tomas Rezucha Date: Fri, 19 Jan 2024 14:38:30 +0100 Subject: [PATCH] feat(esp32p4): Add USB-OTG support for ESP32-P4 --- components/hal/CMakeLists.txt | 7 ++-- components/soc/CMakeLists.txt | 6 ++- .../esp32p4/include/soc/Kconfig.soc_caps.in | 4 ++ components/soc/esp32p4/include/soc/soc_caps.h | 1 + components/soc/esp32p4/include/soc/usb_pins.h | 20 +++++++++ components/usb/CMakeLists.txt | 8 +++- components/usb/include/esp_private/usb_phy.h | 2 +- .../usb/test_apps/.build-test-rules.yml | 9 ++++ components/usb/test_apps/hcd/README.md | 4 +- .../usb/test_apps/hcd/pytest_usb_hcd.py | 5 ++- components/usb/test_apps/usb_host/README.md | 4 +- .../usb/test_apps/usb_host/pytest_usb_host.py | 5 ++- components/usb/usb_phy_p4.c | 30 ++++++++++++++ docs/conf_common.py | 17 ++++---- docs/doxygen/Doxyfile_esp32p4 | 4 ++ docs/en/api-guides/index.rst | 4 +- docs/zh_CN/api-guides/index.rst | 4 +- examples/peripherals/.build-test-rules.yml | 41 +++++++++++++++---- .../CMakeLists.txt | 1 + .../tusb_composite_msc_serialdevice/README.md | 4 +- .../pytest_usb_device_composite.py | 3 ++ .../usb/device/tusb_console/CMakeLists.txt | 1 + .../usb/device/tusb_console/README.md | 4 +- .../tusb_console/pytest_usb_device_console.py | 3 ++ .../peripherals/usb/device/tusb_hid/README.md | 4 +- .../device/tusb_hid/pytest_usb_device_hid.py | 3 ++ .../usb/device/tusb_midi/README.md | 4 +- .../tusb_midi/pytest_usb_device_midi.py | 3 ++ .../peripherals/usb/device/tusb_msc/README.md | 4 +- .../device/tusb_msc/pytest_usb_device_msc.py | 3 ++ .../device/tusb_ncm/pytest_usb_device_ncm.py | 2 + .../device/tusb_serial_device/CMakeLists.txt | 1 + .../usb/device/tusb_serial_device/README.md | 4 +- .../pytest_usb_device_serial.py | 3 ++ .../usb/host/cdc/cdc_acm_host/README.md | 4 +- .../usb/host/cdc/cdc_acm_vcp/README.md | 4 +- examples/peripherals/usb/host/hid/README.md | 4 +- examples/peripherals/usb/host/msc/README.md | 4 +- .../usb/host/msc/pytest_usb_host_msc.py | 5 ++- .../usb/host/usb_host_lib/README.md | 6 +-- examples/peripherals/usb/host/uvc/README.md | 4 +- .../usb/host/uvc/sdkconfig.defaults | 6 --- .../usb/host/uvc/sdkconfig.defaults.esp32s2 | 9 ++++ .../usb/host/uvc/sdkconfig.defaults.esp32s3 | 9 ++++ examples/system/.build-test-rules.yml | 2 +- 45 files changed, 208 insertions(+), 71 deletions(-) create mode 100644 components/soc/esp32p4/include/soc/usb_pins.h create mode 100644 components/usb/usb_phy_p4.c create mode 100644 examples/peripherals/usb/host/uvc/sdkconfig.defaults.esp32s2 create mode 100644 examples/peripherals/usb/host/uvc/sdkconfig.defaults.esp32s3 diff --git a/components/hal/CMakeLists.txt b/components/hal/CMakeLists.txt index 1adf4f90f6..5469ed64bf 100644 --- a/components/hal/CMakeLists.txt +++ b/components/hal/CMakeLists.txt @@ -248,9 +248,10 @@ if(NOT BOOTLOADER_BUILD) endif() if(CONFIG_SOC_USB_OTG_SUPPORTED) - list(APPEND srcs - "usb_dwc_hal.c" - "usb_fsls_phy_hal.c") + list(APPEND srcs "usb_dwc_hal.c") + if(NOT ${target} STREQUAL "esp32p4") + list(APPEND srcs "usb_fsls_phy_hal.c") + endif() endif() if(${target} STREQUAL "esp32") diff --git a/components/soc/CMakeLists.txt b/components/soc/CMakeLists.txt index 00887b69d5..7dd580e136 100644 --- a/components/soc/CMakeLists.txt +++ b/components/soc/CMakeLists.txt @@ -114,8 +114,10 @@ if(CONFIG_SOC_IEEE802154_SUPPORTED) endif() if(CONFIG_SOC_USB_OTG_SUPPORTED) - list(APPEND srcs "${target}/usb_periph.c" - "${target}/usb_dwc_periph.c") + if(NOT ${target} STREQUAL "esp32p4") + list(APPEND srcs "${target}/usb_periph.c" + "${target}/usb_dwc_periph.c") + endif() endif() if(CONFIG_SOC_DAC_SUPPORTED) diff --git a/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in b/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in index d26c2659f3..26125903bf 100644 --- a/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in @@ -63,6 +63,10 @@ config SOC_EMAC_SUPPORTED bool default y +config SOC_USB_OTG_SUPPORTED + bool + default y + config SOC_TEMP_SENSOR_SUPPORTED bool default y diff --git a/components/soc/esp32p4/include/soc/soc_caps.h b/components/soc/esp32p4/include/soc/soc_caps.h index c7edab97dd..63ca436f42 100644 --- a/components/soc/esp32p4/include/soc/soc_caps.h +++ b/components/soc/esp32p4/include/soc/soc_caps.h @@ -36,6 +36,7 @@ // #define SOC_PARLIO_SUPPORTED 1 //TODO: IDF-7471 #define SOC_ASYNC_MEMCPY_SUPPORTED 1 #define SOC_EMAC_SUPPORTED 1 +#define SOC_USB_OTG_SUPPORTED 1 // disable usb serial jtag for esp32p4, current image does not support // #define SOC_USB_SERIAL_JTAG_SUPPORTED 1 //TODO: IDF-7496 #define SOC_TEMP_SENSOR_SUPPORTED 1 diff --git a/components/soc/esp32p4/include/soc/usb_pins.h b/components/soc/esp32p4/include/soc/usb_pins.h new file mode 100644 index 0000000000..bbcb7c3ca4 --- /dev/null +++ b/components/soc/esp32p4/include/soc/usb_pins.h @@ -0,0 +1,20 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +/* +Note: These macros are deprecated. +We define them for P4 only for backward compatibility with older version of esp_tinyusb + +Todo: Remove in IDF v6.0 (IDF-9029) +*/ +#define USBPHY_VP_NUM -1 +#define USBPHY_VM_NUM -1 +#define USBPHY_RCV_NUM -1 +#define USBPHY_OEN_NUM -1 +#define USBPHY_VPO_NUM -1 +#define USBPHY_VMO_NUM -1 diff --git a/components/usb/CMakeLists.txt b/components/usb/CMakeLists.txt index d2a7cbefde..774177d033 100644 --- a/components/usb/CMakeLists.txt +++ b/components/usb/CMakeLists.txt @@ -18,8 +18,12 @@ if(CONFIG_SOC_USB_OTG_SUPPORTED) "usb_helpers.c" "usb_host.c" "usb_private.c" - "usbh.c" - "usb_phy.c") + "usbh.c") + if(NOT ${target} STREQUAL "esp32p4") + list(APPEND srcs "usb_phy.c") + else() + list(APPEND srcs "usb_phy_p4.c") + endif() list(APPEND include "include") list(APPEND priv_includes "private_include") endif() diff --git a/components/usb/include/esp_private/usb_phy.h b/components/usb/include/esp_private/usb_phy.h index 7848e7cdba..65ad137b72 100644 --- a/components/usb/include/esp_private/usb_phy.h +++ b/components/usb/include/esp_private/usb_phy.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include "esp_err.h" #include "soc/soc_caps.h" #include "hal/usb_phy_types.h" diff --git a/components/usb/test_apps/.build-test-rules.yml b/components/usb/test_apps/.build-test-rules.yml index 77a723b155..9406f23a66 100644 --- a/components/usb/test_apps/.build-test-rules.yml +++ b/components/usb/test_apps/.build-test-rules.yml @@ -3,8 +3,17 @@ components/usb/test_apps: enable: - if: SOC_USB_OTG_SUPPORTED == 1 + disable_test: + - if: IDF_TARGET not in ["esp32s3"] + temporary: true + reason: lack of runners with usb_host_flash_disk tag depends_components: - usb depends_filepatterns: - components/hal/usb*.c + - components/hal/include/hal/usb*.h - components/hal/esp32*/include/hal/usb*.h + - components/soc/esp32*/usb*.c + - components/soc/include/soc/usb*.h + - components/soc/esp32*/include/soc/usb_dwc_*.h + - components/soc/esp32*/include/soc/usb_wrap_*.h diff --git a/components/usb/test_apps/hcd/README.md b/components/usb/test_apps/hcd/README.md index 8dad6d2f95..01e95ae973 100644 --- a/components/usb/test_apps/hcd/README.md +++ b/components/usb/test_apps/hcd/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB: Host test application diff --git a/components/usb/test_apps/hcd/pytest_usb_hcd.py b/components/usb/test_apps/hcd/pytest_usb_hcd.py index d91f79b14e..8498cb2403 100644 --- a/components/usb/test_apps/hcd/pytest_usb_hcd.py +++ b/components/usb/test_apps/hcd/pytest_usb_hcd.py @@ -1,12 +1,13 @@ -# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 - import pytest from pytest_embedded import Dut @pytest.mark.esp32s2 @pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s2', 'esp32p4'], reason='lack of runners with usb_host_flash_disk tag') @pytest.mark.usb_host_flash_disk def test_usb_hcd(dut: Dut) -> None: dut.run_all_single_board_cases(group='full_speed') diff --git a/components/usb/test_apps/usb_host/README.md b/components/usb/test_apps/usb_host/README.md index 98dda595dc..afe40d8da3 100644 --- a/components/usb/test_apps/usb_host/README.md +++ b/components/usb/test_apps/usb_host/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB: Host test application diff --git a/components/usb/test_apps/usb_host/pytest_usb_host.py b/components/usb/test_apps/usb_host/pytest_usb_host.py index 7a6a5740c7..63025a6a3a 100644 --- a/components/usb/test_apps/usb_host/pytest_usb_host.py +++ b/components/usb/test_apps/usb_host/pytest_usb_host.py @@ -1,12 +1,13 @@ -# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 - import pytest from pytest_embedded import Dut @pytest.mark.esp32s2 @pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s2', 'esp32p4'], reason='lack of runners with usb_host_flash_disk tag') @pytest.mark.usb_host_flash_disk def test_usb_host(dut: Dut) -> None: dut.run_all_single_board_cases(group='full_speed') diff --git a/components/usb/usb_phy_p4.c b/components/usb/usb_phy_p4.c new file mode 100644 index 0000000000..cff6420e08 --- /dev/null +++ b/components/usb/usb_phy_p4.c @@ -0,0 +1,30 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +// This is only a dummy USB PHY file for successful linking of ESP32-P4 target +// The internal HS PHY is enabled by default, therefore it needs no configuration +// TODO: Remove this file when proper support of P4 PHYs is implemented IDF-7323 +#include "esp_private/usb_phy.h" + +esp_err_t usb_new_phy(const usb_phy_config_t *config, usb_phy_handle_t *handle_ret) +{ + return ESP_OK; +} + +esp_err_t usb_del_phy(usb_phy_handle_t handle) +{ + return ESP_OK; +} + +esp_err_t usb_phy_get_phy_status(usb_phy_target_t target, usb_phy_status_t *status) +{ + return ESP_OK; +} + +esp_err_t usb_phy_action(usb_phy_handle_t handle, usb_phy_action_t action) +{ + return ESP_OK; +} diff --git a/docs/conf_common.py b/docs/conf_common.py index 032e88a54a..d9c0aa4576 100644 --- a/docs/conf_common.py +++ b/docs/conf_common.py @@ -4,13 +4,9 @@ # # This file is imported from a language-specific conf.py (ie en/conf.py or # zh_CN/conf.py) - # type: ignore # pylint: disable=wildcard-import # pylint: disable=undefined-variable - -from __future__ import print_function, unicode_literals - import os.path import re from pathlib import Path @@ -113,9 +109,12 @@ USB_DOCS = ['api-reference/peripherals/usb_device.rst', 'api-reference/peripherals/usb_host/usb_host_notes_arch.rst', 'api-reference/peripherals/usb_host/usb_host_notes_design.rst', 'api-reference/peripherals/usb_host/usb_host_notes_dwc_otg.rst', - 'api-reference/peripherals/usb_host/usb_host_notes_index.rst', - 'api-guides/usb-otg-console.rst', - 'api-guides/dfu.rst'] + 'api-reference/peripherals/usb_host/usb_host_notes_index.rst'] + +# TODO: Merge this back with `USB_DOCS` IDF-9919 IDF-9920 IDF-9133 +USB_OTG_DFU_DOCS = ['api-guides/dfu.rst'] + +USB_OTG_CONSOLE_DOCS = ['api-guides/usb-otg-console.rst'] FTDI_JTAG_DOCS = ['api-guides/jtag-debugging/configure-ft2232h-jtag.rst'] @@ -168,13 +167,13 @@ ESP32S2_DOCS = ['hw-reference/esp32s2/**', 'api-reference/peripherals/temp_sensor.rst', 'api-reference/system/async_memcpy.rst', 'api-reference/peripherals/touch_element.rst', - 'api-guides/RF_calibration.rst'] + FTDI_JTAG_DOCS + 'api-guides/RF_calibration.rst'] + FTDI_JTAG_DOCS + USB_OTG_DFU_DOCS + USB_OTG_CONSOLE_DOCS ESP32S3_DOCS = ['hw-reference/esp32s3/**', 'api-reference/system/ipc.rst', 'api-guides/flash_psram_config.rst', 'api-reference/peripherals/sd_pullup_requirements.rst', - 'api-guides/RF_calibration.rst'] + 'api-guides/RF_calibration.rst'] + USB_OTG_DFU_DOCS + USB_OTG_CONSOLE_DOCS # No JTAG docs for this one as it gets gated on SOC_USB_SERIAL_JTAG_SUPPORTED down below. ESP32C3_DOCS = ['hw-reference/esp32c3/**', diff --git a/docs/doxygen/Doxyfile_esp32p4 b/docs/doxygen/Doxyfile_esp32p4 index a2f272484f..2d373662b7 100644 --- a/docs/doxygen/Doxyfile_esp32p4 +++ b/docs/doxygen/Doxyfile_esp32p4 @@ -8,3 +8,7 @@ INPUT += \ $(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_uart.h \ $(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_utils.h \ $(PROJECT_PATH)/components/ulp/ulp_common/include/ulp_common.h \ + $(PROJECT_PATH)/components/usb/include/usb/usb_helpers.h \ + $(PROJECT_PATH)/components/usb/include/usb/usb_host.h \ + $(PROJECT_PATH)/components/usb/include/usb/usb_types_ch9.h \ + $(PROJECT_PATH)/components/usb/include/usb/usb_types_stack.h \ diff --git a/docs/en/api-guides/index.rst b/docs/en/api-guides/index.rst index c3ceeeb058..5f13efe0c7 100644 --- a/docs/en/api-guides/index.rst +++ b/docs/en/api-guides/index.rst @@ -17,7 +17,7 @@ API Guides core_dump current-consumption-measurement-modules :SOC_RTC_MEM_SUPPORTED: deep-sleep-stub - :SOC_USB_OTG_SUPPORTED: dfu + :SOC_USB_OTG_SUPPORTED and not esp32p4: dfu error-handling :SOC_BLE_MESH_SUPPORTED: esp-ble-mesh/ble-mesh-index :SOC_WIFI_MESH_SUPPORT: esp-wifi-mesh @@ -39,7 +39,7 @@ API Guides tools/index unit-tests host-apps - :SOC_USB_OTG_SUPPORTED: usb-otg-console + :SOC_USB_OTG_SUPPORTED and not esp32p4: usb-otg-console :SOC_USB_SERIAL_JTAG_SUPPORTED: usb-serial-jtag-console :SOC_WIFI_SUPPORTED: wifi :SOC_WIFI_SUPPORTED: wifi-security diff --git a/docs/zh_CN/api-guides/index.rst b/docs/zh_CN/api-guides/index.rst index 5896478b9b..0ddbb1574e 100644 --- a/docs/zh_CN/api-guides/index.rst +++ b/docs/zh_CN/api-guides/index.rst @@ -17,7 +17,7 @@ API 指南 core_dump current-consumption-measurement-modules :SOC_RTC_MEM_SUPPORTED: deep-sleep-stub - :SOC_USB_OTG_SUPPORTED: dfu + :SOC_USB_OTG_SUPPORTED and not esp32p4: dfu error-handling :SOC_BLE_MESH_SUPPORTED: esp-ble-mesh/ble-mesh-index :SOC_WIFI_MESH_SUPPORT: esp-wifi-mesh @@ -39,7 +39,7 @@ API 指南 tools/index unit-tests host-apps - :SOC_USB_OTG_SUPPORTED: usb-otg-console + :SOC_USB_OTG_SUPPORTED and not esp32p4: usb-otg-console :SOC_USB_SERIAL_JTAG_SUPPORTED: usb-serial-jtag-console :SOC_WIFI_SUPPORTED: wifi :SOC_WIFI_SUPPORTED: wifi-security diff --git a/examples/peripherals/.build-test-rules.yml b/examples/peripherals/.build-test-rules.yml index ea2d3e6786..49048003fd 100644 --- a/examples/peripherals/.build-test-rules.yml +++ b/examples/peripherals/.build-test-rules.yml @@ -421,24 +421,49 @@ examples/peripherals/uart/uart_echo_rs485: enable: - if: INCLUDE_DEFAULT == 1 -examples/peripherals/usb: +examples/peripherals/usb/device: disable: - if: SOC_USB_OTG_SUPPORTED != 1 - -examples/peripherals/usb/device: - enable: - - if: SOC_USB_OTG_SUPPORTED == 1 disable_test: - - if: IDF_TARGET == "esp32s3" + - if: IDF_TARGET not in ["esp32s2"] temporary: true - reason: lack of runners + reason: lack of runners with usb_device tag + depends_components: + - usb + depends_filepatterns: + - examples/peripherals/usb/device/**/* + +examples/peripherals/usb/device/tusb_ncm: + disable: + - if: SOC_USB_OTG_SUPPORTED != 1 or SOC_WIFI_SUPPORTED != 1 + disable_test: + - if: IDF_TARGET not in ["esp32s2"] + temporary: true + reason: lack of runners with usb_device tag + depends_components: + - usb + - esp_wifi + depends_filepatterns: + - examples/peripherals/usb/device/tusb_ncm/**/* + +examples/peripherals/usb/host: + disable: + - if: SOC_USB_OTG_SUPPORTED != 1 + disable_test: + - if: IDF_TARGET not in ["esp32s3"] + temporary: true + reason: lack of runners with usb_host_flash_disk tag depends_components: - usb depends_filepatterns: - components/hal/usb*.c + - components/hal/include/hal/usb*.h - components/hal/esp32*/include/hal/usb*.h + - components/soc/esp32*/usb*.c + - components/soc/include/soc/usb*.h + - components/soc/esp32*/include/soc/usb_dwc_*.h + - components/soc/esp32*/include/soc/usb_wrap_*.h - examples/peripherals/usb/host/**/* - - examples/peripherals/usb/device/**/* examples/peripherals/usb_serial_jtag/usb_serial_jtag_echo: disable: diff --git a/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/CMakeLists.txt b/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/CMakeLists.txt index c3c65dae94..9cfe2365c2 100644 --- a/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/CMakeLists.txt +++ b/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/CMakeLists.txt @@ -4,6 +4,7 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.16) +add_compile_options(-w) # Turn off warnings until esp_tinyusb is updated IEC-86 # "Trim" the build. Include the minimal set of components, main, and anything it depends on. set(COMPONENTS main) include($ENV{IDF_PATH}/tools/cmake/project.cmake) diff --git a/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/README.md b/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/README.md index d7bff1f7cf..a7a32c4567 100644 --- a/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/README.md +++ b/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # TinyUSB Composite Device (MSC + Serial) Example diff --git a/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/pytest_usb_device_composite.py b/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/pytest_usb_device_composite.py index 6adfa49573..843b703128 100644 --- a/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/pytest_usb_device_composite.py +++ b/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/pytest_usb_device_composite.py @@ -9,6 +9,9 @@ from serial.tools.list_ports import comports @pytest.mark.esp32s2 +@pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s3', 'esp32p4'], reason='lack of runners with usb_device tag') @pytest.mark.usb_device def test_usb_composite_device_serial_example(dut: Dut) -> None: dut.expect_exact('Hello World!') diff --git a/examples/peripherals/usb/device/tusb_console/CMakeLists.txt b/examples/peripherals/usb/device/tusb_console/CMakeLists.txt index 37eb8efa98..261df3fb6e 100644 --- a/examples/peripherals/usb/device/tusb_console/CMakeLists.txt +++ b/examples/peripherals/usb/device/tusb_console/CMakeLists.txt @@ -2,6 +2,7 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.16) +add_compile_options(-w) # Turn off warnings until esp_tinyusb is updated IEC-86 # "Trim" the build. Include the minimal set of components, main, and anything it depends on. set(COMPONENTS main) include($ENV{IDF_PATH}/tools/cmake/project.cmake) diff --git a/examples/peripherals/usb/device/tusb_console/README.md b/examples/peripherals/usb/device/tusb_console/README.md index f86ee66266..aeccaab251 100644 --- a/examples/peripherals/usb/device/tusb_console/README.md +++ b/examples/peripherals/usb/device/tusb_console/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # TinyUSB Sample Descriptor diff --git a/examples/peripherals/usb/device/tusb_console/pytest_usb_device_console.py b/examples/peripherals/usb/device/tusb_console/pytest_usb_device_console.py index 0cd523dad9..b32b19f5d8 100644 --- a/examples/peripherals/usb/device/tusb_console/pytest_usb_device_console.py +++ b/examples/peripherals/usb/device/tusb_console/pytest_usb_device_console.py @@ -9,6 +9,9 @@ from serial.tools.list_ports import comports @pytest.mark.esp32s2 +@pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s3', 'esp32p4'], reason='lack of runners with usb_device tag') @pytest.mark.usb_device def test_usb_device_console_example(dut: Dut) -> None: dut.expect_exact('USB initialization DONE') diff --git a/examples/peripherals/usb/device/tusb_hid/README.md b/examples/peripherals/usb/device/tusb_hid/README.md index f0c1b79487..e784742510 100644 --- a/examples/peripherals/usb/device/tusb_hid/README.md +++ b/examples/peripherals/usb/device/tusb_hid/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # TinyUSB Human Interface Device Example diff --git a/examples/peripherals/usb/device/tusb_hid/pytest_usb_device_hid.py b/examples/peripherals/usb/device/tusb_hid/pytest_usb_device_hid.py index f38b3a7415..d3b41ff038 100644 --- a/examples/peripherals/usb/device/tusb_hid/pytest_usb_device_hid.py +++ b/examples/peripherals/usb/device/tusb_hid/pytest_usb_device_hid.py @@ -5,6 +5,9 @@ from pytest_embedded import Dut @pytest.mark.esp32s2 +@pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s3', 'esp32p4'], reason='lack of runners with usb_device tag') @pytest.mark.usb_device def test_usb_device_hid_example(dut: Dut) -> None: dut.expect_exact('USB initialization DONE') diff --git a/examples/peripherals/usb/device/tusb_midi/README.md b/examples/peripherals/usb/device/tusb_midi/README.md index f510b15366..7007230dfe 100644 --- a/examples/peripherals/usb/device/tusb_midi/README.md +++ b/examples/peripherals/usb/device/tusb_midi/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # TinyUSB MIDI Device Example diff --git a/examples/peripherals/usb/device/tusb_midi/pytest_usb_device_midi.py b/examples/peripherals/usb/device/tusb_midi/pytest_usb_device_midi.py index b0b55a1f28..2e9c7d05ba 100644 --- a/examples/peripherals/usb/device/tusb_midi/pytest_usb_device_midi.py +++ b/examples/peripherals/usb/device/tusb_midi/pytest_usb_device_midi.py @@ -5,6 +5,9 @@ from pytest_embedded import Dut @pytest.mark.esp32s2 +@pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s3', 'esp32p4'], reason='lack of runners with usb_device tag') @pytest.mark.usb_device def test_usb_device_midi_example(dut: Dut) -> None: dut.expect_exact('USB initialization DONE') diff --git a/examples/peripherals/usb/device/tusb_msc/README.md b/examples/peripherals/usb/device/tusb_msc/README.md index 721840c3ea..134b2ecba2 100644 --- a/examples/peripherals/usb/device/tusb_msc/README.md +++ b/examples/peripherals/usb/device/tusb_msc/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # TinyUSB Mass Storage Device Example diff --git a/examples/peripherals/usb/device/tusb_msc/pytest_usb_device_msc.py b/examples/peripherals/usb/device/tusb_msc/pytest_usb_device_msc.py index 68a7e34cf0..dc730667b8 100644 --- a/examples/peripherals/usb/device/tusb_msc/pytest_usb_device_msc.py +++ b/examples/peripherals/usb/device/tusb_msc/pytest_usb_device_msc.py @@ -5,6 +5,9 @@ from pytest_embedded import Dut @pytest.mark.esp32s2 +@pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s3', 'esp32p4'], reason='lack of runners with usb_device tag') @pytest.mark.usb_device def test_usb_device_msc_example(dut: Dut) -> None: dut.expect('Mount storage') diff --git a/examples/peripherals/usb/device/tusb_ncm/pytest_usb_device_ncm.py b/examples/peripherals/usb/device/tusb_ncm/pytest_usb_device_ncm.py index 96685127bc..e31841b8b9 100644 --- a/examples/peripherals/usb/device/tusb_ncm/pytest_usb_device_ncm.py +++ b/examples/peripherals/usb/device/tusb_ncm/pytest_usb_device_ncm.py @@ -8,6 +8,8 @@ from pytest_embedded import Dut @pytest.mark.esp32s2 +@pytest.mark.esp32s3 +@pytest.mark.temp_skip_ci(targets=['esp32s3'], reason='lack of runners with usb_device tag') @pytest.mark.usb_device def test_usb_device_ncm_example(dut: Dut) -> None: netif_mac = dut.expect(r'Network interface HW address: ([0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2})') diff --git a/examples/peripherals/usb/device/tusb_serial_device/CMakeLists.txt b/examples/peripherals/usb/device/tusb_serial_device/CMakeLists.txt index f46c3b7541..319eb01822 100644 --- a/examples/peripherals/usb/device/tusb_serial_device/CMakeLists.txt +++ b/examples/peripherals/usb/device/tusb_serial_device/CMakeLists.txt @@ -2,6 +2,7 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.16) +add_compile_options(-w) # Turn off warnings until esp_tinyusb is updated IEC-86 # "Trim" the build. Include the minimal set of components, main, and anything it depends on. set(COMPONENTS main) include($ENV{IDF_PATH}/tools/cmake/project.cmake) diff --git a/examples/peripherals/usb/device/tusb_serial_device/README.md b/examples/peripherals/usb/device/tusb_serial_device/README.md index 8a28f426dd..60ef9a9b44 100644 --- a/examples/peripherals/usb/device/tusb_serial_device/README.md +++ b/examples/peripherals/usb/device/tusb_serial_device/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # TinyUSB Serial Device Example diff --git a/examples/peripherals/usb/device/tusb_serial_device/pytest_usb_device_serial.py b/examples/peripherals/usb/device/tusb_serial_device/pytest_usb_device_serial.py index bcf6c90203..545b4ee3a4 100644 --- a/examples/peripherals/usb/device/tusb_serial_device/pytest_usb_device_serial.py +++ b/examples/peripherals/usb/device/tusb_serial_device/pytest_usb_device_serial.py @@ -9,6 +9,9 @@ from serial.tools.list_ports import comports @pytest.mark.esp32s2 +@pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s3', 'esp32p4'], reason='lack of runners with usb_device tag') @pytest.mark.usb_device def test_usb_device_serial_example(dut: Dut) -> None: dut.expect_exact('USB initialization DONE') diff --git a/examples/peripherals/usb/host/cdc/cdc_acm_host/README.md b/examples/peripherals/usb/host/cdc/cdc_acm_host/README.md index c4af5faabe..8f1d6652ff 100644 --- a/examples/peripherals/usb/host/cdc/cdc_acm_host/README.md +++ b/examples/peripherals/usb/host/cdc/cdc_acm_host/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB CDC-ACM Host Driver Example diff --git a/examples/peripherals/usb/host/cdc/cdc_acm_vcp/README.md b/examples/peripherals/usb/host/cdc/cdc_acm_vcp/README.md index 71fdfb331d..23193375d1 100644 --- a/examples/peripherals/usb/host/cdc/cdc_acm_vcp/README.md +++ b/examples/peripherals/usb/host/cdc/cdc_acm_vcp/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB CDC-ACM Virtual COM Port example diff --git a/examples/peripherals/usb/host/hid/README.md b/examples/peripherals/usb/host/hid/README.md index 182ad685b9..281c1805f0 100644 --- a/examples/peripherals/usb/host/hid/README.md +++ b/examples/peripherals/usb/host/hid/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB HID Class example This example implements a basic USB Host HID Class Driver, and demonstrates how to use the driver to communicate with USB HID devices (such as Keyboard and Mouse or both) on the ESP32-S2/S3. Currently, the example only supports the HID boot protocol which should be present on most USB Mouse and Keyboards. The example will continuously scan for the connection of any HID Mouse or Keyboard, and attempt to fetch HID reports from those devices once connected. To quit the example (and shut down the HID driver), users can GPIO0 to low (i.e., pressing the "Boot" button on most ESP dev kits). diff --git a/examples/peripherals/usb/host/msc/README.md b/examples/peripherals/usb/host/msc/README.md index 873554fa9a..94fe45587a 100644 --- a/examples/peripherals/usb/host/msc/README.md +++ b/examples/peripherals/usb/host/msc/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB Mass Storage Class example diff --git a/examples/peripherals/usb/host/msc/pytest_usb_host_msc.py b/examples/peripherals/usb/host/msc/pytest_usb_host_msc.py index 7447422629..44e1444b3b 100644 --- a/examples/peripherals/usb/host/msc/pytest_usb_host_msc.py +++ b/examples/peripherals/usb/host/msc/pytest_usb_host_msc.py @@ -1,5 +1,4 @@ - -# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 import pytest from pytest_embedded import Dut @@ -7,6 +6,8 @@ from pytest_embedded import Dut @pytest.mark.esp32s2 @pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s2', 'esp32p4'], reason='lack of runners with usb_host_flash_disk tag') @pytest.mark.usb_host_flash_disk def test_usb_host_msc_example(dut: Dut) -> None: # Check result of file_operations() diff --git a/examples/peripherals/usb/host/usb_host_lib/README.md b/examples/peripherals/usb/host/usb_host_lib/README.md index bb60eab111..a391aedd9b 100644 --- a/examples/peripherals/usb/host/usb_host_lib/README.md +++ b/examples/peripherals/usb/host/usb_host_lib/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB Host Library Example @@ -193,4 +193,4 @@ The log output demonstrates a device that has failed. The Hub Driver will output ### Blank String Descriptors -The current USB Host Library will automatically cache the Manufacturer, Product, and Serial Number string descriptors of the device during enumeration. However, when fetching the string descriptors, the USB Host Library will only fetch those strings descriptors of they of LANGID code 0x0409 (i.e., English - United States). Therefore, if the example does not print a particular descriptor, it is likely that the string descriptor was not cached during enumeration. \ No newline at end of file +The current USB Host Library will automatically cache the Manufacturer, Product, and Serial Number string descriptors of the device during enumeration. However, when fetching the string descriptors, the USB Host Library will only fetch those strings descriptors of they of LANGID code 0x0409 (i.e., English - United States). Therefore, if the example does not print a particular descriptor, it is likely that the string descriptor was not cached during enumeration. diff --git a/examples/peripherals/usb/host/uvc/README.md b/examples/peripherals/usb/host/uvc/README.md index 06f908e0b0..3fab9cf610 100644 --- a/examples/peripherals/usb/host/uvc/README.md +++ b/examples/peripherals/usb/host/uvc/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB Camera Example diff --git a/examples/peripherals/usb/host/uvc/sdkconfig.defaults b/examples/peripherals/usb/host/uvc/sdkconfig.defaults index 5d25a8f16c..ffa47d42e8 100644 --- a/examples/peripherals/usb/host/uvc/sdkconfig.defaults +++ b/examples/peripherals/usb/host/uvc/sdkconfig.defaults @@ -4,12 +4,6 @@ CONFIG_SPIRAM=y CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=150000 CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y -CONFIG_SPIRAM_SPEED_80M=y - -# -# SYSTEM -# -CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y # # USB diff --git a/examples/peripherals/usb/host/uvc/sdkconfig.defaults.esp32s2 b/examples/peripherals/usb/host/uvc/sdkconfig.defaults.esp32s2 new file mode 100644 index 0000000000..864fd356e1 --- /dev/null +++ b/examples/peripherals/usb/host/uvc/sdkconfig.defaults.esp32s2 @@ -0,0 +1,9 @@ +# +# SPIRAM +# +CONFIG_SPIRAM_SPEED_80M=y + +# +# SYSTEM +# +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y diff --git a/examples/peripherals/usb/host/uvc/sdkconfig.defaults.esp32s3 b/examples/peripherals/usb/host/uvc/sdkconfig.defaults.esp32s3 new file mode 100644 index 0000000000..864fd356e1 --- /dev/null +++ b/examples/peripherals/usb/host/uvc/sdkconfig.defaults.esp32s3 @@ -0,0 +1,9 @@ +# +# SPIRAM +# +CONFIG_SPIRAM_SPEED_80M=y + +# +# SYSTEM +# +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y diff --git a/examples/system/.build-test-rules.yml b/examples/system/.build-test-rules.yml index 6983c3bec6..af6bf5748b 100644 --- a/examples/system/.build-test-rules.yml +++ b/examples/system/.build-test-rules.yml @@ -30,7 +30,7 @@ examples/system/console/advanced: examples/system/console/advanced_usb_cdc: disable: - - if: SOC_USB_OTG_SUPPORTED != 1 + - if: SOC_USB_OTG_SUPPORTED != 1 or IDF_TARGET == "esp32p4" # TODO: IDF-8078, IDF-9120 and IDF-9133 depends_components: - console - vfs