Skip to content

Commit 335260e

Browse files
authored
Add CONFIG_ESP_HOSTED_IDF_SLAVE_TARGET="<slave_fw_version>" to sdkconfig (#121)
1 parent 413cc9c commit 335260e

File tree

2 files changed

+55
-8
lines changed

2 files changed

+55
-8
lines changed

.github/workflows/parallel_build.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
uses: actions/upload-artifact@v4
5050
with:
5151
name: slave_firmware
52-
path: wifi_copro_fw
52+
path: ./esp-hosted-mcu/slave/wifi_copro_fw
5353

5454
combine-artifacts:
5555
name: Combine artifacts and create framework
@@ -82,6 +82,29 @@ jobs:
8282
echo "IDF_BRANCH=$IDF_BRANCH"
8383
echo "IDF_COMMIT=$IDF_COMMIT"
8484
idf_version_string="${IDF_BRANCH//\//_}-$IDF_COMMIT"
85+
86+
# Update sdkconfig files with slave firmware version
87+
if [ -f "framework-arduinoespressif32/tools/slave_firmware/coprocessor_fw_version.txt" ]; then
88+
FIRMWARE_VERSION=$(cat framework-arduinoespressif32/tools/slave_firmware/coprocessor_fw_version.txt)
89+
echo "Found firmware version: $FIRMWARE_VERSION"
90+
91+
# Array of MCU targets that need sdkconfig updates
92+
mcu_targets=("esp32" "esp32s2" "esp32s3" "esp32c2" "esp32c3" "esp32c5" "esp32c6" "esp32h2" "esp32p4")
93+
94+
for mcu in "${mcu_targets[@]}"; do
95+
sdkconfig_path="framework-arduinoespressif32/tools/esp32-arduino-libs/$mcu/sdkconfig"
96+
if [ -f "$sdkconfig_path" ]; then
97+
echo "Updating $sdkconfig_path with firmware version: $FIRMWARE_VERSION"
98+
# Remove existing CONFIG_ESP_HOSTED_IDF_SLAVE_TARGET line and add new one at the beginning
99+
sed -i -e '/^CONFIG_ESP_HOSTED_IDF_SLAVE_TARGET/d' -e "1i CONFIG_ESP_HOSTED_IDF_SLAVE_TARGET=\"$FIRMWARE_VERSION\"" "$sdkconfig_path"
100+
else
101+
echo "Warning: sdkconfig file not found at $sdkconfig_path"
102+
fi
103+
done
104+
else
105+
echo "Warning: coprocessor_fw_version.txt not found"
106+
fi
107+
85108
7z a -mx=9 -tzip -xr'!.*' framework-arduinoespressif32-${idf_version_string}.zip framework-arduinoespressif32/
86109
87110
- name: Set tag name

tools/compile_slave.sh

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ echo "* Installing/Updating ESP-IDF and all components..."
1111
source ./tools/install-esp-idf.sh
1212
if [ $? -ne 0 ]; then exit 1; fi
1313

14+
# use fork until upstream bugs are fixed
15+
git clone --depth 1 https://github.com/Jason2866/esp-hosted-mcu.git || {
16+
echo "Failed to clone esp-hosted-mcu"; exit 1; }
17+
cd esp-hosted-mcu/slave || exit 1
18+
mkdir wifi_copro_fw
1419

1520
slave_targets=(
1621
"esp32"
@@ -21,18 +26,37 @@ slave_targets=(
2126
"esp32c6"
2227
)
2328

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-
2929
for target in "${slave_targets[@]}"; do
3030
echo "Building for target: $target"
3131
idf.py set-target "$target"
3232
idf.py clean
3333
idf.py build
34-
cp ./build/network_adapter.bin ../wifi_copro_fw/network_adapter_"$target".bin
34+
cp ./build/network_adapter.bin ./wifi_copro_fw/network_adapter_"$target".bin
3535
echo "Build completed for target: $target"
3636
done
3737

38-
cp ./main/coprocessor_fw_version.txt ../wifi_copro_fw/coprocessor_fw_version.txt
38+
echo "Extracting firmware version from header…"
39+
40+
INPUT_FILE="./main/esp_hosted_coprocessor_fw_ver.h"
41+
OUTPUT_FILE="./wifi_copro_fw/coprocessor_fw_version.txt"
42+
43+
if [ ! -f "$INPUT_FILE" ]; then
44+
echo "Error: File $INPUT_FILE not found!"
45+
exit 1
46+
fi
47+
48+
MAJOR=$(grep "PROJECT_VERSION_MAJOR_1" "$INPUT_FILE" | sed 's/.*PROJECT_VERSION_MAJOR_1 \([0-9]*\).*/\1/')
49+
MINOR=$(grep "PROJECT_VERSION_MINOR_1" "$INPUT_FILE" | sed 's/.*PROJECT_VERSION_MINOR_1 \([0-9]*\).*/\1/')
50+
PATCH=$(grep "PROJECT_VERSION_PATCH_1" "$INPUT_FILE" | sed 's/.*PROJECT_VERSION_PATCH_1 \([0-9]*\).*/\1/')
51+
52+
if [ -z "$MAJOR" ] || [ -z "$MINOR" ] || [ -z "$PATCH" ]; then
53+
echo "Error: Could not extract all version infos!"
54+
echo "MAJOR: '$MAJOR', MINOR: '$MINOR', PATCH: '$PATCH'"
55+
exit 1
56+
fi
57+
58+
VERSION="$MAJOR.$MINOR.$PATCH"
59+
echo "$VERSION" > "$OUTPUT_FILE"
60+
61+
echo "Version $VERSION has been written in $OUTPUT_FILE."
62+

0 commit comments

Comments
 (0)