Skip to content

Commit eb53680

Browse files
authored
Merge pull request hathach#2124 from hathach/refactor-make-build
Refactor make build
2 parents 50e61e0 + 06d93e9 commit eb53680

File tree

158 files changed

+2203
-3229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+2203
-3229
lines changed

.github/workflows/build_arm.yml

Lines changed: 68 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,18 @@ jobs:
3434
family:
3535
# Alphabetical order
3636
- 'broadcom_32bit'
37-
- 'kinetis_k32l kinetis_kl'
37+
- 'kinetis_k32l2'
3838
- 'lpc11 lpc13 lpc15 lpc17'
39-
- 'lpc51 lpc54 lpc55'
39+
- 'lpc51 lpc54'
4040
- 'mm32 msp432e4'
4141
- 'nrf'
4242
- 'ra'
4343
- 'samd11 samd21'
4444
- 'samd51 same5x'
4545
- 'saml2x'
46-
- 'stm32f0 stm32f1 stm32f2 stm32f3'
46+
- 'stm32f2 stm32f3'
4747
- 'stm32f4'
48-
- 'stm32f7'
49-
- 'stm32h7'
50-
- 'stm32l0 stm32l4 stm32u5 stm32wb'
48+
- 'stm32l0 stm32u5 stm32wb'
5149
- 'tm4c123 xmc4000'
5250
steps:
5351
- name: Setup Python
@@ -103,67 +101,67 @@ jobs:
103101
path: |
104102
*.elf
105103
106-
# ---------------------------------------
107-
# Hardware in the loop (HIL)
108-
# Current self-hosted instance is running on an EPYC 7232 server hosted by HiFiPhile user
109-
# - STM32L412 Nucleo with on-board jlink as ttyACM0
110-
# ---------------------------------------
111-
hw-stm32l412nucleo-test:
112-
needs: build-arm
113-
runs-on: [self-hosted, Linux, X64, hifiphile]
114-
115-
steps:
116-
- name: Clean workspace
117-
run: |
118-
echo "Cleaning up previous run"
119-
rm -rf "${{ github.workspace }}"
120-
mkdir -p "${{ github.workspace }}"
121-
122-
- name: Download stm32l4 Artifacts
123-
uses: actions/download-artifact@v3
124-
with:
125-
name: stm32l4
126-
127-
- name: Create flash.sh
128-
run: |
129-
echo > flash.sh 'echo halt > flash.jlink'
130-
echo >> flash.sh 'echo r >> flash.jlink'
131-
echo >> flash.sh 'echo loadfile $1 >> flash.jlink'
132-
echo >> flash.sh 'echo r >> flash.jlink'
133-
echo >> flash.sh 'echo go >> flash.jlink'
134-
echo >> flash.sh 'echo exit >> flash.jlink'
135-
echo >> flash.sh 'cmdout=$(JLinkExe -device stm32l412kb -if swd -JTAGConf -1,-1 -speed auto -NoGui 1 -ExitOnError 1 -CommandFile flash.jlink)'
136-
echo >> flash.sh 'if (( $? )) ; then echo $cmdout ; fi'
137-
chmod +x flash.sh
138-
139-
- name: Test cdc_dual_ports
140-
run: |
141-
./flash.sh cdc_dual_ports.elf
142-
while (! ([ -e /dev/ttyACM1 ] && [ -e /dev/ttyACM2 ])) && [ $SECONDS -le 10 ]; do :; done
143-
test -e /dev/ttyACM1 && echo "ttyACM1 exists"
144-
test -e /dev/ttyACM2 && echo "ttyACM2 exists"
145-
146-
# Debian does not auto mount usb drive. skip this test for now
147-
- name: Test cdc_msc
148-
if: false
149-
run: |
150-
./flash.sh cdc_msc.elf
151-
readme='/media/pi/TinyUSB MSC/README.TXT'
152-
while (! ([ -e /dev/ttyACM1 ] && [ -f "$readme" ])) && [ $SECONDS -le 10 ]; do :; done
153-
test -e /dev/ttyACM1 && echo "ttyACM1 exists"
154-
test -f "$readme" && echo "$readme exists"
155-
cat "$readme"
156-
157-
- name: Test dfu
158-
run: |
159-
./flash.sh dfu.elf
160-
while (! (dfu-util -l | grep "Found DFU")) && [ $SECONDS -le 10 ]; do :; done
161-
dfu-util -d cafe -a 0 -U dfu0
162-
dfu-util -d cafe -a 1 -U dfu1
163-
grep "TinyUSB DFU! - Partition 0" dfu0
164-
grep "TinyUSB DFU! - Partition 1" dfu1
165-
166-
- name: Test dfu_runtime
167-
run: |
168-
./flash.sh dfu_runtime.elf
169-
while (! (dfu-util -l | grep "Found Runtime")) && [ $SECONDS -le 10 ]; do :; done
104+
# # ---------------------------------------
105+
# # Hardware in the loop (HIL)
106+
# # Current self-hosted instance is running on an EPYC 7232 server hosted by HiFiPhile user
107+
# # - STM32L412 Nucleo with on-board jlink as ttyACM0
108+
# # ---------------------------------------
109+
# hw-stm32l412nucleo-test:
110+
# needs: build-arm
111+
# runs-on: [self-hosted, Linux, X64, hifiphile]
112+
#
113+
# steps:
114+
# - name: Clean workspace
115+
# run: |
116+
# echo "Cleaning up previous run"
117+
# rm -rf "${{ github.workspace }}"
118+
# mkdir -p "${{ github.workspace }}"
119+
#
120+
# - name: Download stm32l4 Artifacts
121+
# uses: actions/download-artifact@v3
122+
# with:
123+
# name: stm32l4
124+
#
125+
# - name: Create flash.sh
126+
# run: |
127+
# echo > flash.sh 'echo halt > flash.jlink'
128+
# echo >> flash.sh 'echo r >> flash.jlink'
129+
# echo >> flash.sh 'echo loadfile $1 >> flash.jlink'
130+
# echo >> flash.sh 'echo r >> flash.jlink'
131+
# echo >> flash.sh 'echo go >> flash.jlink'
132+
# echo >> flash.sh 'echo exit >> flash.jlink'
133+
# echo >> flash.sh 'cmdout=$(JLinkExe -device stm32l412kb -if swd -JTAGConf -1,-1 -speed auto -NoGui 1 -ExitOnError 1 -CommandFile flash.jlink)'
134+
# echo >> flash.sh 'if (( $? )) ; then echo $cmdout ; fi'
135+
# chmod +x flash.sh
136+
#
137+
# - name: Test cdc_dual_ports
138+
# run: |
139+
# ./flash.sh cdc_dual_ports.elf
140+
# while (! ([ -e /dev/ttyACM1 ] && [ -e /dev/ttyACM2 ])) && [ $SECONDS -le 10 ]; do :; done
141+
# test -e /dev/ttyACM1 && echo "ttyACM1 exists"
142+
# test -e /dev/ttyACM2 && echo "ttyACM2 exists"
143+
#
144+
# # Debian does not auto mount usb drive. skip this test for now
145+
# - name: Test cdc_msc
146+
# if: false
147+
# run: |
148+
# ./flash.sh cdc_msc.elf
149+
# readme='/media/pi/TinyUSB MSC/README.TXT'
150+
# while (! ([ -e /dev/ttyACM1 ] && [ -f "$readme" ])) && [ $SECONDS -le 10 ]; do :; done
151+
# test -e /dev/ttyACM1 && echo "ttyACM1 exists"
152+
# test -f "$readme" && echo "$readme exists"
153+
# cat "$readme"
154+
#
155+
# - name: Test dfu
156+
# run: |
157+
# ./flash.sh dfu.elf
158+
# while (! (dfu-util -l | grep "Found DFU")) && [ $SECONDS -le 10 ]; do :; done
159+
# dfu-util -d cafe -a 0 -U dfu0
160+
# dfu-util -d cafe -a 1 -U dfu1
161+
# grep "TinyUSB DFU! - Partition 0" dfu0
162+
# grep "TinyUSB DFU! - Partition 1" dfu1
163+
#
164+
# - name: Test dfu_runtime
165+
# run: |
166+
# ./flash.sh dfu_runtime.elf
167+
# while (! (dfu-util -l | grep "Found Runtime")) && [ $SECONDS -le 10 ]; do :; done

