Skip to content

Commit 7cf1bdd

Browse files
authored
Ci tweak3 (#2643)
- enable --one-per-family to build 1 board per family, also skip family if board specified in -b also present - minimize ci run for push event - only build one board per family - skip hil test on both pi4 and hfp - full build will be runn for PR event - IAR always build 1 board per family regardless of event - update build.py to optimize make - remove all setup python since we don't really need it
1 parent 6f47746 commit 7cf1bdd

File tree

15 files changed

+166
-164
lines changed

15 files changed

+166
-164
lines changed

.github/actions/setup_toolchain/action.yml

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ runs:
3232
- name: Download Toolchain
3333
if: >-
3434
inputs.toolchain != 'arm-gcc' &&
35+
inputs.toolchain != 'arm-iar' &&
3536
inputs.toolchain != 'esp-idf'
3637
uses: ./.github/actions/setup_toolchain/download
3738
with:
@@ -44,6 +45,8 @@ runs:
4445
BUILD_OPTION=""
4546
if [[ "${{ inputs.toolchain }}" == *"clang"* ]]; then
4647
BUILD_OPTION="--toolchain clang"
48+
elif [[ "${{ inputs.toolchain }}" == "arm-iar" ]]; then
49+
BUILD_OPTION="--toolchain iar"
4750
fi
4851
echo "build_option=$BUILD_OPTION"
4952
echo "build_option=$BUILD_OPTION" >> $GITHUB_OUTPUT

.github/workflows/build.yml

+36-14
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ jobs:
3737
outputs:
3838
json: ${{ steps.set-matrix-json.outputs.matrix }}
3939
steps:
40-
- name: Setup Python
41-
uses: actions/setup-python@v5
42-
with:
43-
python-version: '3.x'
44-
4540
- name: Checkout TinyUSB
4641
uses: actions/checkout@v4
4742

@@ -63,27 +58,22 @@ jobs:
6358
matrix:
6459
toolchain:
6560
- 'aarch64-gcc'
66-
- 'arm-clang'
61+
# - 'arm-clang'
6762
- 'arm-gcc'
6863
- 'msp430-gcc'
6964
- 'riscv-gcc'
70-
if: >-
71-
matrix.toolchain != 'arm-clang' ||
72-
github.event_name == 'pull_request' ||
73-
(github.event_name == 'push' && github.ref == 'refs/heads/master')
7465
with:
7566
build-system: 'cmake'
7667
toolchain: ${{ matrix.toolchain }}
7768
toolchain_url: ${{ fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].toolchain_url }}
7869
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].family) }}
70+
one-per-family: ${{ github.event_name != 'pull_request' }}
7971

8072
# ---------------------------------------
8173
# Build Make
8274
# ---------------------------------------
8375
make:
84-
if: >-
85-
github.event_name == 'pull_request' ||
86-
(github.event_name == 'push' && github.ref == 'refs/heads/master')
76+
#if: github.event_name == 'pull_request'
8777
needs: set-matrix
8878
uses: ./.github/workflows/build_util.yml
8979
strategy:
@@ -100,6 +90,7 @@ jobs:
10090
toolchain: ${{ matrix.toolchain }}
10191
toolchain_url: ${{ fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].toolchain_url }}
10292
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].family) }}
93+
one-per-family: ${{ github.event_name != 'pull_request' }}
10394

10495
# ---------------------------------------
10596
# Build Make on Windows/MacOS
@@ -114,7 +105,8 @@ jobs:
114105
os: ${{ matrix.os }}
115106
build-system: 'make'
116107
toolchain: 'arm-gcc'
117-
build-args: '["-bstm32f411disco"]'
108+
build-args: '["stm32h7"]'
109+
one-per-family: true
118110

