Skip to content

Commit a30bf64

Browse files
committed
convert coprocessor_fw_version.h to *.txt
1 parent 1b9ce89 commit a30bf64

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

tools/compile_slave.sh

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ source ./tools/install-esp-idf.sh
1212
if [ $? -ne 0 ]; then exit 1; fi
1313

1414
git clone https://github.com/Jason2866/esp-hosted-mcu.git
15-
cd ./esp-hosted-mcu/slave
15+
cd esp-hosted-mcu/slave
1616

1717
slave_targets=(
1818
"esp32"
@@ -25,16 +25,42 @@ slave_targets=(
2525

2626
# idf.py create-project-from-example "espressif/esp_hosted:slave"
2727
mkdir wifi_copro_fw
28-
28+
# cd ./slave
2929
echo "Found firmware version: $(<./main/coprocessor_fw_version.txt)"
3030

3131
for target in "${slave_targets[@]}"; do
3232
echo "Building for target: $target"
3333
idf.py set-target "$target"
3434
idf.py clean
3535
idf.py build
36-
cp ./build/network_adapter.bin ../wifi_copro_fw/network_adapter_"$target".bin
36+
cp ./build/network_adapter.bin ./wifi_copro_fw/network_adapter_"$target".bin
3737
echo "Build completed for target: $target"
3838
done
3939

40-
cp ./main/coprocessor_fw_version.txt ../wifi_copro_fw/coprocessor_fw_version.txt
40+
INPUT_FILE="./main/coprocessor_fw_version.h"
41+
OUTPUT_FILE="./wifi_copro_fw/coprocessor_fw_version.txt"
42+
43+
# Prüfen ob Eingabedatei existiert
44+
if [ ! -f "$INPUT_FILE" ]; then
45+
echo "Fehler: Datei $INPUT_FILE nicht gefunden!"
46+
exit 1
47+
fi
48+
49+
# Versionsnummern extrahieren
50+
MAJOR=$(grep "PROJECT_VERSION_MAJOR_1" "$INPUT_FILE" | sed 's/.*PROJECT_VERSION_MAJOR_1 \([0-9]*\).*/\1/')
51+
MINOR=$(grep "PROJECT_VERSION_MINOR_1" "$INPUT_FILE" | sed 's/.*PROJECT_VERSION_MINOR_1 \([0-9]*\).*/\1/')
52+
PATCH=$(grep "PROJECT_VERSION_PATCH_1" "$INPUT_FILE" | sed 's/.*PROJECT_VERSION_PATCH_1 \([0-9]*\).*/\1/')
53+
54+
# Prüfen ob alle Werte gefunden wurden
55+
if [ -z "$MAJOR" ] || [ -z "$MINOR" ] || [ -z "$PATCH" ]; then
56+
echo "Fehler: Konnte nicht alle Versionsnummern extrahieren!"
57+
echo "MAJOR: '$MAJOR', MINOR: '$MINOR', PATCH: '$PATCH'"
58+
exit 1
59+
fi
60+
61+
# Version zusammensetzen und in Datei schreiben
62+
VERSION="$MAJOR.$MINOR.$PATCH"
63+
echo "$VERSION" > "$OUTPUT_FILE"
64+
65+
echo "Version $VERSION wurde in $OUTPUT_FILE geschrieben."
66+

0 commit comments

Comments
 (0)