summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorHiFiPhile <[email protected]>2024-10-30 19:36:05 +0100
committerHiFiPhile <[email protected]>2024-10-30 19:47:03 +0100
commit85ff529a310b7e6ec2e4234e3e292fef6432882b (patch)
tree41218fce4db7c23df1073dfdd42fb017c3cf0158 /.github/workflows
parent418b8b2f133d695362c735f271c966af10b5d251 (diff)
parent8b1e40c3e2447de5b4a86bbcdcc0344946a4793d (diff)
Merge branch 'master' into dcd_notif
Signed-off-by: HiFiPhile <[email protected]>
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build.yml140
-rw-r--r--.github/workflows/build_aarch64.yml70
-rw-r--r--.github/workflows/build_arm.yml64
-rw-r--r--.github/workflows/build_cmake.yml292
-rw-r--r--.github/workflows/build_esp.yml114
-rw-r--r--.github/workflows/build_iar.yml59
-rw-r--r--.github/workflows/build_renesas.yml70
-rw-r--r--.github/workflows/build_riscv.yml71
-rw-r--r--.github/workflows/build_util.yml82
-rw-r--r--.github/workflows/build_win_mac.yml54
-rwxr-xr-x.github/workflows/ci_set_matrix.py72
-rw-r--r--.github/workflows/cifuzz.yml4
-rw-r--r--.github/workflows/codeql-buildscript.sh3
-rw-r--r--.github/workflows/codeql.yml6
-rw-r--r--.github/workflows/hil_test.yml88
-rw-r--r--.github/workflows/pre-commit.yml9
16 files changed, 392 insertions, 806 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 000000000..8d5bcbc67
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,140 @@
+name: Build
+
+on:
+ workflow_dispatch:
+ push:
+ paths:
+ - 'src/**'
+ - 'examples/**'
+ - 'lib/**'
+ - 'hw/**'
+ - 'tools/get_deps.py'
+ - 'tools/build.py'
+ - '.github/actions/**'
+ - '.github/workflows/build.yml'
+ - '.github/workflows/build_util.yml'
+ - '.github/workflows/ci_set_matrix.py'
+ pull_request:
+ branches: [ master ]
+ paths:
+ - 'src/**'
+ - 'examples/**'
+ - 'lib/**'
+ - 'hw/**'
+ - 'tools/get_deps.py'
+ - 'tools/build.py'
+ - '.github/actions/**'
+ - '.github/workflows/build.yml'
+ - '.github/workflows/build_util.yml'
+ - '.github/workflows/ci_set_matrix.py'
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ set-matrix:
+ runs-on: ubuntu-latest
+ outputs:
+ json: ${{ steps.set-matrix-json.outputs.matrix }}
+ steps:
+ - name: Checkout TinyUSB
+ uses: actions/checkout@v4
+
+ - name: Generate matrix json
+ id: set-matrix-json
+ run: |
+ MATRIX_JSON=$(python .github/workflows/ci_set_matrix.py)
+ echo "matrix=$MATRIX_JSON"
+ echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
+
+ # ---------------------------------------
+ # Build CMake
+ # ---------------------------------------
+ cmake:
+ needs: set-matrix
+ uses: ./.github/workflows/build_util.yml
+ strategy:
+ fail-fast: false
+ matrix:
+ toolchain:
+ # - 'arm-clang' is built by circle-ci in PR
+ - 'aarch64-gcc'
+ - 'arm-gcc'
+ - 'msp430-gcc'
+ - 'riscv-gcc'
+ with:
+ build-system: 'cmake'
+ toolchain: ${{ matrix.toolchain }}
+ build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }}
+ one-per-family: ${{ github.event_name == 'push' }}
+
+ # ---------------------------------------
+ # Build Make (built by circle-ci in PR, only build on push here)
+ # ---------------------------------------
+ make:
+ if: github.event_name == 'push'
+ needs: set-matrix
+ uses: ./.github/workflows/build_util.yml
+ strategy:
+ fail-fast: false
+ matrix:
+ toolchain:
+ # 'arm-clang'
+ - 'arm-gcc'
+ - 'aarch64-gcc'
+ - 'msp430-gcc'
+ - 'riscv-gcc'
+ - 'rx-gcc'
+ - 'esp-idf' # build-system is ignored
+ with:
+ build-system: 'make'
+ toolchain: ${{ matrix.toolchain }}
+ build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }}
+ one-per-family: true
+
+ # ---------------------------------------
+ # Build Make on Windows/MacOS
+ # ---------------------------------------
+ make-os:
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/build_util.yml
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [windows-latest, macos-latest]
+ with:
+ os: ${{ matrix.os }}
+ build-system: 'make'
+ toolchain: 'arm-gcc'
+ build-args: '["stm32h7"]'
+ one-per-family: true
+
+ # ---------------------------------------
+ # Build IAR on HFP self-hosted
+ # ---------------------------------------
+ arm-iar:
+ if: github.repository_owner == 'hathach'
+ needs: set-matrix
+ runs-on: [self-hosted, Linux, X64, hifiphile]
+ env:
+ BUILD_ARGS: ${{ join(fromJSON(needs.set-matrix.outputs.json)['arm-iar'], ' ') }}
+ steps:
+ - name: Clean workspace
+ run: |
+ echo "Cleaning up previous run"
+ rm -rf "${{ github.workspace }}"
+ mkdir -p "${{ github.workspace }}"
+
+ - name: Checkout TinyUSB
+ uses: actions/checkout@v4
+
+ - name: Get Dependencies
+ run: python3 tools/get_deps.py $BUILD_ARGS
+
+ - name: Build
+ run: python3 tools/build.py --one-per-family --toolchain iar $BUILD_ARGS
+
+ - name: Test on actual hardware (hardware in the loop)
+ if: github.event_name == 'pull_request'
+ run: |
+ python3 test/hil/hil_test.py hfp.json
diff --git a/.github/workflows/build_aarch64.yml b/.github/workflows/build_aarch64.yml
deleted file mode 100644
index 237692498..000000000
--- a/.github/workflows/build_aarch64.yml
+++ /dev/null
@@ -1,70 +0,0 @@
-name: Build AArch64
-
-on:
- workflow_dispatch:
- push:
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - '.github/workflows/build_aarch64.yml'
- pull_request:
- branches: [ master ]
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - '.github/workflows/build_aarch64.yml'
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
- cancel-in-progress: true
-
-jobs:
- # ---------------------------------------
- # Build AARCH64 family
- # ---------------------------------------
- build-arm:
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- family:
- # Alphabetical order
- - 'broadcom_64bit'
- steps:
- - name: Setup Python
- uses: actions/setup-python@v5
- with:
- python-version: '3.x'
-
- - name: Checkout TinyUSB
- uses: actions/checkout@v4
-
- - name: Set Toolchain URL
- run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
-
- - name: Cache Toolchain
- uses: actions/cache@v4
- id: cache-toolchain
- with:
- path: ~/cache/
- key: ${{ runner.os }}-21-11-02-${{ env.TOOLCHAIN_URL }}
-
- - name: Install Toolchain
- if: steps.cache-toolchain.outputs.cache-hit != 'true'
- run: |
- mkdir -p ~/cache/toolchain
- wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.gz
- tar -C ~/cache/toolchain -xaf toolchain.tar.gz
-
- - name: Set Toolchain Path
- run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
-
- - name: Get Dependencies
- run: python3 tools/get_deps.py ${{ matrix.family }}
-
- - name: Build
- run: python3 tools/build_make.py ${{ matrix.family }}
diff --git a/.github/workflows/build_arm.yml b/.github/workflows/build_arm.yml
deleted file mode 100644
index 12e6615ea..000000000
--- a/.github/workflows/build_arm.yml
+++ /dev/null
@@ -1,64 +0,0 @@
-name: Build ARM
-
-on:
- workflow_dispatch:
- push:
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - 'tools/get_deps.py'
- - '.github/workflows/build_arm.yml'
- pull_request:
- branches: [ master ]
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - 'tools/get_deps.py'
- - '.github/workflows/build_arm.yml'
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
- cancel-in-progress: true
-
-jobs:
- # ---------------------------------------
- # Build ARM family
- # ---------------------------------------
- build-arm:
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- family:
- # Alphabetical order
- - 'broadcom_32bit'
- - 'kinetis_k32l2'
- - 'lpc11 lpc13 lpc15'
- - 'lpc51'
- - 'mm32 msp432e4'
- - 'samd11 same5x saml2x'
- - 'stm32l0 stm32wb'
- - 'tm4c123 xmc4000'
- steps:
- - name: Setup Python
- uses: actions/setup-python@v5
- with:
- python-version: '3.x'
-
- - name: Install ARM GCC
- uses: carlosperate/arm-none-eabi-gcc-action@v1
- with:
- release: '11.2-2022.02'
-
- - name: Checkout TinyUSB
- uses: actions/checkout@v4
-
- - name: Get Dependencies
- run: python3 tools/get_deps.py ${{ matrix.family }}
-
- - name: Build
- run: python3 tools/build_make.py ${{ matrix.family }}
diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml
deleted file mode 100644
index 65de47e8d..000000000
--- a/.github/workflows/build_cmake.yml
+++ /dev/null
@@ -1,292 +0,0 @@
-name: Build CMake
-
-on:
- workflow_dispatch:
- push:
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - 'test/hil/**'
- - 'tools/get_deps.py'
- - '.github/workflows/build_cmake.yml'
- pull_request:
- branches: [ master ]
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - 'test/hil/**'
- - 'tools/get_deps.py'
- - '.github/workflows/build_cmake.yml'
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
- cancel-in-progress: true
-
-jobs:
- # ---------------------------------------
- # Build ARM with GCC
- # ---------------------------------------
- arm-gcc:
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- family:
- # Alphabetical order
- - 'imxrt'
- - 'kinetis_k kinetis_kl'
- - 'lpc17 lpc18 lpc40 lpc43'
- - 'lpc54 lpc55'
- - 'mcx'
- - 'nrf'
- - 'ra'
- - 'rp2040'
- - 'samd21'
- - 'samd51'
- - 'stm32f0'
- - 'stm32f1'
- - 'stm32f2'
- - 'stm32f3'
- - 'stm32f4'
- - 'stm32f7'
- - 'stm32g0'
- - 'stm32g4'
- - 'stm32h5'
- - 'stm32h7'
- - 'stm32l4'
- - 'stm32u5'
- steps:
- - name: Setup Python
- uses: actions/setup-python@v5
- with:
- python-version: '3.x'
-
- - name: Install ARM GCC
- uses: carlosperate/arm-none-eabi-gcc-action@v1
- with:
- release: '12.3.Rel1'
-
- - name: Checkout TinyUSB
- uses: actions/checkout@v4
-
- - name: Checkout pico-sdk for rp2040
- if: matrix.family == 'rp2040'
- uses: actions/checkout@v4
- with:
- repository: raspberrypi/pico-sdk
- ref: develop
- path: pico-sdk
-
- - name: Get Dependencies
- run: |
- sudo apt install -y ninja-build
- python3 tools/get_deps.py ${{ matrix.family }}
-
- - name: Build
- run: python tools/build_cmake.py ${{ matrix.family }} -DCMAKE_BUILD_TYPE=MinSizeRel
- env:
- PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk
-
- - name: Upload Artifacts for Hardware Testing (rp2040)
- if: matrix.family == 'rp2040' && github.repository_owner == 'hathach'
- uses: actions/upload-artifact@v4
- with:
- name: raspberry_pi_pico
- path: |
- cmake-build/cmake-build-raspberry_pi_pico/*/*/*.elf
-
- - name: Upload Artifacts for Hardware Testing (nRF)
- if: matrix.family == 'nrf' && github.repository_owner == 'hathach'
- uses: actions/upload-artifact@v4
- with:
- name: feather_nrf52840_express
- path: |
- cmake-build/cmake-build-feather_nrf52840_express/*/*/*.elf
-
- - name: Upload Artifacts for Hardware Testing (samd51)
- if: matrix.family == 'samd51' && github.repository_owner == 'hathach'
- uses: actions/upload-artifact@v4
- with:
- name: itsybitsy_m4
- path: |
- cmake-build/cmake-build-itsybitsy_m4/*/*/*.bin
-
- # ---------------------------------------
- # Build ARM with Clang
- # ---------------------------------------
- arm-clang:
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- family:
- # Alphabetical order
- - 'imxrt'
- - 'kinetis_k kinetis_kl'
- - 'lpc17 lpc18 lpc40 lpc43'
- - 'lpc54 lpc55'
- #- 'mcx' not working with gcc anymore, need to fix this first
- - 'nrf'
- #- 'ra' port later
- #- 'rp2040' port later
- - 'samd21'
- - 'samd51'
- - 'stm32f0'
- - 'stm32f1'
- - 'stm32f2'
- - 'stm32f3'
- - 'stm32f4'
- - 'stm32f7'
- - 'stm32g0'
- - 'stm32g4'
- - 'stm32h5'
- - 'stm32h7'
- - 'stm32l4'
- - 'stm32u5'
- steps:
- - name: Setup Python
- uses: actions/setup-python@v5
- with:
- python-version: '3.x'
-
- - name: Checkout TinyUSB
- uses: actions/checkout@v4
-
- - name: Checkout pico-sdk for rp2040
- if: matrix.family == 'rp2040'
- uses: actions/checkout@v4
- with:
- repository: raspberrypi/pico-sdk
- ref: develop
- path: pico-sdk
-
- - name: Set Toolchain URL
- run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/LLVMEmbeddedToolchainForArm-17.0.1-Linux-x86_64.tar.xz
-
- - name: Cache Toolchain
- uses: actions/cache@v4
- id: cache-toolchain
- with:
- path: ~/cache/
- key: ${{ runner.os }}-24-04-17-${{ env.TOOLCHAIN_URL }}
-
- - name: Install Toolchain
- if: steps.cache-toolchain.outputs.cache-hit != 'true'
- run: |
- mkdir -p ~/cache/toolchain
- wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.xz
- tar -C ~/cache/toolchain -xaf toolchain.tar.xz
-
- - name: Prepare to build
- run: |
- echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
- sudo apt install -y ninja-build
- python3 tools/get_deps.py ${{ matrix.family }}
-
- - name: Build
- run: python tools/build_cmake.py ${{ matrix.family }} -DTOOLCHAIN=clang -DCMAKE_BUILD_TYPE=MinSizeRel
- env:
- PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk
-
- # ---------------------------------------
- # Build MSP430 with GCC
- # ---------------------------------------
- msp430-gcc:
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- family:
- # Alphabetical order
- - 'msp430'
- steps:
- - name: Setup Python
- uses: actions/setup-python@v5
- with:
- python-version: '3.x'
-
- - name: Checkout TinyUSB
- uses: actions/checkout@v4
-
- - name: Set Toolchain URL
- run: echo >> $GITHUB_ENV TOOLCHAIN_URL=http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-9.2.0.50_linux64.tar.bz2
-
- - name: Cache Toolchain
- uses: actions/cache@v4
- id: cache-toolchain
- with:
- path: ~/cache/
- key: ${{ runner.os }}-24-04-17-${{ env.TOOLCHAIN_URL }}
-
- - name: Install Toolchain
- if: steps.cache-toolchain.outputs.cache-hit != 'true'
- run: |
- mkdir -p ~/cache/toolchain
- wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.bz2
- tar -C ~/cache/toolchain -xaf toolchain.tar.bz2
-
- - name: Prepare to build
- run: |
- echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
- sudo apt install -y ninja-build
- python3 tools/get_deps.py ${{ matrix.family }}
-
- - name: Build
- run: python tools/build_cmake.py ${{ matrix.family }} -DCMAKE_BUILD_TYPE=MinSizeRel
-
- # ---------------------------------------
- # Hardware in the loop (HIL)
- # Current self-hosted instance is running on an RPI4. For attached hardware checkout hil_pi4.json
- # ---------------------------------------
- hil-test:
- # run only with hathach's commit due to limited resource on RPI4
- if: github.repository_owner == 'hathach'
- needs: arm-gcc
- runs-on: [self-hosted, rp2040, nrf52840, hardware-in-the-loop]
- strategy:
- fail-fast: false
- matrix:
- board:
- - 'feather_nrf52840_express'
- - 'itsybitsy_m4'
- - 'raspberry_pi_pico'
- steps:
- - name: Clean workspace
- run: |
- echo "Cleaning up previous run"
- rm -rf "${{ github.workspace }}"
- mkdir -p "${{ github.workspace }}"
-
- # USB bus on rpi4 is not stable, reset it before testing
- - name: Reset USB bus
- run: |
- lsusb
- lsusb -t
- # reset VIA Labs 2.0 hub
- sudo usbreset 001/002
-
- # legacy code
- #for port in $(lspci | grep USB | cut -d' ' -f1); do
- # echo -n "0000:${port}"| sudo tee /sys/bus/pci/drivers/xhci_hcd/unbind;
- # sleep 0.1;
- # echo -n "0000:${port}" | sudo tee /sys/bus/pci/drivers/xhci_hcd/bind;
- #done
-
- - name: Checkout test/hil
- uses: actions/checkout@v4
- with:
- sparse-checkout: test/hil
-
- - name: Download Artifacts
- uses: actions/download-artifact@v4
- with:
- name: ${{ matrix.board }}
- path: cmake-build/cmake-build-${{ matrix.board }}
-
- - name: Test on actual hardware
- run: |
- python3 test/hil/hil_test.py --board ${{ matrix.board }} hil_pi4.json
diff --git a/.github/workflows/build_esp.yml b/.github/workflows/build_esp.yml
deleted file mode 100644
index 4108a58a5..000000000
--- a/.github/workflows/build_esp.yml
+++ /dev/null
@@ -1,114 +0,0 @@
-name: Build ESP
-
-on:
- workflow_dispatch:
- push:
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - 'test/hil/**'
- - '.github/workflows/build_esp.yml'
- pull_request:
- branches: [ master ]
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - 'test/hil/**'
- - '.github/workflows/build_esp.yml'
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
- cancel-in-progress: true
-
-jobs:
- build-esp:
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- board:
- # ESP32-S2
- - 'espressif_kaluga_1'
- # ESP32-S3
- - 'espressif_s3_devkitm'
- steps:
- - name: Setup Python
- uses: actions/setup-python@v5
- with:
- python-version: '3.x'
-
- - name: Pull ESP-IDF docker
- run: docker pull espressif/idf:latest
-
- - name: Checkout TinyUSB
- uses: actions/checkout@v4
-
- - name: Build
- run: docker run --rm -v $PWD:/project -w /project espressif/idf:v5.1.1 python3 tools/build_esp32.py ${{ matrix.board }}
-
- - name: Upload Artifacts for Hardware Testing
- if: matrix.board == 'espressif_s3_devkitm' && github.repository_owner == 'hathach'
- uses: actions/upload-artifact@v4
- with:
- name: ${{ matrix.board }}
- path: |
- cmake-build/cmake-build-${{ matrix.board }}/*/*/bootloader/bootloader.bin
- cmake-build/cmake-build-${{ matrix.board }}/*/*/*.bin
- cmake-build/cmake-build-${{ matrix.board }}/*/*/partition_table/partition-table.bin
- cmake-build/cmake-build-${{ matrix.board }}/*/*/config.env
- cmake-build/cmake-build-${{ matrix.board }}/*/*/flash_args
-
- # ---------------------------------------
- # Hardware in the loop (HIL)
- # Current self-hosted instance is running on an RPI4. For attached hardware checkout hil_pi4.json
- # ---------------------------------------
- hil-test:
- # run only with hathach's commit due to limited resource on RPI4
- if: github.repository_owner == 'hathach'
- needs: build-esp
- runs-on: [self-hosted, esp32s3, hardware-in-the-loop]
- strategy:
- fail-fast: false
- matrix:
- board:
- - 'espressif_s3_devkitm'
- steps:
- - name: Clean workspace
- run: |
- echo "Cleaning up previous run"
- rm -rf "${{ github.workspace }}"
- mkdir -p "${{ github.workspace }}"
-
- # USB bus on rpi4 is not stable, reset it before testing
- - name: Reset USB bus
- run: |
- lsusb
- lsusb -t
- # reset VIA Labs 2.0 hub
- sudo usbreset 001/002
-
- # legacy code
- #for port in $(lspci | grep USB | cut -d' ' -f1); do
- # echo -n "0000:${port}"| sudo tee /sys/bus/pci/drivers/xhci_hcd/unbind;
- # sleep 0.1;
- # echo -n "0000:${port}" | sudo tee /sys/bus/pci/drivers/xhci_hcd/bind;
- #done
-
- - name: Checkout test/hil
- uses: actions/checkout@v4
- with:
- sparse-checkout: test/hil
-
- - name: Download Artifacts
- uses: actions/download-artifact@v4
- with:
- name: ${{ matrix.board }}
- path: cmake-build/cmake-build-${{ matrix.board }}
-
- - name: Test on actual hardware
- run: |
- python3 test/hil/hil_test.py --board ${{ matrix.board }} hil_pi4.json
diff --git a/.github/workflows/build_iar.yml b/.github/workflows/build_iar.yml
deleted file mode 100644
index 499349904..000000000
--- a/.github/workflows/build_iar.yml
+++ /dev/null
@@ -1,59 +0,0 @@
-name: Build IAR
-
-on:
- workflow_dispatch:
- push:
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - 'tools/get_deps.py'
- - 'test/hil/**'
- - '.github/workflows/build_iar.yml'
- pull_request:
- branches: [ master ]
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - 'tools/get_deps.py'
- - 'test/hil/**'
- - '.github/workflows/build_iar.yml'
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
- cancel-in-progress: true
-
-jobs:
- cmake:
- if: github.repository_owner == 'hathach'
- runs-on: [self-hosted, Linux, X64, hifiphile]
- strategy:
- fail-fast: false
- matrix:
- family:
- # Alphabetical order
- # Note: bundle multiple families into a matrix since there is only one self-hosted instance can
- # run IAR build. Too many matrix can hurt due to setup/teardown overhead.
- - 'lpc43 stm32f0 stm32f1 stm32f7 stm32g0 stm32g4 stm32l4'
- steps:
- - name: Clean workspace
- run: |
- echo "Cleaning up previous run"
- rm -rf "${{ github.workspace }}"
- mkdir -p "${{ github.workspace }}"
-
- - name: Checkout TinyUSB
- uses: actions/checkout@v4
-
- - name: Get Dependencies
- run: python3 tools/get_deps.py ${{ matrix.family }}
-
- - name: Build
- run: python3 tools/build_cmake.py ${{ matrix.family }} -DTOOLCHAIN=iar -DCMAKE_BUILD_TYPE=MinSizeRel
-
- - name: Test on actual hardware (hardware in the loop)
- run: |
- python3 test/hil/hil_test.py hil_hfp.json
diff --git a/.github/workflows/build_renesas.yml b/.github/workflows/build_renesas.yml
deleted file mode 100644
index fbc12d285..000000000
--- a/.github/workflows/build_renesas.yml
+++ /dev/null
@@ -1,70 +0,0 @@
-name: Build Renesas
-
-on:
- workflow_dispatch:
- push:
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - 'tools/get_deps.py'
- - '.github/workflows/build_renesas.yml'
- pull_request:
- branches: [ master ]
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - 'tools/get_deps.py'
- - '.github/workflows/build_renesas.yml'
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
- cancel-in-progress: true
-
-jobs:
- build-rx:
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- family:
- # Alphabetical order
- - 'rx'
- steps:
- - name: Setup Python
- uses: actions/setup-python@v5
- with:
- python-version: '3.x'
-
- - name: Checkout TinyUSB
- uses: actions/checkout@v4
-
- - name: Set Toolchain URL
- run: echo >> $GITHUB_ENV TOOLCHAIN_URL=http://gcc-renesas.com/downloads/get.php?f=rx/8.3.0.202004-gnurx/gcc-8.3.0.202004-GNURX-ELF.run
-
- - name: Cache Toolchain
- uses: actions/cache@v4
- id: cache-toolchain
- with:
- path: ~/cache/
- key: ${{ runner.os }}-21-03-30-${{ env.TOOLCHAIN_URL }}
-
- - name: Install Toolchain
- if: steps.cache-toolchain.outputs.cache-hit != 'true'
- run: |
- mkdir -p ~/cache/toolchain/gnurx
- wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.run
- chmod +x toolchain.run
- ./toolchain.run -p ~/cache/toolchain/gnurx -y
-
- - name: Set Toolchain Path
- run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
-
- - name: Get Dependencies
- run: python3 tools/get_deps.py ${{ matrix.family }}
-
- - name: Build
- run: python3 tools/build_make.py ${{ matrix.family }}
diff --git a/.github/workflows/build_riscv.yml b/.github/workflows/build_riscv.yml
deleted file mode 100644
index 7f5031ff1..000000000
--- a/.github/workflows/build_riscv.yml
+++ /dev/null
@@ -1,71 +0,0 @@
-name: Build RISC-V
-
-on:
- workflow_dispatch:
- push:
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - 'tools/get_deps.py'
- - '.github/workflows/build_riscv.yml'
- pull_request:
- branches: [ master ]
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - 'tools/get_deps.py'
- - '.github/workflows/build_riscv.yml'
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
- cancel-in-progress: true
-
-jobs:
- build-riscv:
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- family:
- # Alphabetical order
- - 'ch32v307'
- - 'fomu'
- - 'gd32vf103'
- steps:
- - name: Setup Python
- uses: actions/setup-python@v5
- with:
- python-version: '3.x'
-
- - name: Checkout TinyUSB
- uses: actions/checkout@v4
-
- - name: Set Toolchain URL
- run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v10.1.0-1.1/xpack-riscv-none-embed-gcc-10.1.0-1.1-linux-x64.tar.gz
-
- - name: Cache Toolchain
- uses: actions/cache@v4
- id: cache-toolchain
- with:
- path: ~/cache/
- key: ${{ runner.os }}-21-03-04-${{ env.TOOLCHAIN_URL }}
-
- - name: Install Toolchain
- if: steps.cache-toolchain.outputs.cache-hit != 'true'
- run: |
- mkdir -p ~/cache/toolchain
- wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.gz
- tar -C ~/cache/toolchain -xaf toolchain.tar.gz
-
- - name: Set Toolchain Path
- run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
-
- - name: Get Dependencies
- run: python3 tools/get_deps.py ${{ matrix.family }}
-
- - name: Build
- run: python3 tools/build_make.py ${{ matrix.family }}
diff --git a/.github/workflows/build_util.yml b/.github/workflows/build_util.yml
new file mode 100644
index 000000000..706ded1c1
--- /dev/null
+++ b/.github/workflows/build_util.yml
@@ -0,0 +1,82 @@
+name: Reusable build util
+
+on:
+ workflow_call:
+ inputs:
+ build-system:
+ required: true
+ type: string
+ toolchain:
+ required: true
+ type: string
+ build-args:
+ required: true
+ type: string
+ one-per-family:
+ required: false
+ default: false
+ type: boolean
+ upload-artifacts:
+ required: false
+ default: false
+ type: boolean
+ os:
+ required: false
+ type: string
+ default: 'ubuntu-latest'
+
+jobs:
+ family:
+ runs-on: ${{ inputs.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ arg: ${{ fromJSON(inputs.build-args) }}
+ steps:
+ - name: Checkout TinyUSB
+ uses: actions/checkout@v4
+
+ - name: Setup Toolchain
+ id: setup-toolchain
+ uses: ./.github/actions/setup_toolchain
+ with:
+ toolchain: ${{ inputs.toolchain }}
+ toolchain_version: 'v5.3.1'
+
+ - name: Get Dependencies
+ uses: ./.github/actions/get_deps
+ with:
+ arg: ${{ matrix.arg }}
+
+ - name: Set build one-per-family option
+ id: set-one-per-family
+ run: |
+ if [[ "${{ inputs.one-per-family }}" == "true" ]]; then
+ BUILD_OPTION="--one-per-family"
+ fi
+ echo "build_option=$BUILD_OPTION"
+ echo "build_option=$BUILD_OPTION" >> $GITHUB_OUTPUT
+ shell: bash
+
+ - name: Build
+ run: |
+ if [ "${{ inputs.toolchain }}" == "esp-idf" ]; then
+ docker run --rm -v $PWD:/project -w /project espressif/idf:v5.3.1 python tools/build.py ${{ matrix.arg }}
+ else
+ python tools/build.py -s ${{ inputs.build-system }} ${{ steps.setup-toolchain.outputs.build_option }} ${{ steps.set-one-per-family.outputs.build_option }} ${{ matrix.arg }}
+ fi
+ shell: bash
+
+ - name: Upload Artifacts for Hardware Testing
+ if: ${{ inputs.upload-artifacts }}
+ uses: actions/upload-artifact@v4
+ with:
+ name: ${{ matrix.arg }}
+ path: |
+ cmake-build/cmake-build-*/*/*/*.elf
+ cmake-build/cmake-build-*/*/*/*.bin
+ cmake-build/cmake-build-*/*/*/*.bin
+ cmake-build/cmake-build-*/*/*/bootloader/bootloader.bin
+ cmake-build/cmake-build-*/*/*/partition_table/partition-table.bin
+ cmake-build/cmake-build-*/*/*/config.env
+ cmake-build/cmake-build-*/*/*/flash_args
diff --git a/.github/workflows/build_win_mac.yml b/.github/workflows/build_win_mac.yml
deleted file mode 100644
index b33b5b593..000000000
--- a/.github/workflows/build_win_mac.yml
+++ /dev/null
@@ -1,54 +0,0 @@
-name: Build Windows/MacOS
-
-on:
- workflow_dispatch:
- push:
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - '.github/workflows/build_win_mac.yml'
- pull_request:
- branches: [ master ]
- paths:
- - 'src/**'
- - 'examples/**'
- - 'lib/**'
- - 'hw/**'
- - '.github/workflows/build_win_mac.yml'
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
- cancel-in-progress: true
-
-jobs:
- # ---------------------------------------
- # Build ARM family
- # ---------------------------------------
- build-arm:
- strategy:
- fail-fast: false
- matrix:
- os: [windows-latest, macos-latest]
- runs-on: ${{ matrix.os }}
-
- steps:
- - name: Setup Python
- uses: actions/setup-python@v5
- with:
- python-version: '3.x'
-
- - name: Install ARM GCC
- uses: carlosperate/arm-none-eabi-gcc-action@v1
- with:
- release: '10.3-2021.10'
-
- - name: Checkout TinyUSB
- uses: actions/checkout@v4
-
- - name: Get Dependencies
- run: python3 tools/get_deps.py stm32f4
-
- - name: Build
- run: python3 tools/build_make.py stm32f4 stm32f411disco
diff --git a/.github/workflows/ci_set_matrix.py b/.github/workflows/ci_set_matrix.py
new file mode 100755
index 000000000..705dcac94
--- /dev/null
+++ b/.github/workflows/ci_set_matrix.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python3
+import json
+
+# toolchain, url
+toolchain_list = [
+ "aarch64-gcc",
+ "arm-clang",
+ "arm-iar",
+ "arm-gcc",
+ "esp-idf",
+ "msp430-gcc",
+ "riscv-gcc",
+ "rx-gcc"
+]
+
+# family: [supported toolchain]
+family_list = {
+ "broadcom_32bit": ["arm-gcc"],
+ "broadcom_64bit": ["aarch64-gcc"],
+ "ch32v10x ch32v20x ch32v307 fomu gd32vf103": ["riscv-gcc"],
+ "da1469x": ["arm-gcc"],
+ "imxrt": ["arm-gcc", "arm-clang"],
+ "kinetis_k kinetis_kl kinetis_k32l2": ["arm-gcc", "arm-clang"],
+ "lpc11 lpc13 lpc15": ["arm-gcc", "arm-clang"],
+ "lpc17 lpc18 lpc40 lpc43": ["arm-gcc", "arm-clang"],
+ "lpc51 lpc54 lpc55": ["arm-gcc", "arm-clang"],
+ "max32650 max32666 max32690 max78002": ["arm-gcc"],
+ "mcx": ["arm-gcc"],
+ "mm32": ["arm-gcc"],
+ "msp430": ["msp430-gcc"],
+ "msp432e4 tm4c": ["arm-gcc"],
+ "nrf": ["arm-gcc", "arm-clang"],
+ "ra": ["arm-gcc"],
+ "rp2040": ["arm-gcc"],
+ "rx": ["rx-gcc"],
+ "samd11 saml2x": ["arm-gcc", "arm-clang"],
+ "samd21": ["arm-gcc", "arm-clang"],
+ "samd5x_e5x samg": ["arm-gcc", "arm-clang"],
+ "stm32f0 stm32f1 stm32f2 stm32f3": ["arm-gcc", "arm-clang", "arm-iar"],
+ "stm32f4": ["arm-gcc", "arm-clang", "arm-iar"],
+ "stm32f7": ["arm-gcc", "arm-clang", "arm-iar"],
+ "stm32g0 stm32g4 stm32h5": ["arm-gcc", "arm-clang", "arm-iar"],
+ "stm32h7": ["arm-gcc", "arm-clang", "arm-iar"],
+ "stm32l0 stm32l4": ["arm-gcc", "arm-clang", "arm-iar"],
+ "stm32u5 stm32wb": ["arm-gcc", "arm-clang", "arm-iar"],
+ "xmc4000": ["arm-gcc"],
+ "-bespressif_kaluga_1": ["esp-idf"],
+ "-bespressif_s3_devkitm": ["esp-idf"],
+ "-bespressif_p4_function_ev": ["esp-idf"],
+}
+
+
+def set_matrix_json():
+ matrix = {}
+ for toolchain in toolchain_list:
+ filtered_families = [family for family, supported_toolchain in family_list.items() if
+ toolchain in supported_toolchain]
+
+ # always add board in hfp.json for arm-iar
+ if toolchain == 'arm-iar':
+ with open('test/hil/hfp.json') as f:
+ hfp_data = json.load(f)
+ hfp_boards = [f"-b{board['name']}" for board in hfp_data['boards']]
+ filtered_families = filtered_families + hfp_boards
+
+ matrix[toolchain] = filtered_families
+
+ print(json.dumps(matrix))
+
+
+if __name__ == '__main__':
+ set_matrix_json()
diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml
index 5dc0f2764..d7f1fc066 100644
--- a/.github/workflows/cifuzz.yml
+++ b/.github/workflows/cifuzz.yml
@@ -20,12 +20,14 @@ jobs:
with:
oss-fuzz-project-name: 'tinyusb'
language: c++
+
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'tinyusb'
language: c++
- fuzz-seconds: 600
+ fuzz-seconds: 400
+
- name: Upload Crash
uses: actions/upload-artifact@v4
if: failure() && steps.build.outcome == 'success'
diff --git a/.github/workflows/codeql-buildscript.sh b/.github/workflows/codeql-buildscript.sh
index 35e029922..272b55d22 100644
--- a/.github/workflows/codeql-buildscript.sh
+++ b/.github/workflows/codeql-buildscript.sh
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
FAMILY=stm32l4
+pip install click
python3 tools/get_deps.py $FAMILY
-python3 tools/build_make.py $FAMILY
+python3 tools/build.py -s make $FAMILY
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index 1f7b60b9c..be4c2dd87 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -59,10 +59,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- - name: Install ARM GCC
- uses: carlosperate/arm-none-eabi-gcc-action@v1
+ - name: Setup Toolchain
+ uses: ./.github/actions/setup_toolchain
with:
- release: '11.2-2022.02'
+ toolchain: 'arm-gcc'
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
diff --git a/.github/workflows/hil_test.yml b/.github/workflows/hil_test.yml
new file mode 100644
index 000000000..c6e7f33b0
--- /dev/null
+++ b/.github/workflows/hil_test.yml
@@ -0,0 +1,88 @@
+name: Hardware Test
+
+on:
+ workflow_dispatch:
+ pull_request:
+ branches: [ master ]
+ paths:
+ - 'src/**'
+ - 'examples/**'
+ - 'lib/**'
+ - 'hw/**'
+ - 'test/hil/**'
+ - 'tools/get_deps.py'
+ - '.github/actions/**'
+ - '.github/workflows/hil_test.yml'
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+env:
+ HIL_JSON: test/hil/tinyusb.json
+
+jobs:
+ set-matrix:
+ runs-on: ubuntu-latest
+ outputs:
+ json: ${{ steps.set-matrix-json.outputs.matrix }}
+ steps:
+ - name: Checkout TinyUSB
+ uses: actions/checkout@v4
+
+ - name: Generate matrix json
+ id: set-matrix-json
+ run: |
+ MATRIX_JSON=$(python test/hil/hil_ci_set_matrix.py ${{ env.HIL_JSON }})
+ echo "matrix=$MATRIX_JSON"
+ echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
+
+ # ---------------------------------------
+ # Build arm-gcc
+ # ---------------------------------------
+ build:
+ if: github.repository_owner == 'hathach'
+ needs: set-matrix
+ uses: ./.github/workflows/build_util.yml
+ strategy:
+ fail-fast: false
+ matrix:
+ toolchain:
+ - 'arm-gcc'
+ - 'esp-idf'
+ with:
+ build-system: 'cmake'
+ toolchain: ${{ matrix.toolchain }}
+ build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }}
+ one-per-family: true
+ upload-artifacts: true
+
+ # ---------------------------------------
+ # Hardware in the loop (HIL)
+ # self-hosted running on an VM. For attached hardware checkout HIL_JSON
+ # ---------------------------------------
+ hil-tinyusb:
+ if: github.repository_owner == 'hathach'
+ needs: build
+ runs-on: [self-hosted, X64, hathach, hardware-in-the-loop]
+ steps:
+ - name: Clean workspace
+ run: |
+ echo "Cleaning up previous run"
+ rm -rf "${{ github.workspace }}"
+ mkdir -p "${{ github.workspace }}"
+
+ - name: Checkout TinyUSB
+ uses: actions/checkout@v4
+ with:
+ sparse-checkout: test/hil
+
+ - name: Download Artifacts
+ uses: actions/download-artifact@v4
+ with:
+ path: cmake-build
+ merge-multiple: true
+
+ - name: Test on actual hardware
+ run: |
+ ls cmake-build/
+ python3 test/hil/hil_test.py ${{ env.HIL_JSON }}
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index e36259daa..530484079 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -7,18 +7,13 @@ on:
branches: [ master ]
concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
+ group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- - name: Setup Python
- uses: actions/setup-python@v5
- with:
- python-version: '3.x'
-
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
@@ -34,7 +29,7 @@ jobs:
#ceedling test:all
- name: Run pre-commit
- uses: pre-commit/[email protected]
+ uses: pre-commit/[email protected]
- name: Build Fuzzer
run: |