forked from hathach/tinyusb
-
Couldn't load subscription status.
- Fork 38
Prepare release/v0.19 branch #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Config file for build_idf_examples.yml workflow | ||
|
|
||
| paths = [ | ||
| "examples/peripherals/usb/device", # USB Device examples | ||
| #"examples/network/sta2eth", # USB Network example | ||
| ] | ||
|
|
||
| manifest_files = [ | ||
| "examples/peripherals/.build-test-rules.yml", | ||
| "examples/network/.build-test-rules.yml", | ||
| ] | ||
|
|
||
| recursive = true | ||
| check_warnings = true | ||
| target = "all" | ||
| #enable_preview_targets = true | ||
|
|
||
| # build related options | ||
| build_dir = "build_@t" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #!/usr/bin/env python | ||
| # | ||
| # SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import sys | ||
| import argparse | ||
| import yaml | ||
| from pathlib import Path | ||
| from glob import glob | ||
| from idf_component_tools.manager import ManifestManager | ||
|
|
||
|
|
||
| def override_with_local_component(component, local_path, app): | ||
| app_path = Path(app) | ||
|
|
||
| absolute_local_path = Path(local_path).absolute() | ||
| if not absolute_local_path.exists(): | ||
| print('[Error] {} path does not exist'.format(local_path)) | ||
| raise Exception | ||
| if not app_path.exists(): | ||
| print('[Error] {} path does not exist'.format(app_path)) | ||
| raise Exception | ||
|
|
||
| print('[Info] Processing app {}'.format(app)) | ||
| manager = ManifestManager(app_path / 'main', 'app') | ||
| if '/' not in component: | ||
| # Prepend with default namespace | ||
| component = 'espressif/' + component | ||
|
|
||
| try: | ||
| manifest_tree = yaml.safe_load(Path(manager.path).read_text()) | ||
| manifest_tree['dependencies'][component] = { | ||
| 'version': '*', | ||
| 'override_path': str(absolute_local_path) | ||
| } | ||
| with open(manager.path, 'w') as f: | ||
| yaml.dump(manifest_tree, f, allow_unicode=True, Dumper=yaml.SafeDumper) | ||
| except KeyError: | ||
| print('[Error] {} app does not depend on {}'.format(app, component)) | ||
| raise KeyError | ||
|
|
||
| def override_with_local_component_all(component, local_path, apps): | ||
| # Process wildcard, e.g. "app_prefix_*" | ||
| apps_with_glob = list() | ||
| for app in apps: | ||
| apps_with_glob += glob(app) | ||
|
|
||
| # Go through all collected apps | ||
| for app in apps_with_glob: | ||
| try: | ||
| override_with_local_component(component, local_path, app) | ||
| except: | ||
| print("[Error] Could not process app {}".format(app)) | ||
| return -1 | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument('component', help='Existing component that the app depends on') | ||
| parser.add_argument('local_path', help='Path to component that will be used instead of the managed version') | ||
| parser.add_argument('apps', nargs='*', help='List of apps to process') | ||
| args = parser.parse_args() | ||
| sys.exit(override_with_local_component_all(args.component, args.local_path, args.apps)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| name: ESP-USB Test Apps | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build | ||
| strategy: | ||
| matrix: | ||
| idf_ver: ["release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4", "release-v5.5", "latest"] | ||
| runs-on: ubuntu-latest | ||
| container: espressif/idf:${{ matrix.idf_ver }} | ||
| env: | ||
| ESP_TINYUSB_TEST_APPS: ./esp-usb/device/esp_tinyusb/test_apps | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: 'true' | ||
| - name: Clone esp-usb repository | ||
| run: | | ||
| git clone https://github.com/espressif/esp-usb.git | ||
| - name: Build | ||
| shell: bash | ||
| run: | | ||
| . ${IDF_PATH}/export.sh | ||
| pip install --no-cache-dir idf-component-manager>=2.1.2 idf-build-apps==2.13.1 pyyaml --upgrade | ||
| export PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function" | ||
| export EXTRA_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes" | ||
| export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}" | ||
| python .github/ci/override_managed_component.py tinyusb . ${{ env.ESP_TINYUSB_TEST_APPS }}/*/ | ||
| cd esp-usb | ||
| idf-build-apps find --path ./device/esp_tinyusb/test_apps/ | ||
| idf-build-apps build --path ./device/esp_tinyusb/test_apps/ | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: usb_test_app_bin_${{ matrix.idf_ver }} | ||
| path: | | ||
| ${{env.ESP_TINYUSB_TEST_APPS}}/**/build_*/bootloader/bootloader.bin | ||
| ${{env.ESP_TINYUSB_TEST_APPS}}/**/build_*/partition_table/partition-table.bin | ||
| ${{env.ESP_TINYUSB_TEST_APPS}}/**/build_*/test_app_*.bin | ||
| ${{env.ESP_TINYUSB_TEST_APPS}}/**/build_*/test_app_*.elf | ||
| ${{env.ESP_TINYUSB_TEST_APPS}}/**/build_*/flasher_args.json | ||
| ${{env.ESP_TINYUSB_TEST_APPS}}/**/build_*/config/sdkconfig.json | ||
| if-no-files-found: error | ||
|
|
||
| # run-target: | ||
| # name: Run | ||
| # if: ${{ github.repository_owner == 'espressif' }} | ||
| # needs: build | ||
| # strategy: | ||
| # matrix: | ||
| # idf_ver: ["release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4", "release-v5.5", "latest"] | ||
| # idf_target: ["esp32s2"] | ||
| # runner_tag: ["usb_device"] | ||
| # runs-on: [self-hosted, linux, docker, "${{ matrix.idf_target }}", "${{ matrix.runner_tag }}"] | ||
| # container: | ||
| # image: python:3.11-bookworm | ||
| # options: --privileged --device-cgroup-rule="c 188:* rmw" --device-cgroup-rule="c 166:* rmw" | ||
| # env: | ||
| # ESP_TINYUSB_TEST_APPS: ./esp-usb/device/esp_tinyusb/test_apps | ||
| # steps: | ||
| # - uses: actions/checkout@v4 | ||
| # - name: Clone esp-usb repository | ||
| # run: | | ||
| # git clone https://github.com/espressif/esp-usb.git | ||
| # - name: ⚙️ Install System tools | ||
| # run: | | ||
| # apt update | ||
| # apt install -y usbutils | ||
| # - name: Install Python packages | ||
| # env: | ||
| # PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/" | ||
| # run: pip install --only-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf pyserial pyusb | ||
| # - uses: actions/download-artifact@v4 | ||
| # with: | ||
| # name: usb_test_app_bin_${{ matrix.idf_ver }} | ||
| # path: ${{env.ESP_TINYUSB_TEST_APPS}} | ||
| # - name: Run USB Test App on target | ||
| # run: pytest ${{env.ESP_TINYUSB_TEST_APPS}} --embedded-services esp,idf --target=${{ matrix.idf_target }} -m ${{ matrix.runner_tag }} --build-dir=build_${{ matrix.idf_target }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| name: ESP-IDF USB Device examples | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
|
|
||
| jobs: | ||
| build: | ||
| strategy: | ||
| matrix: | ||
| idf_ver: ["release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4", "release-v5.5", "latest"] | ||
| fail-fast: false | ||
| runs-on: ubuntu-latest | ||
| container: espressif/idf:${{ matrix.idf_ver }} | ||
| env: | ||
| CONFIG_PATH: ${{ github.workspace }}/.github/ci/.idf_build_examples_config.toml | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Python dependencies | ||
| shell: bash | ||
| run: | | ||
| . ${IDF_PATH}/export.sh | ||
| pip install --no-cache-dir idf-component-manager>=2.1.2 idf-build-apps==2.13.1 pyyaml --upgrade | ||
| - name: Build USB Device examples | ||
| shell: bash | ||
| run: | | ||
| . ${IDF_PATH}/export.sh | ||
| python .github/ci/override_managed_component.py tinyusb . ${IDF_PATH}/examples/peripherals/usb/device/tusb_* | ||
| python .github/ci/override_managed_component.py tinyusb . ${IDF_PATH}/examples/network/sta2eth | ||
| cd ${IDF_PATH} | ||
| idf-build-apps find --config-file ${CONFIG_PATH} | ||
| idf-build-apps build --config-file ${CONFIG_PATH} | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| # We upload only the USB Device example binaries to run them on the target | ||
| name: usb_device_tusb_apps_bin_${{ matrix.idf_ver }} | ||
| path: | | ||
| /opt/esp/idf/examples/peripherals/usb/device/tusb_*/build_*/bootloader/bootloader.bin | ||
| /opt/esp/idf/examples/peripherals/usb/device/tusb_*/build_*/partition_table/partition-table.bin | ||
| /opt/esp/idf/examples/peripherals/usb/device/tusb_*/build_*/tusb_*.bin | ||
| /opt/esp/idf/examples/peripherals/usb/device/tusb_*/build_*/tusb_*.elf | ||
| /opt/esp/idf/examples/peripherals/usb/device/tusb_*/build_*/flasher_args.json | ||
| /opt/esp/idf/examples/peripherals/usb/device/tusb_*/build_*/config/sdkconfig.json | ||
| if-no-files-found: error | ||
| run-target: | ||
| name: Run USB Device examples | ||
| if: ${{ github.repository_owner == 'espressif' }} | ||
| needs: build | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| idf_ver: ["release-v5.3", "release-v5.4", "release-v5.5" , "latest"] | ||
| idf_target: ["esp32s2"] | ||
| runner_tag: ["usb_device"] | ||
| runs-on: [self-hosted, linux, docker, "${{ matrix.idf_target }}", "${{ matrix.runner_tag }}"] | ||
| container: | ||
| image: espressif/idf:${{ matrix.idf_ver }} | ||
| options: --privileged --device-cgroup-rule="c 188:* rmw" --device-cgroup-rule="c 166:* rmw" | ||
| steps: | ||
| - name: ⚙️ Install System tools | ||
| run: | | ||
| apt update | ||
| apt install net-tools | ||
| - name: ⚙️ Install Python packages | ||
| env: | ||
| PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/" | ||
| run: | | ||
| cd ${IDF_PATH} | ||
| . ./export.sh | ||
| pip install --no-cache-dir --only-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-jtag pytest-embedded-idf pyserial pyusb python-gitlab minio idf-build-apps idf_ci pytest_ignore_test_results pytest-timeout netifaces | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| name: usb_device_tusb_apps_bin_${{ matrix.idf_ver }} | ||
| path: /opt/esp/idf/examples/peripherals/usb/device | ||
| - name: Run USB Test App on target | ||
| run: | | ||
| cd ${IDF_PATH} | ||
| . ./export.sh | ||
| export EXAMPLES_PATH="${IDF_PATH}/examples/peripherals/usb/device" | ||
| pytest ${EXAMPLES_PATH} --target ${{ matrix.idf_target }} -m ${{ matrix.runner_tag }} --ignore-result-cases=*ncm_example | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| name: ESP IoT Solution - USB Device Examples | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
|
|
||
| jobs: | ||
| build: | ||
| strategy: | ||
| matrix: | ||
| idf_ver: ["release-v5.3", "release-v5.4", "release-v5.5", "latest"] | ||
| name: ["usb_uart_bridge"] | ||
| runs-on: ubuntu-latest | ||
| container: espressif/idf:${{ matrix.idf_ver }} | ||
| env: | ||
| ESP_IOT_PATH: esp-iot-solution | ||
| MANIFEST_PATH: esp-iot-solution/examples/.build-rules.yml | ||
| EXAMPLE_PATH: esp-iot-solution/examples/usb/device/${{ matrix.name }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: 'true' | ||
| - name: Clone esp-iot-solution repository | ||
| run: | | ||
| git clone https://github.com/espressif/esp-iot-solution.git | ||
| - name: Build | ||
| shell: bash | ||
| run: | | ||
| . ${IDF_PATH}/export.sh | ||
| pip install --no-cache-dir idf-component-manager>=2.1.2 idf-build-apps==2.13.1 pyyaml --upgrade | ||
| python .github/ci/override_managed_component.py tinyusb . ${{ env.EXAMPLE_PATH }}/ | ||
| idf-build-apps find --paths ${{ env.EXAMPLE_PATH }} --manifest-file ${{ env.MANIFEST_PATH }} --manifest-rootpath ${{ env.ESP_IOT_PATH }} | ||
| idf-build-apps build --paths ${{ env.EXAMPLE_PATH }} --manifest-file ${{ env.MANIFEST_PATH }} --manifest-rootpath ${{ env.ESP_IOT_PATH }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| name: Push TinyUSB to Espressif Component Service | ||
|
|
||
| # If the commit is tagged, it will be uploaded. Other scenario silently fail. | ||
| on: | ||
| push: | ||
| tags: | ||
| - v* | ||
|
|
||
| jobs: | ||
| upload_components: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Upload components to component service | ||
| uses: espressif/upload-components-ci-action@v2 | ||
| with: | ||
| components: "tinyusb: ." | ||
| version: ${{ github.ref_name }} | ||
| namespace: "espressif" | ||
| api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| idf_build_get_property(target IDF_TARGET) | ||
|
|
||
| if(${target} STREQUAL "esp32s3") | ||
| set(tusb_mcu "OPT_MCU_ESP32S3") | ||
| set(tusb_family "esp32sx") | ||
| elseif(${target} STREQUAL "esp32s2") | ||
| set(tusb_mcu "OPT_MCU_ESP32S2") | ||
| set(tusb_family "esp32sx") | ||
| elseif(${target} STREQUAL "esp32p4") | ||
| set(tusb_mcu "OPT_MCU_ESP32P4") | ||
| set(tusb_family "esp32px") | ||
| elseif(${target} STREQUAL "esp32h4") | ||
| set(tusb_mcu "OPT_MCU_ESP32H4") | ||
| set(tusb_family "esp32sx") | ||
| endif() | ||
|
|
||
| set(compile_options | ||
| "-DCFG_TUSB_MCU=${tusb_mcu}" | ||
| ) | ||
|
|
||
| idf_component_get_property(freertos_include freertos ORIG_INCLUDE_PATH) | ||
|
|
||
| set(includes_private | ||
| "src/" | ||
| "src/device" | ||
| "lib/networking" # For RNDIS definitions | ||
| ) | ||
|
|
||
| set(includes_public | ||
| "src/" | ||
| # The FreeRTOS API include convention in tinyusb is different from esp-idf | ||
| "${freertos_include}" | ||
| ) | ||
|
|
||
| set(srcs | ||
| "src/class/cdc/cdc_device.c" | ||
| "src/class/hid/hid_device.c" | ||
| "src/class/midi/midi_device.c" | ||
| "src/class/msc/msc_device.c" | ||
| "src/class/vendor/vendor_device.c" | ||
| "src/class/audio/audio_device.c" | ||
| "src/class/video/video_device.c" | ||
| "src/class/bth/bth_device.c" | ||
| "src/class/usbtmc/usbtmc_device.c" | ||
| # NET class | ||
| "src/class/net/ecm_rndis_device.c" | ||
| "lib/networking/rndis_reports.c" | ||
| "src/class/net/ncm_device.c" | ||
| # DFU | ||
| "src/class/dfu/dfu_device.c" | ||
| "src/class/dfu/dfu_rt_device.c" | ||
| # Common, device-mode related | ||
| "src/portable/synopsys/dwc2/dcd_dwc2.c" | ||
| "src/portable/synopsys/dwc2/dwc2_common.c" | ||
| "src/common/tusb_fifo.c" | ||
| "src/device/usbd_control.c" | ||
| "src/device/usbd.c" | ||
| "src/tusb.c" | ||
| ) | ||
|
|
||
| set(requirements_private | ||
| esp_netif # required by rndis_reports.c: #include "netif/ethernet.h" | ||
| ) | ||
|
|
||
| if(${target} STREQUAL "esp32p4") | ||
| list(APPEND requirements_private | ||
| esp_mm # required by dcd_dwc2.c: #include "esp_cache.h" | ||
| ) | ||
| endif() | ||
|
|
||
| idf_component_register(SRCS ${srcs} | ||
| INCLUDE_DIRS ${includes_public} | ||
| PRIV_INCLUDE_DIRS ${includes_private} | ||
| PRIV_REQUIRES ${requirements_private} | ||
| ) | ||
|
|
||
| target_compile_options(${COMPONENT_LIB} PUBLIC ${compile_options}) | ||
|
|
||
| # when no builtin class driver is enabled, an uint8_t data compared with `BUILTIN_DRIVER_COUNT` will always be false | ||
| set_source_files_properties("src/device/usbd.c" PROPERTIES COMPILE_FLAGS "-Wno-type-limits") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.