Rework ci (#2631)
* add name field to usbd_class_driver_t * ci: use set matrix py script * add riscv32 and cmake support for ch32v307, fomu, gd32vf103 * update build_cmake.py to take --family --board --toolchain * separate hil test to its own workflow * move esp32 board into separated hil json * add make build to ci * remov build_make.py * build.py support esp32 board * setup toolchain support esp-idf * fix missing click * merge family in matrix build to reduce jobs * skip cifuzz since it still has issue with get_deps and click
This commit is contained in:
30
.github/actions/prepare_build/action.yml
vendored
Normal file
30
.github/actions/prepare_build/action.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
name: Prepare to build
|
||||
|
||||
inputs:
|
||||
family:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Checkout pico-sdk for rp2040
|
||||
if: contains(inputs.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
|
||||
pip install click
|
||||
python3 tools/get_deps.py ${{ inputs.family }}
|
||||
echo >> $GITHUB_ENV "PICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk"
|
||||
shell: bash
|
31
.github/actions/setup_toolchain/action.yml
vendored
Normal file
31
.github/actions/setup_toolchain/action.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
name: Setup Toolchain
|
||||
|
||||
inputs:
|
||||
toolchain:
|
||||
required: true
|
||||
type: string
|
||||
toolchain_url:
|
||||
required: false
|
||||
type: string
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Install ARM GCC
|
||||
if: inputs.toolchain == 'arm-gcc'
|
||||
uses: carlosperate/arm-none-eabi-gcc-action@v1
|
||||
with:
|
||||
release: '12.3.Rel1'
|
||||
|
||||
- name: Pull ESP-IDF docker
|
||||
if: inputs.toolchain == 'esp-idf'
|
||||
run: docker pull espressif/idf:latest
|
||||
shell: bash
|
||||
|
||||
- name: Download Toolchain
|
||||
if: >-
|
||||
inputs.toolchain != 'arm-gcc' &&
|
||||
inputs.toolchain != 'esp-idf'
|
||||
uses: ./.github/actions/setup_toolchain/download
|
||||
with:
|
||||
toolchain_url: ${{ inputs.toolchain_url }}
|
29
.github/actions/setup_toolchain/download/action.yml
vendored
Normal file
29
.github/actions/setup_toolchain/download/action.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
name: Download Toolchain
|
||||
|
||||
inputs:
|
||||
toolchain_url:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Cache Toolchain
|
||||
uses: actions/cache@v4
|
||||
id: cache-toolchain
|
||||
with:
|
||||
path: ~/cache/toolchain
|
||||
key: ${{ runner.os }}-${{ inputs.toolchain_url }}
|
||||
|
||||
- name: Install Toolchain
|
||||
if: steps.cache-toolchain.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
mkdir -p ~/cache/toolchain
|
||||
wget --progress=dot:mega ${{ inputs.toolchain_url }} -O toolchain.tar.gz
|
||||
tar -C ~/cache/toolchain -xaf toolchain.tar.gz
|
||||
shell: bash
|
||||
|
||||
- name: Set Toolchain Path
|
||||
run: |
|
||||
echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
|
||||
shell: bash
|
70
.github/workflows/build_aarch64.yml
vendored
70
.github/workflows/build_aarch64.yml
vendored
@@ -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 }}
|
57
.github/workflows/build_arm.yml
vendored
57
.github/workflows/build_arm.yml
vendored
@@ -1,57 +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
|
||||
- 'mm32'
|
||||
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 }}
|
295
.github/workflows/build_cmake.yml
vendored
295
.github/workflows/build_cmake.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Build CMake
|
||||
name: Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -8,9 +8,11 @@ on:
|
||||
- 'examples/**'
|
||||
- 'lib/**'
|
||||
- 'hw/**'
|
||||
- 'test/hil/**'
|
||||
- 'tools/get_deps.py'
|
||||
- 'tools/build.py'
|
||||
- '.github/actions/**'
|
||||
- '.github/workflows/build_cmake.yml'
|
||||
- '.github/workflows/ci_set_matrix.py'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
@@ -18,141 +20,20 @@ on:
|
||||
- 'examples/**'
|
||||
- 'lib/**'
|
||||
- 'hw/**'
|
||||
- 'test/hil/**'
|
||||
- 'tools/get_deps.py'
|
||||
- 'tools/build.py'
|
||||
- '.github/actions/**'
|
||||
- '.github/workflows/build_cmake.yml'
|
||||
|
||||
- '.github/workflows/ci_set_matrix.py'
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# ---------------------------------------
|
||||
# Build ARM with GCC
|
||||
# ---------------------------------------
|
||||
arm-gcc:
|
||||
set-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
family:
|
||||
# Alphabetical order
|
||||
- 'broadcom_32bit'
|
||||
- 'imxrt'
|
||||
- 'kinetis_k kinetis_kl kinetis_k32l2'
|
||||
- 'lpc11 lpc13 lpc15'
|
||||
- 'lpc17 lpc18 lpc40 lpc43'
|
||||
- 'lpc51 lpc54 lpc55'
|
||||
- 'mcx'
|
||||
- 'msp432e4'
|
||||
- 'mm32'
|
||||
- 'nrf'
|
||||
- 'ra'
|
||||
- 'rp2040'
|
||||
- 'samd11 samd21 saml2x samd5x_e5x samg'
|
||||
- 'stm32f0'
|
||||
- 'stm32f1'
|
||||
- 'stm32f2'
|
||||
- 'stm32f3'
|
||||
- 'stm32f4'
|
||||
- 'stm32f7'
|
||||
- 'stm32g0'
|
||||
- 'stm32g4'
|
||||
- 'stm32h5'
|
||||
- 'stm32h7'
|
||||
- 'stm32l4'
|
||||
- 'stm32u5'
|
||||
- 'stm32wb'
|
||||
- 'tm4c'
|
||||
- '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: '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 }}
|
||||
env:
|
||||
PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk
|
||||
|
||||
- name: Upload Artifacts for Hardware Testing (rp2040)
|
||||
if: contains(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: contains(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: contains(matrix.family, 'samd5x_e5x') && 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'
|
||||
- 'samd5x_e5x'
|
||||
- 'stm32f0'
|
||||
- 'stm32f1'
|
||||
- 'stm32f2'
|
||||
- 'stm32f3'
|
||||
- 'stm32f4'
|
||||
- 'stm32f7'
|
||||
- 'stm32g0'
|
||||
- 'stm32g4'
|
||||
- 'stm32h5'
|
||||
- 'stm32h7'
|
||||
- 'stm32l4'
|
||||
- 'stm32u5'
|
||||
outputs:
|
||||
json: ${{ steps.set-matrix-json.outputs.matrix }}
|
||||
steps:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
@@ -162,137 +43,51 @@ jobs:
|
||||
- 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'
|
||||
- name: Generate matrix json
|
||||
id: set-matrix-json
|
||||
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
|
||||
env:
|
||||
PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk
|
||||
MATRIX_JSON=$(python .github/workflows/ci_set_matrix.py)
|
||||
echo "matrix=$MATRIX_JSON"
|
||||
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
|
||||
|
||||
# ---------------------------------------
|
||||
# Build MSP430 with GCC
|
||||
# Build CMake
|
||||
# ---------------------------------------
|
||||
msp430-gcc:
|
||||
runs-on: ubuntu-latest
|
||||
cmake:
|
||||
needs: set-matrix
|
||||
uses: ./.github/workflows/build_family.yml
|
||||
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 }}
|
||||
toolchain:
|
||||
- 'aarch64-gcc'
|
||||
- 'arm-clang'
|
||||
- 'arm-gcc'
|
||||
- 'msp430-gcc'
|
||||
- 'riscv-gcc'
|
||||
with:
|
||||
build-system: 'cmake'
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
toolchain_url: ${{ fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].toolchain_url }}
|
||||
build-family: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].family) }}
|
||||
|
||||
# ---------------------------------------
|
||||
# Hardware in the loop (HIL)
|
||||
# Current self-hosted instance is running on an RPI4. For attached hardware checkout hil_pi4.json
|
||||
# Build Make
|
||||
# ---------------------------------------
|
||||
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]
|
||||
make:
|
||||
needs: set-matrix
|
||||
uses: ./.github/workflows/build_family.yml
|
||||
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
|
||||
toolchain:
|
||||
- 'aarch64-gcc'
|
||||
#- 'arm-clang'
|
||||
- 'arm-gcc'
|
||||
- 'msp430-gcc'
|
||||
- 'riscv-gcc'
|
||||
with:
|
||||
build-system: 'make'
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
toolchain_url: ${{ fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].toolchain_url }}
|
||||
build-family: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].family) }}
|
||||
|
19
.github/workflows/build_esp.yml
vendored
19
.github/workflows/build_esp.yml
vendored
@@ -41,14 +41,16 @@ jobs:
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Pull ESP-IDF docker
|
||||
run: docker pull espressif/idf:latest
|
||||
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Toolchain
|
||||
uses: ./.github/actions/setup_toolchain
|
||||
with:
|
||||
toolchain: 'esp-idf'
|
||||
|
||||
- name: Build
|
||||
run: docker run --rm -v $PWD:/project -w /project espressif/idf:v5.1.1 python3 tools/build_esp32.py ${{ matrix.board }}
|
||||
run: docker run --rm -v $PWD:/project -w /project espressif/idf:v5.1.1 python3 tools/build.py -b ${{ matrix.board }}
|
||||
|
||||
- name: Upload Artifacts for Hardware Testing
|
||||
if: matrix.board == 'espressif_s3_devkitm' && github.repository_owner == 'hathach'
|
||||
@@ -91,13 +93,6 @@ jobs:
|
||||
# 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:
|
||||
@@ -111,4 +106,4 @@ jobs:
|
||||
|
||||
- name: Test on actual hardware
|
||||
run: |
|
||||
python3 test/hil/hil_test.py --board ${{ matrix.board }} hil_pi4.json
|
||||
python3 test/hil/hil_test.py --board ${{ matrix.board }} pi4_esp32.json
|
||||
|
64
.github/workflows/build_family.yml
vendored
Normal file
64
.github/workflows/build_family.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
name: Build family
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
build-system:
|
||||
required: true
|
||||
type: string
|
||||
toolchain:
|
||||
required: true
|
||||
type: string
|
||||
toolchain_url:
|
||||
required: true
|
||||
type: string
|
||||
build-family:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
family:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
family: ${{ fromJSON(inputs.build-family) }}
|
||||
steps:
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Setup Toolchain
|
||||
uses: ./.github/actions/setup_toolchain
|
||||
with:
|
||||
toolchain: ${{ inputs.toolchain }}
|
||||
toolchain_url: ${{ inputs.toolchain_url }}
|
||||
|
||||
- name: Checkout pico-sdk for rp2040
|
||||
if: contains(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
|
||||
pip install click
|
||||
python3 tools/get_deps.py ${{ matrix.family }}
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
OPTION=""
|
||||
if [[ "${{ inputs.toolchain }}" == *"clang"* ]]; then
|
||||
OPTION="--toolchain clang"
|
||||
fi
|
||||
echo "OPTION=$OPTION"
|
||||
python tools/build.py -s ${{ inputs.build-system }} $OPTION ${{ matrix.family }}
|
||||
env:
|
||||
PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk
|
4
.github/workflows/build_iar.yml
vendored
4
.github/workflows/build_iar.yml
vendored
@@ -52,8 +52,8 @@ jobs:
|
||||
run: python3 tools/get_deps.py ${{ matrix.family }}
|
||||
|
||||
- name: Build
|
||||
run: python3 tools/build_cmake.py ${{ matrix.family }} -DTOOLCHAIN=iar
|
||||
run: python3 tools/build.py --toolchain iar ${{ matrix.family }}
|
||||
|
||||
- name: Test on actual hardware (hardware in the loop)
|
||||
run: |
|
||||
python3 test/hil/hil_test.py hil_hfp.json
|
||||
python3 test/hil/hil_test.py hfp.json
|
||||
|
6
.github/workflows/build_renesas.yml
vendored
6
.github/workflows/build_renesas.yml
vendored
@@ -64,7 +64,9 @@ jobs:
|
||||
run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
|
||||
|
||||
- name: Get Dependencies
|
||||
run: python3 tools/get_deps.py ${{ matrix.family }}
|
||||
run: |
|
||||
pip install click
|
||||
python3 tools/get_deps.py ${{ matrix.family }}
|
||||
|
||||
- name: Build
|
||||
run: python3 tools/build_make.py ${{ matrix.family }}
|
||||
run: python3 tools/build.py -s make ${{ matrix.family }}
|
||||
|
71
.github/workflows/build_riscv.yml
vendored
71
.github/workflows/build_riscv.yml
vendored
@@ -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 }}
|
6
.github/workflows/build_win_mac.yml
vendored
6
.github/workflows/build_win_mac.yml
vendored
@@ -48,7 +48,9 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get Dependencies
|
||||
run: python3 tools/get_deps.py stm32f4
|
||||
run: |
|
||||
pip install click
|
||||
python3 tools/get_deps.py stm32f4
|
||||
|
||||
- name: Build
|
||||
run: python3 tools/build_make.py stm32f4 stm32f411disco
|
||||
run: python3 tools/build.py -s make stm32f2
|
||||
|
51
.github/workflows/ci_set_matrix.py
vendored
Normal file
51
.github/workflows/ci_set_matrix.py
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import json
|
||||
|
||||
# toolchain, url
|
||||
toolchain_list = {
|
||||
"aarch64-gcc": "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",
|
||||
"arm-clang": "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",
|
||||
"arm-gcc": "",
|
||||
"msp430-gcc": "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",
|
||||
"riscv-gcc": "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",
|
||||
}
|
||||
|
||||
# family: [supported toolchain]
|
||||
family_list = {
|
||||
"broadcom_32bit": ["arm-gcc"],
|
||||
"broadcom_64bit": ["aarch64-gcc"],
|
||||
"ch32v307 fomu gd32vf103": ["riscv-gcc"],
|
||||
"imxrt": ["arm-gcc", "arm-clang"],
|
||||
"kinetis_k kinetis_kl kinetis_k32l2": ["arm-gcc", "arm-clang"],
|
||||
"lpc11 lpc13 lpc15": ["arm-gcc"],
|
||||
"lpc17 lpc18 lpc40 lpc43": ["arm-gcc", "arm-clang"],
|
||||
"lpc51 lpc54 lpc55": ["arm-gcc", "arm-clang"],
|
||||
"mcx": ["arm-gcc"],
|
||||
"mm32": ["arm-gcc"],
|
||||
"msp430": ["msp430-gcc"],
|
||||
"msp432e4 tm4c": ["arm-gcc"],
|
||||
"nrf": ["arm-gcc", "arm-clang"],
|
||||
"ra": ["arm-gcc"],
|
||||
"rp2040": ["arm-gcc"],
|
||||
"samd11 samd21 saml2x": ["arm-gcc", "arm-clang"],
|
||||
"samd5x_e5x samg": ["arm-gcc", "arm-clang"],
|
||||
"stm32f0 stm32f1 stm32f2 stm32f3": ["arm-gcc", "arm-clang"],
|
||||
"stm32f4": ["arm-gcc", "arm-clang"],
|
||||
"stm32f7": ["arm-gcc", "arm-clang"],
|
||||
"stm32g0 stm32g4 stm32h5": ["arm-gcc", "arm-clang"],
|
||||
"stm32h7": ["arm-gcc", "arm-clang"],
|
||||
"stm32l4 stm32u5 stm32wb": ["arm-gcc", "arm-clang"],
|
||||
"xmc4000": ["arm-gcc"],
|
||||
}
|
||||
|
||||
|
||||
def set_matrix_json():
|
||||
matrix = {}
|
||||
for toolchain in toolchain_list.keys():
|
||||
filtered_families = [family for family, supported_toolchain in family_list.items() if
|
||||
toolchain in supported_toolchain]
|
||||
matrix[toolchain] = {"family": filtered_families, "toolchain_url": toolchain_list[toolchain]}
|
||||
print(json.dumps(matrix))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
set_matrix_json()
|
3
.github/workflows/cifuzz.yml
vendored
3
.github/workflows/cifuzz.yml
vendored
@@ -12,6 +12,7 @@ on:
|
||||
- '**.h'
|
||||
jobs:
|
||||
Fuzzing:
|
||||
if: false
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build Fuzzers
|
||||
@@ -20,12 +21,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
|
||||
|
||||
- name: Upload Crash
|
||||
uses: actions/upload-artifact@v4
|
||||
if: failure() && steps.build.outcome == 'success'
|
||||
|
3
.github/workflows/codeql-buildscript.sh
vendored
3
.github/workflows/codeql-buildscript.sh
vendored
@@ -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
|
||||
|
125
.github/workflows/hil_test.yml
vendored
Normal file
125
.github/workflows/hil_test.yml
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
name: Hardware Test
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- 'lib/**'
|
||||
- 'hw/**'
|
||||
- 'test/hil/**'
|
||||
- 'tools/get_deps.py'
|
||||
- '.github/actions/**'
|
||||
- '.github/workflows/hil_test.yml'
|
||||
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.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository_owner == 'hathach'
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
BOARD_LIST: ${{ steps.parse_hil_json.outputs.BOARD_LIST }}
|
||||
steps:
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- 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: Parse HIL json
|
||||
id: parse_hil_json
|
||||
run: |
|
||||
sudo apt install -y jq
|
||||
BOARD_LIST=$(jq -r '.boards[] | "-b " + .name' test/hil/pi4.json | tr '\n' ' ')
|
||||
echo "BOARD_LIST=$BOARD_LIST"
|
||||
echo >> $GITHUB_ENV "BOARD_LIST=$BOARD_LIST"
|
||||
echo >> $GITHUB_OUTPUT "BOARD_LIST=$BOARD_LIST"
|
||||
|
||||
- name: Checkout pico-sdk for rp2040
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: raspberrypi/pico-sdk
|
||||
ref: develop
|
||||
path: pico-sdk
|
||||
|
||||
- name: Get Dependencies
|
||||
run: |
|
||||
pip install click
|
||||
sudo apt install -y ninja-build
|
||||
python3 tools/get_deps.py $BOARD_LIST
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
python tools/build.py $BOARD_LIST
|
||||
env:
|
||||
PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk
|
||||
|
||||
- name: Upload Artifacts for Hardware Testing
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: hil_pi4
|
||||
path: |
|
||||
cmake-build/cmake-build-*/*/*/*.elf
|
||||
cmake-build/cmake-build-*/*/*/*.bin
|
||||
|
||||
# ---------------------------------------
|
||||
# Hardware in the loop (HIL)
|
||||
# Current self-hosted instance is running on an RPI4. For attached hardware checkout hil_pi4.json
|
||||
# ---------------------------------------
|
||||
hil-pi4:
|
||||
if: github.repository_owner == 'hathach'
|
||||
needs: build
|
||||
runs-on: [self-hosted, rp2040, nrf52840, hardware-in-the-loop]
|
||||
env:
|
||||
BOARD_LIST: ${{ needs.build.outputs.BOARD_LIST }}
|
||||
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
|
||||
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: test/hil
|
||||
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: hil_pi4
|
||||
path: cmake-build
|
||||
|
||||
- name: Test on actual hardware
|
||||
run: |
|
||||
echo "BOARD_LIST=$BOARD_LIST"
|
||||
python3 test/hil/hil_test.py $BOARD_LIST pi4.json
|
1
.github/workflows/pre-commit.yml
vendored
1
.github/workflows/pre-commit.yml
vendored
@@ -38,6 +38,7 @@ jobs:
|
||||
|
||||
- name: Build Fuzzer
|
||||
run: |
|
||||
pip install click
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
fuzz_harness=$(ls -d test/fuzz/device/*/)
|
||||
|
Reference in New Issue
Block a user