forked from N4IRS/MMDVM-Install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload_firmware.sh
executable file
·51 lines (35 loc) · 1.05 KB
/
upload_firmware.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
#! /bin/sh
#####################################################
# #
# Upload firmware to MMDVM Due #
# #
#####################################################
# if command line is empty use default file name
FILE=$1
if [ -z "$FILE" ]; then
FILE=MMDVM.ino.arduino_due_x.bin
fi
# Exit if the file does not exist
if [ ! -f "$FILE" ]
then
echo "File $FILE does not exists"
exit 255
fi
systemctl stop mmdvm.service
sleep 2
stty -F /dev/ttyACM0 speed 1200 cs8 -cstopb -parenb > /dev/null 2>&1
sleep 2
echo
echo "writing firmware $FILE to MMDVM"
echo
bossac --port=ttyACM0 --force_usb_port=false --erase --write --verify --boot=1 --reset $FILE
sleep 2
stty -F /dev/ttyACM0 speed 115200 cs8 -cstopb -parenb > /dev/null 2>&1
VERSION=`strings $FILE | grep 'MMDVM 2016' | cut -d' ' -f2`
# rename the file if it does not already exist
if [ ! -f "$VERSION.$FILE" ]
then
mv $FILE $VERSION.$FILE
fi
sleep 2
# systemctl start mmdvm.service