.github/workflows/build_iar.yml

Lines changed: 82 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,6 @@ concurrency:
2323
cancel-in-progress: true
2424

2525
jobs:
26-
makefile:
27-
runs-on: [self-hosted, Linux, X64, hifiphile]
28-
strategy:
29-
fail-fast: false
30-
matrix:
31-
family:
32-
# Alphabetical order
33-
# Note: bundle multiple families into a matrix since there is only one self-hosted instance can
34-
# run IAR build. Too many matrix can hurt due to setup/teardown overhead.
35-
- 'stm32f0 stm32f1 stm32f7 stm32l4'
36-
steps:
37-
- name: Clean workspace
38-
run: |
39-
echo "Cleaning up previous run"
40-
rm -rf "${{ github.workspace }}"
41-
mkdir -p "${{ github.workspace }}"
42-
43-
- name: Checkout TinyUSB
44-
uses: actions/checkout@v3
45-
46-
- name: Get Dependencies
47-
run: python3 tools/get_deps.py ${{ matrix.family }}
48-
49-
- name: Build
50-
run: python3 tools/build_family.py ${{ matrix.family }} CC=iccarm
51-
5226
cmake:
5327
runs-on: [self-hosted, Linux, X64, hifiphile]
5428
strategy:
@@ -58,7 +32,7 @@ jobs:
5832
# Alphabetical order
5933
# Note: bundle multiple families into a matrix since there is only one self-hosted instance can
6034
# run IAR build. Too many matrix can hurt due to setup/teardown overhead.
61-
- 'stm32g0 stm32g4 stm32h7'
35+
- 'stm32f0 stm32f1 stm32f7 stm32g0 stm32g4 stm32h7 stm32l4'
6236
steps:
6337
- name: Clean workspace
6438
run: |
@@ -73,4 +47,84 @@ jobs:
7347
run: python3 tools/get_deps.py ${{ matrix.family }}
7448

