-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathflash_long_data.sh
executable file
·52 lines (52 loc) · 1.06 KB
/
flash_long_data.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
#!/bin/bash
set -o pipefail
if pgrep -x "emulator" > /dev/null
then
echo "PiStorm emulator is running, please stop it first"
exit 1
fi
if ! command -v ./pistormflash &> /dev/null
then
echo "pistormflash tool cannot be found."
exit 1
fi
echo -ne "Detecting CPLD... "
version=$(./pistormflash -c 2>/dev/null | awk -F "," 'FNR == 1 { print $1 }')
case $version in
"idcode=0x020a10dd")
echo "EPM240 detected!"
echo ""
./pistormflash -s ./rtl/EPM240_long_data.svf
if [ $? -eq 0 ]
then
echo "CPLD flashed successfully!"
exit 0
else
echo "Error flashing CPLD."
exit 1
fi
;;
"idcode=0x020a20dd")
echo "EPM570 detected!"
echo ""
./pistormflash -s ./rtl/bitstream_long_data.svf
if [ $? -eq 0 ]
then
echo "CPLD flashed successfully!"
exit 0
else
echo "Error flashing CPLD."
exit 1
fi
;;
"idcode=0x020a50dd")
echo "MAXV240 detected!"
echo ""
echo "A MAXV240 version of this firmware does not exist, please select another firmware"
exit 1
;;
*)
echo "Could not detect CPLD."
exit 1
;;
esac