2020-10-14 15:56:10 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
impure=0
|
|
|
|
load_bitstream=1
|
|
|
|
board_host="192.168.1.55"
|
|
|
|
|
|
|
|
while getopts "ilb:" opt; do
|
|
|
|
case "$opt" in
|
|
|
|
\?) exit 1
|
|
|
|
;;
|
|
|
|
i) impure=1
|
|
|
|
;;
|
|
|
|
l) load_bitstream=0
|
|
|
|
;;
|
|
|
|
b) board_host=$OPTARG
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
load_bitstream_cmd=""
|
|
|
|
|
|
|
|
build_dir=`pwd`/build
|
|
|
|
result_dir=`pwd`/result
|
|
|
|
cd $OPENOCD_ZYNQ
|
|
|
|
openocd -f redpitaya.cfg -c "load_image $SZL; resume 0; exit"
|
|
|
|
sleep 5
|
|
|
|
if [ $impure -eq 1 ]; then
|
|
|
|
if [ $load_bitstream -eq 1 ]; then
|
|
|
|
load_bitstream_cmd="-g $build_dir/gateware/top.bit"
|
|
|
|
fi
|
2020-10-14 21:34:49 +08:00
|
|
|
artiq_netboot $load_bitstream_cmd -f $build_dir/firmware.bin -b $board_host
|
2020-10-14 15:56:10 +08:00
|
|
|
else
|
|
|
|
if [ $load_bitstream -eq 1 ]; then
|
|
|
|
load_bitstream_cmd="-g $result_dir/top.bit"
|
|
|
|
fi
|
2020-10-14 21:34:49 +08:00
|
|
|
artiq_netboot $load_bitstream_cmd -f $result_dir/firmware.bin -b $board_host
|
2020-10-14 15:56:10 +08:00
|
|
|
fi
|