summaryrefslogtreecommitdiff
path: root/.github/workflows/build_tests.yml
blob: 7fa1edb302961e8c2fa71837d846d874293b6601 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
name: Build Tests

on:
  push:
  pull_request:

jobs:
  build_hpmicro:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Install dependencies
        run: sudo apt-get update && sudo apt-get install -y cmake ninja-build

      - name: Download hpm_sdk
        run: |
          cd ~
          git clone https://github.com/hpmicro/hpm_sdk.git

      - name: Download RISC-V toolchain
        run: |
          cd ~
          wget https://github.com/hpmicro/riscv-gnu-toolchain/releases/download/2023.10.18/rv32imac_zicsr_zifencei_multilib_b_ext-linux.tar.gz
          tar -xzf rv32imac_zicsr_zifencei_multilib_b_ext-linux.tar.gz

      - name: Build hpm demo
        run: |
          export HPM_SDK_BASE=~/hpm_sdk
          export GNURISCV_TOOLCHAIN_PATH=~/rv32imac_zicsr_zifencei_multilib_b_ext-linux
          export HPM_SDK_TOOLCHAIN_VARIANT=
          cd tests/hpmicro
          cmake -S . -B build -GNinja -DBOARD=hpm6800evk -DHPM_BUILD_TYPE=flash_sdram_xip -DCMAKE_BUILD_TYPE=debug -DEXTRA_C_FLAGS="-Werror";cmake --build build

  build_bouffalolab:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Install dependencies
        run: sudo apt-get update && sudo apt-get install -y cmake make

      - name: Download bouffalo_sdk
        run: |
          cd ~
          git clone https://github.com/bouffalolab/bouffalo_sdk.git -b v2.3.37

      - name: Download RISC-V toolchain
        run: |
          cd ~
          git clone https://github.com/CherryUSB/toolchain_gcc_t-head_linux.git

      - name: Build bouffalo demo
        run: |
          export BL_SDK_BASE=~/bouffalo_sdk
          export PATH=~/toolchain_gcc_t-head_linux/bin:$PATH
          cd tests/bouffalolab
          make CHIP=bl616 BOARD=bl616dk -j12

  build_espressif:
    strategy:
      matrix:
        idf_ver: ["latest"]
    runs-on: ubuntu-latest
    container: espressif/idf:${{ matrix.idf_ver }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Build espressif demo
        shell: bash
        run: |
          . ${IDF_PATH}/export.sh
          pip install idf-component-manager ruamel.yaml idf-build-apps --upgrade
          idf-build-apps build -p ./tests/espressif --recursive --target esp32s3

  build_rtthread:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Install dependencies
        run: |
          sudo apt-get update
          wget https://raw.githubusercontent.com/RT-Thread/env/master/install_ubuntu.sh
          chmod 777 install_ubuntu.sh
          ./install_ubuntu.sh

      - name: Download sdk-bsp-stm32h7r-realthread-artpi2
        run: |
          cd ~
          git clone https://github.com/sakumisu/sdk-bsp-stm32h7r-realthread-artpi2.git

      - name: Download ARM toolchain
        run: |
          cd ~
          wget -c https://github.com/RT-Thread/toolchains-ci/releases/download/v1.8/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz
          sudo tar -xf arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz -C /opt
          /opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc --version

      - name: Build rtthread demo
        run: |
          rm -rf ~/sdk-bsp-stm32h7r-realthread-artpi2/projects/art_pi2_cherryusb_usbhost/packages/CherryUSB-latest
          cp ../CherryUSB ~/sdk-bsp-stm32h7r-realthread-artpi2/projects/art_pi2_cherryusb_usbhost/packages/CherryUSB-latest -r
          rm -rf ~/sdk-bsp-stm32h7r-realthread-artpi2/projects/art_pi2_cherryusb_usbdev_cdc_acm/packages/CherryUSB-latest
          cp ../CherryUSB ~/sdk-bsp-stm32h7r-realthread-artpi2/projects/art_pi2_cherryusb_usbdev_cdc_acm/packages/CherryUSB-latest -r
          cd ~/sdk-bsp-stm32h7r-realthread-artpi2
          source ~/.env/env.sh
          export RTT_ROOT=~/sdk-bsp-stm32h7r-realthread-artpi2/rt-thread
          export RTT_CC=gcc
          export RTT_EXEC_PATH=/opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin
          cd ~/sdk-bsp-stm32h7r-realthread-artpi2/projects/art_pi2_cherryusb_usbdev_cdc_acm
          scons -j8
          cd ~/sdk-bsp-stm32h7r-realthread-artpi2/projects/art_pi2_cherryusb_usbhost
          scons -j8

  build_wch:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Install dependencies
        run: sudo apt-get update && sudo apt-get install -y make

      - name: Download wch demo repo
        run: |
          cd ~
          git clone https://github.com/CherryUSB/wch-support-cherryusb.git --recursive

      - name: Download RISC-V toolchain
        run: |
          cd ~
          wget https://github.com/CherryUSB/wch-support-cherryusb/releases/download/v1.0/MRS_Toolchain_Linux_X64_V240.tar.xz
          tar -xJf MRS_Toolchain_Linux_X64_V240.tar.xz

      - name: Build wch demo
        run: |
          rm -rf ~/wch-support-cherryusb/CherryUSB
          cp ../CherryUSB ~/wch-support-cherryusb/CherryUSB -r
          export PATH=~/Toolchain/riscv32-wch-elf-gcc/bin:$PATH
          cd ~/wch-support-cherryusb
          make all -j8 CHIP=ch32h417qeu6 IP=usbfs
          make clear
          make all -j8 CHIP=ch32h417qeu6 IP=usbhs

  build_sifli:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Install dependencies
        run: sudo apt-get install git wget flex bison gperf cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0

      - name: Download sifli_sdk
        run: |
          cd ~
          git clone https://github.com/OpenSiFli/SiFli-SDK --recursive -b release/v2.5

      - name: Build sifli demo
        run: |
          rm -rf ~/SiFli-SDK/external/cherryusb
          cp ../CherryUSB ~/SiFli-SDK/external/cherryusb -r
          cd ~/SiFli-SDK
          curl -LsSf https://astral.sh/uv/install.sh | sh
          ./install.sh
          . export.sh
          cd ~/SiFli-SDK/example/cherryusb/device/cdc_hid_msc/project
          scons --board=sf32lb52-lcd_n16r8 -j8
          cd ~/SiFli-SDK/example/cherryusb/host/msc_host/project
          scons --board=sf32lb52-lcd_n16r8 -j8

  build_phytium:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Install dependencies
        run: sudo apt-get update && sudo apt-get install -y make

      - name: Download phytium-free-rtos-sdk
        run: |
          cd ~
          git config --global http.version HTTP/1.1
          git config --global http.postBuffer 524288000
          git clone https://gitee.com/phytium_embedded/phytium-free-rtos-sdk.git
          cd ~/phytium-free-rtos-sdk
          git checkout 1e6f4ca501d9cd92a99204193939e45df6b8502d
          ./install.py

      - name: Download toolchain
        run: |
          cd ~
          git clone https://github.com/CherryUSB/phytium_env_ubuntu_x64

      - name: Patch setup_dev.py
        run: |
          python3 <<'PY'
          import pathlib
          p = pathlib.Path('/home/runner/phytium_env_ubuntu_x64/setup_dev.py')
          text = p.read_text()
          text = text.replace('platform.processor()', 'platform.machine()')
          text = text.replace(
              "re.search('MSYS_NT', platform.system()).span() == (0, len('MSYS_NT'))",
              "platform.system().startswith('MSYS_NT')"
          )
          text = text.replace('"sed -i ', 'r"sed -i ')
          p.write_text(text)
          PY

      - name: Build phytium demo
        run: |
          rm -rf ~/phytium-free-rtos-sdk/standalone/third-party/cherryusb/class
          rm -rf ~/phytium-free-rtos-sdk/standalone/third-party/cherryusb/core
          rm -rf ~/phytium-free-rtos-sdk/standalone/third-party/cherryusb/common
          rm -rf ~/phytium-free-rtos-sdk/standalone/third-party/cherryusb/osal
          rm -rf ~/phytium-free-rtos-sdk/standalone/third-party/cherryusb/port
          rm -rf ~/phytium-free-rtos-sdk/standalone/third-party/cherryusb/demo
          cp -r ../CherryUSB/class ~/phytium-free-rtos-sdk/standalone/third-party/cherryusb/class
          cp -r ../CherryUSB/core ~/phytium-free-rtos-sdk/standalone/third-party/cherryusb/core
          cp -r ../CherryUSB/common ~/phytium-free-rtos-sdk/standalone/third-party/cherryusb/common
          cp -r ../CherryUSB/osal ~/phytium-free-rtos-sdk/standalone/third-party/cherryusb/osal
          cp -r ../CherryUSB/port ~/phytium-free-rtos-sdk/standalone/third-party/cherryusb/port
          cp -r ../CherryUSB/demo ~/phytium-free-rtos-sdk/standalone/third-party/cherryusb/demo
          cd ~/phytium_env_ubuntu_x64
          ./setup_dev.py
          source /etc/profile.d/phytium_dev.sh
          mkdir -p ~/output
          cd ~/phytium-free-rtos-sdk/example/peripheral/usb/usb_device
          make load_kconfig LOAD_CONFIG_NAME=pe2204_aarch64_demo_pusb2_lib
          make clean image USR_BOOT_DIR=~/output
          make load_kconfig LOAD_CONFIG_NAME=pe2204_aarch32_demo_pusb2_hardfp_lib
          make clean image USR_BOOT_DIR=~/output
          make load_kconfig LOAD_CONFIG_NAME=pe2204_aarch32_demo_pusb2_softfp_lib
          make clean image USR_BOOT_DIR=~/output
          cd ~/phytium-free-rtos-sdk/example/peripheral/usb/usb_host
          make load_kconfig LOAD_CONFIG_NAME=pe2204_aarch64_demo_xhci
          make clean image USR_BOOT_DIR=~/output
          make load_kconfig LOAD_CONFIG_NAME=pe2204_aarch32_demo_xhci_hardfp
          make clean image USR_BOOT_DIR=~/output
          make load_kconfig LOAD_CONFIG_NAME=pe2204_aarch32_demo_xhci_softfp
          make clean image USR_BOOT_DIR=~/output
          make load_kconfig LOAD_CONFIG_NAME=pe2204_aarch64_demo_pusb2
          make clean image USR_BOOT_DIR=~/output
          make load_kconfig LOAD_CONFIG_NAME=pe2204_aarch32_demo_pusb2_hardfp
          make clean image USR_BOOT_DIR=~/output
          make load_kconfig LOAD_CONFIG_NAME=pe2204_aarch32_demo_pusb2_softfp
          make clean image USR_BOOT_DIR=~/output