-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile_and_flash_20.sh
executable file
·62 lines (51 loc) · 1.33 KB
/
compile_and_flash_20.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
set -e
version="20.1C.2-2"
settings_date=$1
release_folder=$(pwd)/releases
backup_folder=$(pwd)/releases/backup
cd src/controller
# Clean existing
rm -rf main.ihx || true
make clean || true
# Build firmware
echo Build started...
make all
# Save new firmware
echo Copying firmware to release folder.
echo $release_folder/TSDZ2-$version-$settings_date.hex
mkdir -p $release_folder
yes | cp -rf ../../bin/main.ihx $release_folder/TSDZ2-$version-$settings_date.hex
backup=no
while true; do
read -p "Do you want to backup the firmware ? [y/N]" yn
case $yn in
y ) backup=yes; break;;
n ) break;;
* ) break;;
esac
done
# Backup firmware
if [ "$backup" = "yes" ]; then
echo Backup current firmware to $backup_folder/TSDZ_orig_opt-$version-$settings_date.bin
mkdir -p $backup_folder
make backup
yes | cp -rf ../../bin/TSDZ_orig_opt.bin $backup_folder/TSDZ_orig_opt-$version-$settings_date.bin
yes | cp -rf ../../bin/TSDZ_orig.bin $backup_folder/TSDZ_orig-$version-$settings_date.bin
yes | cp -rf ../../bin/TSDZ_orig_eeprom.bin $backup_folder/TSDZ_orig_eeprom-$version-$settings_date.bin
fi
flash=yes
while true; do
read -p "Do you want to flash the motor ? [Y/n]" yn
case $yn in
y ) break;;
n ) flash=no; break;;
* ) break;;
esac
done
# Flash new firmware
if [ "$flash" = "yes" ]; then
make clear_eeprom
make flash
fi
echo All done !