-
Notifications
You must be signed in to change notification settings - Fork 2
/
openocd-prog.sh
executable file
·56 lines (50 loc) · 1.3 KB
/
openocd-prog.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
#!/bin/sh
bitstream="$1"
board="$2"
interface="$3"
if [ -z "$bitstream" -o -z "$board" -o -z "$interface" ]; then
echo "Usage: $0 bitstream.bit 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 "xc7_program xc7.tap" \
-c "pld load 0 \"${bitstream}\"" \
-c "exit" \
-c "ftdi_set_signal JEN 0"
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 "init" \
-c "${scansta_cmd}" \
-c "pld load 0 \"${bitstream}\"" \
-c "exit"
else
echo "Interface '${interface}' not supported!"
exit 1
fi