-
Notifications
You must be signed in to change notification settings - Fork 2
/
openocd-prog-flash.sh
executable file
·62 lines (56 loc) · 1.58 KB
/
openocd-prog-flash.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/sh
flashbin="$1"
board="$2"
interface="$3"
if [ -z "$flashbin" -o -z "$board" -o -z "$interface" ]; then
echo "Usage: $0 flash.bin board interface"
exit 1
fi
scansta_cmd=""
sfp_jtag=""
if [ "$board" = "afcv3" ]; then
scansta_cmd="svf afc-scansta.svf -quiet"
elif [ "$board" = "afcv4" ]; then
sfp_jtag=""
elif [ "$board" = "afcv4_sfp" ]; then
sfp_jtag="jtag newtap auto0 tap -irlen 8 -ignore-version -expected-id 0x16d4a093"
else
echo "Board '${board}' not supported!"
exit 1
fi
if [ "$interface" = "ftdi" ]; then
openocd -f afcv4-ftdi-jtag.cfg \
-c "init" \
-c "${sfp_jtag}" \
-c "jtag newtap xc7 tap -irlen 6 -ignore-version -expected-id 0x03636093" \
-c "pld device virtex2 xc7.tap 1" \
-c "set _CHIPNAME xc7" \
-c "source [find cpld/jtagspi.cfg]" \
-c "init" \
-c "${scansta_cmd}" \
-c "jtagspi_init 0 bscan_spi_xc7a200t.bit" \
-c "jtagspi_program ${flashbin} 0x0000" \
-c "exit"
elif [ "$interface" = "xvc" ]; then
xvc_host="$4"
xvc_port="$5"
if [ -z "$xvc_host" -o -z "$xvc_port" ]; then
echo "Usage: $0 bitstream_file board xvc hostname port"
exit 1
fi
openocd -c "adapter driver xvc" \
-c "adapter speed 3000" \
-c "xvc_host ${xvc_host}" \
-c "xvc_port ${xvc_port}" \
-c "reset_config none" \
-c "${sfp_jtag}" \
-c "jtag newtap xc7 tap -irlen 6 -ignore-version -expected-id 0x03636093" \
-c "pld device virtex2 xc7.tap 1" \
-c "set _CHIPNAME xc7" \
-c "source [find cpld/jtagspi.cfg]" \
-c "init" \
-c "${scansta_cmd}" \
-c "jtagspi_init 0 bscan_spi_xc7a200t.bit" \
-c "jtagspi_program ${flashbin} 0x0000" \
-c "exit"
fi