@@ -11,6 +11,11 @@ echo "* Installing/Updating ESP-IDF and all components..."
1111source ./tools/install-esp-idf.sh
1212if [ $? -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
1520slave_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-
2929for 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 "
3636done
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