119111
# ---------------------------------------
120112
# Build Espressif
@@ -134,3 +126,33 @@ jobs:
134126
toolchain: 'esp-idf'
135127
toolchain_url: 'v5.1.1'
136128
build-args: '["-b${{ matrix.board }}"]'
129+
130+
# ---------------------------------------
131+
# Build IAR on HFP self-hosted
132+
# ---------------------------------------
133+
arm-iar:
134+
if: github.repository_owner == 'hathach'
135+
needs: set-matrix
136+
runs-on: [self-hosted, Linux, X64, hifiphile]
137+
env:
138+
BUILD_ARGS: ${{ join(fromJSON(needs.set-matrix.outputs.json)['arm-iar'].family, ' ') }}
139+
steps:
140+
- name: Clean workspace
141+
run: |
142+
echo "Cleaning up previous run"
143+
rm -rf "${{ github.workspace }}"
144+
mkdir -p "${{ github.workspace }}"
145+
146+
- name: Checkout TinyUSB
147+
uses: actions/checkout@v4
148+
149+
- name: Get Dependencies
150+
run: python3 tools/get_deps.py $BUILD_ARGS
151+
152+
- name: Build
153+
run: python3 tools/build.py --one-per-family --toolchain iar $BUILD_ARGS
154+
155+
- name: Test on actual hardware (hardware in the loop)
156+
if: github.event_name == 'pull_request'
157+
run: |
158+
python3 test/hil/hil_test.py hfp.json

.github/workflows/build_iar.yml

-50
This file was deleted.

.github/workflows/build_renesas.yml

-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ jobs:
3434
# Alphabetical order
3535
- 'rx'
3636
steps:
37-
- name: Setup Python
38-
uses: actions/setup-python@v5
39-
with:
40-
python-version: '3.x'
41-
4237
- name: Checkout TinyUSB
4338
uses: actions/checkout@v4
4439

.github/workflows/build_util.yml

+15-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
build-args:
1616
required: true
1717
type: string
18+
one-per-family:
19+
required: false
20+
default: false
21+
type: boolean
1822
os:
1923
required: false
2024
type: string
@@ -31,11 +35,6 @@ jobs:
3135
- name: Checkout TinyUSB
3236
uses: actions/checkout@v4
3337

34-
- name: Setup Python
35-
uses: actions/setup-python@v5
36-
with:
37-
python-version: '3.x'
38-
3938
- name: Setup Toolchain
4039
id: setup-toolchain
4140
uses: ./.github/actions/setup_toolchain
@@ -48,10 +47,20 @@ jobs:
4847
with:
4948
arg: ${{ matrix.arg }}
5049

50+
- name: Set build one-per-family option
51+
id: set-one-per-family
52+
run: |
53+
if [[ "${{ inputs.one-per-family }}" == "true" ]]; then
54+
BUILD_OPTION="--one-per-family"
55+
fi
56+
echo "build_option=$BUILD_OPTION"
57+
echo "build_option=$BUILD_OPTION" >> $GITHUB_OUTPUT
58+
shell: bash
59+
5160
- name: Build
5261
if: inputs.toolchain != 'esp-idf'
5362
run: |
54-
python tools/build.py -s ${{ inputs.build-system }} ${{ steps.setup-toolchain.outputs.build_option }} ${{ matrix.arg }}
63+
python tools/build.py -s ${{ inputs.build-system }} ${{ steps.setup-toolchain.outputs.build_option }} ${{ steps.set-one-per-family.outputs.build_option }} ${{ matrix.arg }}
5564
5665
- name: Build using ESP-IDF docker
5766
if: inputs.toolchain == 'esp-idf'

.github/workflows/ci_set_matrix.py