7549
- name: Build
76-
run: python3 tools/build_cmake.py ${{ matrix.family }} -DTOOLCHAIN=iar
50+
run: python3 tools/build_cmake.py ${{ matrix.family }} -DTOOLCHAIN=iar -DCMAKE_BUILD_TYPE=MinSizeRel
51+
52+
# Upload binaries for hardware test with self-hosted
53+
- name: Prepare stm32l412nucleo Artifacts
54+
if: contains(matrix.family, 'stm32l4')
55+
working-directory: ${{github.workspace}}/cmake-build/cmake-build-stm32l412nucleo
56+
run: |
57+
find device/ -name "*.elf" -exec mv {} ../../ \;
58+
59+
- name: Upload Artifacts for stm32l412nucleo
60+
if: contains(matrix.family, 'stm32l4') && github.repository_owner == 'hathach'
61+
uses: actions/upload-artifact@v3
62+
with:
63+
name: stm32l4
64+
path: |
65+
*.elf
66+
67+
# ---------------------------------------
68+
# Hardware in the loop (HIL)
69+
# Current self-hosted instance is running on an EPYC 7232 server hosted by HiFiPhile user
70+
# - STM32L412 Nucleo with on-board jlink as ttyACM0
71+
# ---------------------------------------
72+
hw-stm32l412nucleo-test:
73+
needs: cmake
74+
runs-on: [self-hosted, Linux, X64, hifiphile]
75+
76+
steps:
77+
- name: Clean workspace
78+
run: |
79+
echo "Cleaning up previous run"
80+
rm -rf "${{ github.workspace }}"
81+
mkdir -p "${{ github.workspace }}"
82+
83+
- name: Download stm32l4 Artifacts
84+
uses: actions/download-artifact@v3
85+
with:
86+
name: stm32l4
87+
88+
- name: Create flash.sh
89+
run: |
90+
echo > flash.sh 'echo halt > flash.jlink'
91+
echo >> flash.sh 'echo r >> flash.jlink'
92+
echo >> flash.sh 'echo loadfile $1 >> flash.jlink'
93+
echo >> flash.sh 'echo r >> flash.jlink'
94+
echo >> flash.sh 'echo go >> flash.jlink'
95+
echo >> flash.sh 'echo exit >> flash.jlink'
96+
echo >> flash.sh 'cmdout=$(JLinkExe -device stm32l412kb -if swd -JTAGConf -1,-1 -speed auto -NoGui 1 -ExitOnError 1 -CommandFile flash.jlink)'
97+
echo >> flash.sh 'if (( $? )) ; then echo $cmdout ; fi'
98+
chmod +x flash.sh
99+
100+
- name: Test cdc_dual_ports
101+
run: |
102+
./flash.sh cdc_dual_ports.elf
103+
while (! ([ -e /dev/ttyACM1 ] && [ -e /dev/ttyACM2 ])) && [ $SECONDS -le 10 ]; do :; done
104+
test -e /dev/ttyACM1 && echo "ttyACM1 exists"
105+
test -e /dev/ttyACM2 && echo "ttyACM2 exists"
106+
107+
# Debian does not auto mount usb drive. skip this test for now
108+
- name: Test cdc_msc
109+
if: false
110+
run: |
111+
./flash.sh cdc_msc.elf
112+
readme='/media/pi/TinyUSB MSC/README.TXT'
113+
while (! ([ -e /dev/ttyACM1 ] && [ -f "$readme" ])) && [ $SECONDS -le 10 ]; do :; done
114+
test -e /dev/ttyACM1 && echo "ttyACM1 exists"
115+
test -f "$readme" && echo "$readme exists"
116+
cat "$readme"
117+
118+
- name: Test dfu
119+
run: |
120+
./flash.sh dfu.elf
121+
while (! (dfu-util -l | grep "Found DFU")) && [ $SECONDS -le 10 ]; do :; done
122+
dfu-util -d cafe -a 0 -U dfu0
123+
dfu-util -d cafe -a 1 -U dfu1
124+
grep "TinyUSB DFU! - Partition 0" dfu0
125+
grep "TinyUSB DFU! - Partition 1" dfu1
126+
127+
- name: Test dfu_runtime
128+
run: |
129+
./flash.sh dfu_runtime.elf
130+
while (! (dfu-util -l | grep "Found Runtime")) && [ $SECONDS -le 10 ]; do :; done

