2020-06-05 11:45:56 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
impure=0
|
2020-07-06 11:06:18 +08:00
|
|
|
load_bitstream=1
|
2020-06-05 11:45:56 +08:00
|
|
|
|
2020-07-06 15:15:35 +08:00
|
|
|
while getopts "h:il" opt; do
|
2020-06-05 11:45:56 +08:00
|
|
|
case "$opt" in
|
2020-07-04 17:54:03 +08:00
|
|
|
\?) exit 1
|
2020-06-05 11:45:56 +08:00
|
|
|
;;
|
|
|
|
i) impure=1
|
|
|
|
;;
|
2020-07-06 11:06:18 +08:00
|
|
|
l) load_bitstream=0
|
|
|
|
;;
|
2020-06-05 11:45:56 +08:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2020-07-06 11:06:18 +08:00
|
|
|
load_bitstream_cmd=""
|
|
|
|
|
2020-06-05 11:45:56 +08:00
|
|
|
cd openocd
|
|
|
|
if [ $impure -eq 1 ]; then
|
2020-07-06 11:06:18 +08:00
|
|
|
if [ $load_bitstream -eq 1 ]; then
|
|
|
|
load_bitstream_cmd="pld load 0 ../build/gateware/top.bit;"
|
|
|
|
fi
|
|
|
|
openocd -f zc706.cfg -c "$load_bitstream_cmd load_image ../build/firmware/armv7-none-eabihf/release/szl; resume 0; exit"
|
2020-06-05 11:45:56 +08:00
|
|
|
else
|
2020-07-06 11:06:18 +08:00
|
|
|
if [ $load_bitstream -eq 1 ]; then
|
|
|
|
load_bitstream_cmd="pld load 0 ../result/top.bit;"
|
|
|
|
fi
|
|
|
|
openocd -f zc706.cfg -c "$load_bitstream_cmd load_image ../result/szl.elf; resume 0; exit"
|
2020-06-05 11:45:56 +08:00
|
|
|
fi
|