+16-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
toolchain_list = {
55
"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",
66
"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",
7+
"arm-iar": "",
78
"arm-gcc": "",
89
"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",
910
"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",
@@ -28,12 +29,12 @@
2829
"rp2040": ["arm-gcc"],
2930
"samd11 samd21 saml2x": ["arm-gcc", "arm-clang"],
3031
"samd5x_e5x samg": ["arm-gcc", "arm-clang"],
31-
"stm32f0 stm32f1 stm32f2 stm32f3": ["arm-gcc", "arm-clang"],
32-
"stm32f4": ["arm-gcc", "arm-clang"],
33-
"stm32f7": ["arm-gcc", "arm-clang"],
34-
"stm32g0 stm32g4 stm32h5": ["arm-gcc", "arm-clang"],
35-
"stm32h7": ["arm-gcc", "arm-clang"],
36-
"stm32l4 stm32u5 stm32wb": ["arm-gcc", "arm-clang"],
32+
"stm32f0 stm32f1 stm32f2 stm32f3": ["arm-gcc", "arm-clang", "arm-iar"],
33+
"stm32f4": ["arm-gcc", "arm-clang", "arm-iar"],
34+
"stm32f7": ["arm-gcc", "arm-clang", "arm-iar"],
35+
"stm32g0 stm32g4 stm32h5": ["arm-gcc", "arm-clang", "arm-iar"],
36+
"stm32h7": ["arm-gcc", "arm-clang", "arm-iar"],
37+
"stm32l4 stm32u5 stm32wb": ["arm-gcc", "arm-clang", "arm-iar"],
3738
"xmc4000": ["arm-gcc"],
3839
}
3940

@@ -43,7 +44,16 @@ def set_matrix_json():
4344
for toolchain in toolchain_list.keys():
4445
filtered_families = [family for family, supported_toolchain in family_list.items() if
4546
toolchain in supported_toolchain]
47+
48+
# always add board in hfp.json for arm-iar
49+
if toolchain == 'arm-iar':
50+
with open('test/hil/hfp.json') as f:
51+
hfp_data = json.load(f)
52+
hfp_boards = [f"-b{board['name']}" for board in hfp_data['boards']]
53+
filtered_families = filtered_families + hfp_boards
54+
4655
matrix[toolchain] = {"family": filtered_families, "toolchain_url": toolchain_list[toolchain]}
56+
4757
print(json.dumps(matrix))
4858

4959

.github/workflows/hil_test.yml

+1-11
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ jobs:
3030
- name: Checkout TinyUSB
3131
uses: actions/checkout@v4
3232

33-
- name: Setup Python
34-
uses: actions/setup-python@v5
35-
with:
36-
python-version: '3.x'
37-
3833
- name: Parse HIL json
3934
id: parse_hil_json
4035
run: |
@@ -78,11 +73,6 @@ jobs:
7873
- name: Checkout TinyUSB
7974
uses: actions/checkout@v4
8075

81-
- name: Setup Python
82-
uses: actions/setup-python@v5
83-
with:
84-
python-version: '3.x'
85-
8676
- name: Parse HIL json
8777
id: parse_hil_json
8878
run: |
@@ -131,7 +121,7 @@ jobs:
131121
- build-esp
132122
runs-on: [self-hosted, rp2040, nrf52840, esp32s3, hardware-in-the-loop]
133123
env:
134-
BOARDS_LIST: "${{ needs.build.outputs.BOARDS_LIST }} ${{ needs.build-esp.outputs.BOARDS_LIST }}"
124+
BOARDS_LIST: "${{ needs.build.outputs.BOARDS_LIST }} ${{ needs.build-esp.outputs.BOARDS_LIST }}"
135125
steps:
136126
- name: Clean workspace
137127
run: |

.github/workflows/pre-commit.yml

-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ jobs:
1414
pre-commit:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- name: Setup Python
18-
uses: actions/setup-python@v5
19-
with:
20-
python-version: '3.x'
21-
2217
- name: Setup Ruby
2318
uses: ruby/setup-ruby@v1
2419
with:

hw/bsp/stm32f0/family.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void board_init(void) {
115115
//--------------------------------------------------------------------+
116116

117117
void board_led_write(bool state) {
118-
GPIO_PinState pin_state = (GPIO_PinState)(state ? LED_STATE_ON : (1 - LED_STATE_ON));
118+
GPIO_PinState pin_state = (GPIO_PinState) (state ? LED_STATE_ON : (1 - LED_STATE_ON));
119119
HAL_GPIO_WritePin(LED_PORT, LED_PIN, pin_state);
120120
}
121121

hw/bsp/stm32f1/family.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void board_init(void) {
124124
//--------------------------------------------------------------------+
125125

126126
void board_led_write(bool state) {
127-
GPIO_PinState pin_state = (GPIO_PinState)(state ? LED_STATE_ON : (1 - LED_STATE_ON));
127+
GPIO_PinState pin_state = (GPIO_PinState) (state ? LED_STATE_ON : (1 - LED_STATE_ON));
128128
HAL_GPIO_WritePin(LED_PORT, LED_PIN, pin_state);
129129
}
130130

hw/bsp/stm32f2/family.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ void board_init(void) {
108108
//--------------------------------------------------------------------+
109109

110110
void board_led_write(bool state) {
111-
HAL_GPIO_WritePin(LED_PORT, LED_PIN, state ? LED_STATE_ON : (1 - LED_STATE_ON));
111+
GPIO_PinState pin_state = (GPIO_PinState) (state ? LED_STATE_ON : (1 - LED_STATE_ON));
112+
HAL_GPIO_WritePin(LED_PORT, LED_PIN, pin_state);
112113
}
113114

114115
uint32_t board_button_read(void) {

hw/bsp/stm32f3/family.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ void board_init(void) {
108108
//--------------------------------------------------------------------+
109109

110110
void board_led_write(bool state) {
111-
HAL_GPIO_WritePin(LED_PORT, LED_PIN, state ? LED_STATE_ON : (1 - LED_STATE_ON));
111+
GPIO_PinState pin_state = (GPIO_PinState) (state ? LED_STATE_ON : (1 - LED_STATE_ON));
112+
HAL_GPIO_WritePin(LED_PORT, LED_PIN, pin_state);
112113
}
113114

114115
uint32_t board_button_read(void) {
@@ -142,7 +143,7 @@ uint32_t board_millis(void) {
142143
#endif
143144

144145
void HardFault_Handler(void) {
145-
asm("bkpt");
146+
asm("bkpt 0");
146147
}
147148

148149
// Required by __libc_init_array in startup code if we are compiling using

hw/bsp/stm32u5/family.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ void board_init(void) {
203203
//--------------------------------------------------------------------+
204204

205205
void board_led_write(bool state) {
206-
HAL_GPIO_WritePin(LED_PORT, LED_PIN, state ? LED_STATE_ON : (1 - LED_STATE_ON));
206+
GPIO_PinState pin_state = (GPIO_PinState) (state ? LED_STATE_ON : (1 - LED_STATE_ON));
207+
HAL_GPIO_WritePin(LED_PORT, LED_PIN, pin_state);
207208
}
208209

209210
uint32_t board_button_read(void) {

hw/bsp/stm32wb/family.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ void board_init(void) {
136136
//--------------------------------------------------------------------+
137137

138138
void board_led_write(bool state) {
139-
HAL_GPIO_WritePin(LED_PORT, LED_PIN, state ? LED_STATE_ON : (1 - LED_STATE_ON));
139+
GPIO_PinState pin_state = (GPIO_PinState) (state ? LED_STATE_ON : (1 - LED_STATE_ON));
140+
HAL_GPIO_WritePin(LED_PORT, LED_PIN, pin_state);
140141
}
141142

142143
uint32_t board_button_read(void) {
@@ -174,7 +175,7 @@ uint32_t board_millis(void) {
174175
#endif
175176

176177
void HardFault_Handler(void) {
177-
asm("bkpt");
178+
asm("bkpt 1");
178179
}
179180

180181
// Required by __libc_init_array in startup code if we are compiling using

0 commit comments

Comments
 (0)