.github/workflows/cmake_arm.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,19 @@ jobs:
3333
matrix:
3434
family:
3535
# Alphabetical order
36+
- 'imxrt'
37+
- 'kinetis_kl'
3638
- 'lpc18'
39+
- 'lpc55'
3740
- 'mcx'
38-
- 'imxrt'
3941
- 'rp2040'
42+
- 'stm32f0'
43+
- 'stm32f1'
44+
- 'stm32f7'
4045
- 'stm32g0'
4146
- 'stm32g4'
47+
- 'stm32h7'
48+
- 'stm32l4'
4249
steps:
4350
- name: Setup Python
4451
uses: actions/setup-python@v4
@@ -68,7 +75,7 @@ jobs:
6875
run: python3 tools/get_deps.py ${{ matrix.family }}
6976

7077
- name: Build
71-
run: python tools/build_cmake.py ${{ matrix.family }}
78+
run: python tools/build_cmake.py ${{ matrix.family }} -DCMAKE_BUILD_TYPE=MinSizeRel
7279
env:
7380
# for rp2040, there is no harm if defined for other families
7481
PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk

examples/device/cdc_msc/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ INC += \
55
$(TOP)/hw \
66

77
# Example source
8-
EXAMPLE_SOURCE += $(wildcard src/*.c)
8+
EXAMPLE_SOURCE += \
9+
src/main.c \
10+
src/msc_disk.c \
11+
src/usb_descriptors.c \
12+
913
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
1014

1115
include ../../rules.mk

examples/device/cdc_msc_freertos/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ SRC_S += \
3737
# CFLAGS += -Wno-error=sign-compare
3838

3939
# Suppress FreeRTOSConfig.h warnings
40-
GCC_CFLAGS += -Wno-error=redundant-decls
40+
CFLAGS_GCC += -Wno-error=redundant-decls
4141

4242
# Suppress FreeRTOS source warnings
43-
GCC_CFLAGS += -Wno-error=cast-qual
43+
CFLAGS_GCC += -Wno-error=cast-qual
4444

4545
# FreeRTOS (lto + Os) linker issue
46-
LDFLAGS += -Wl,--undefined=vTaskSwitchContext
46+
LDFLAGS_GCC += -Wl,--undefined=vTaskSwitchContext
4747

4848
include ../../rules.mk

examples/device/hid_composite_freertos/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ SRC_S += \
3636
# CFLAGS += -Wno-error=sign-compare
3737

3838
# Suppress FreeRTOSConfig.h warnings
39-
GCC_CFLAGS += -Wno-error=redundant-decls
39+
CFLAGS_GCC += -Wno-error=redundant-decls
4040

4141
# Suppress FreeRTOS source warnings
42-
GCC_CFLAGS += -Wno-error=cast-qual
42+
CFLAGS_GCC += -Wno-error=cast-qual
4343

4444
# FreeRTOS (lto + Os) linker issue
45-
LDFLAGS += -Wl,--undefined=vTaskSwitchContext
45+
LDFLAGS_GCC += -Wl,--undefined=vTaskSwitchContext
4646

4747
include ../../rules.mk

examples/device/net_lwip_webserver/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ DEPS_SUBMODULES += lib/lwip
33
include ../../make.mk
44

55
# suppress warning caused by lwip
6-
GCC_CFLAGS += \
6+
CFLAGS_GCC += \
77
-Wno-error=null-dereference \
88
-Wno-error=unused-parameter \
99
-Wno-error=unused-variable

0 commit comments

Comments
 (0)