2020-06-05 11:45:56 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2020-09-09 18:44:12 +08:00
|
|
|
if [ -z "$OPENOCD_ZYNQ" ]; then
|
|
|
|
echo "OPENOCD_ZYNQ environment variable must be set"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -z "$SZL" ]; then
|
|
|
|
echo "SZL environment variable must be set"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-06-05 11:45:56 +08:00
|
|
|
impure=0
|
2020-07-06 11:06:18 +08:00
|
|
|
load_bitstream=1
|
2021-06-25 17:03:55 +08:00
|
|
|
board_type="kasli_soc"
|
2021-10-05 15:53:07 +08:00
|
|
|
fw_type="runtime"
|
2020-06-05 11:45:56 +08:00
|
|
|
|
2021-10-05 15:53:07 +08:00
|
|
|
while getopts "ilb:t:f:" 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-09-01 09:41:02 +08:00
|
|
|
b) board_host=$OPTARG
|
|
|
|
;;
|
2021-06-25 17:03:55 +08:00
|
|
|
t) board_type=$OPTARG
|
|
|
|
;;
|
2021-10-05 15:53:07 +08:00
|
|
|
f) fw_type=$OPTARG
|
|
|
|
;;
|
2020-06-05 11:45:56 +08:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2021-06-25 17:03:55 +08:00
|
|
|
if [ -z "$board_host" ]; then
|
|
|
|
case $board_type in
|
|
|
|
kasli_soc) board_host="192.168.1.56";;
|
|
|
|
zc706) board_host="192.168.1.52";;
|
|
|
|
*) echo "Unknown board type"; exit 1;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2020-07-06 11:06:18 +08:00
|
|
|
load_bitstream_cmd=""
|
|
|
|
|
2020-09-09 15:44:29 +08:00
|
|
|
build_dir=`pwd`/build
|
|
|
|
result_dir=`pwd`/result
|
|
|
|
cd $OPENOCD_ZYNQ
|
2021-06-25 17:03:55 +08:00
|
|
|
openocd -f $board_type.cfg -c "load_image $SZL/szl-$board_type.elf; resume 0; exit"
|
2020-09-09 18:44:12 +08:00
|
|
|
sleep 5
|
2020-06-05 11:45:56 +08:00
|
|
|
if [ $impure -eq 1 ]; then
|
2020-07-06 11:06:18 +08:00
|
|
|
if [ $load_bitstream -eq 1 ]; then
|
2020-09-09 15:44:29 +08:00
|
|
|
load_bitstream_cmd="-g $build_dir/gateware/top.bit"
|
2020-07-06 11:06:18 +08:00
|
|
|
fi
|
2021-10-05 15:53:07 +08:00
|
|
|
artiq_netboot $load_bitstream_cmd -f $build_dir/$fwtype.bin -b $board_host
|
2020-06-05 11:45:56 +08:00
|
|
|
else
|
2020-07-06 11:06:18 +08:00
|
|
|
if [ $load_bitstream -eq 1 ]; then
|
2020-09-09 15:44:29 +08:00
|
|
|
load_bitstream_cmd="-g $result_dir/top.bit"
|
2020-07-06 11:06:18 +08:00
|
|
|
fi
|
2021-10-05 15:53:07 +08:00
|
|
|
artiq_netboot $load_bitstream_cmd -f $result_dir/$fwtype.bin -b $board_host
|
2021-10-13 16:11:27 +08:00
|
|
|
fi
|