Skip to content

Commit a12adb9

Browse files
authored
Build and integrate slave firmware (#117)
1 parent 3cba39d commit a12adb9

File tree

4 files changed

+217
-5
lines changed

4 files changed

+217
-5
lines changed

.github/workflows/parallel_build.yaml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: IDF v5.4 parallel build
2+
3+
on:
4+
workflow_dispatch: # Manually start a workflow
5+
6+
jobs:
7+
build-libs:
8+
name: Build Libs for ${{ matrix.target }}
9+
runs-on: macos-14
10+
strategy:
11+
matrix:
12+
target: [esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c6, esp32h2, esp32p4]
13+
fail-fast: true
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.11'
20+
- name: Install dependencies
21+
run: bash ./tools/prepare-ci.sh
22+
- name: Get current branch
23+
run: |
24+
echo "GIT_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
25+
- name: Build Libs for ${{ matrix.target }}
26+
run: bash ./build.sh -e -t ${{ matrix.target }}
27+
- name: Upload artifacts for ${{ matrix.target }}
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: artifacts-${{ matrix.target }}
31+
path: dist
32+
33+
build-slave_firmware:
34+
name: Build Slave Firmware
35+
runs-on: macos-14
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Set up Python
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: '3.11'
42+
- name: Install dependencies
43+
run: bash ./tools/prepare-ci.sh
44+
- name: Build slave firmware
45+
run: |
46+
bash ./tools/compile_slave.sh
47+
- name: Upload artifacts
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: slave_firmware
51+
path: wifi_copro_fw
52+
53+
combine-artifacts:
54+
name: Combine artifacts and create framework
55+
needs: [build-libs, build-slave_firmware]
56+
runs-on: macos-14
57+
steps:
58+
- uses: actions/checkout@v4
59+
- name: Set up Python
60+
uses: actions/setup-python@v5
61+
with:
62+
python-version: '3.11'
63+
- name: Download build artifacts
64+
uses: actions/download-artifact@v4
65+
with:
66+
path: dist
67+
pattern: artifacts-*
68+
merge-multiple: true
69+
- name: Download slave firmware
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: slave_firmware
73+
path: slave_firmware
74+
- name: Create complete framework
75+
run: |
76+
mkdir -p out dist/framework-arduinoespressif32
77+
# Combine all target builds
78+
for zip_file in dist/artifacts-*/framework-arduinoespressif32-*.zip; do
79+
echo "Processing $zip_file"
80+
unzip -q "$zip_file" -d out
81+
done
82+
# Remove Arduino IDE specific files (not needed for PlatformIO)
83+
rm -f out/package_esp32_index.template.json
84+
# Copy framework files
85+
cp -r out/* dist/framework-arduinoespressif32/
86+
# Integrate slave firmware directly
87+
mkdir -p dist/framework-arduinoespressif32/tools/slave_firmware
88+
cp -r slave_firmware/* dist/framework-arduinoespressif32/tools/slave_firmware/
89+
# Create final framework ZIP
90+
(cd dist && zip -qr framework-arduinoespressif32.zip framework-arduinoespressif32)
91+
92+
- name: Upload framework artifact
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: framework
96+
path: |
97+
dist/framework*
98+
dist/release-info.txt
99+
100+
release_framework:
101+
name: Release Framework
102+
needs: combine-artifacts
103+
runs-on: macos-14
104+
steps:
105+
- uses: actions/checkout@v4
106+
- name: Download complete framework
107+
uses: actions/download-artifact@v4
108+
with:
109+
name: framework
110+
path: dist
111+
- name: Release
112+
uses: jason2866/[email protected]
113+
with:
114+
tag_name: ${{ github.run_number }}
115+
body_path: dist/release-info.txt
116+
prerelease: true
117+
files: |
118+
dist/framework*
119+
dist/release-info.txt
120+
env:
121+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/push.yml

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,62 @@ jobs:
1818
run: |
1919
echo "GIT_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
2020
- name: Build Arduino Libs
21-
env:
22-
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
23-
GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }}
2421
run: bash ./build.sh
22+
- name: Upload artifacts
23+
uses: actions/upload-artifact@v4
24+
with:
25+
name: framework
26+
path: |
27+
dist/framework*
28+
release-info.txt
29+
30+
build-slave_firmware:
31+
name: Build Slave Firmware
32+
runs-on: macos-14
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: Set up Python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: '3.11'
39+
- name: Install dependencies
40+
run: bash ./tools/prepare-ci.sh
41+
- name: Build slave firmware
42+
run: |
43+
bash ./tools/compile_slave.sh
44+
- name: Upload artifacts
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: slave_firmware
48+
path: wifi_copro_fw
49+
50+
release_framework:
51+
name: Release Framework
52+
needs: [build-libs, build-slave_firmware]
53+
runs-on: macos-14
54+
steps:
55+
- uses: actions/checkout@v4
56+
- name: Set up Python
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: '3.11'
60+
- name: Download framework artifact
61+
uses: actions/download-artifact@v4
62+
with:
63+
name: framework
64+
path: .
65+
- name: Download slave_firmware artifact
66+
uses: actions/download-artifact@v4
67+
with:
68+
name: slave_firmware
69+
path: slave_firmware
70+
- name: Add slave_firmware to framework zip
71+
run: |
72+
FRAMEWORK_ZIP=$(ls dist/framework*.zip | head -n 1)
73+
unzip -q "$FRAMEWORK_ZIP" -d dist/unpacked
74+
mkdir -p dist/unpacked/framework-arduinoespressif32/tools/slave_firmware
75+
cp -r slave_firmware/* dist/unpacked/framework-arduinoespressif32/tools/slave_firmware/
76+
(cd dist/unpacked && zip -qr ../$(basename "$FRAMEWORK_ZIP") .)
2577
- name: Release
2678
uses: jason2866/[email protected]
2779
with:

tools/compile_slave.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
# This script is used to build the slave image for wifi_hosted
4+
5+
export IDF_CCACHE_ENABLE=${CCACHE_ENABLE:-1}
6+
7+
rm -rf dependencies.lock
8+
9+
echo "* Installing/Updating ESP-IDF and all components..."
10+
11+
source ./tools/install-esp-idf.sh
12+
if [ $? -ne 0 ]; then exit 1; fi
13+
14+
15+
slave_targets=(
16+
"esp32"
17+
"esp32s3"
18+
"esp32c2"
19+
"esp32c3"
20+
# "esp32c5"
21+
"esp32c6"
22+
)
23+
24+
idf.py create-project-from-example "espressif/esp_hosted:slave"
25+
mkdir wifi_copro_fw
26+
cd ./slave
27+
echo "Found firmware version: $(<./main/coprocessor_fw_version.txt)"
28+
29+
for target in "${slave_targets[@]}"; do
30+
echo "Building for target: $target"
31+
idf.py set-target "$target"
32+
idf.py clean
33+
idf.py build
34+
cp ./build/network_adapter.bin ../wifi_copro_fw/network_adapter_"$target".bin
35+
echo "Build completed for target: $target"
36+
done
37+
38+
cp ./main/coprocessor_fw_version.txt ../wifi_copro_fw/coprocessor_fw_version.txt

tools/prepare-ci.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ brew install gawk
1212
brew install gperf
1313
#brew install ninja
1414
brew install ccache
15-
python -m pip install --upgrade pip
16-
pip install wheel future pyelftools
15+
python -m pip install uv
16+
uv venv
17+
uv pip install future pyelftools

0 commit comments

Comments
 (0)