2020-04-11 21:12:16 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2020-05-01 10:07:38 +08:00
|
|
|
target_host="rpi-4.m-labs.hk"
|
|
|
|
impure=0
|
2020-07-04 17:27:21 +08:00
|
|
|
pure_dir="result"
|
|
|
|
impure_dir="build"
|
2020-04-11 21:12:16 +08:00
|
|
|
|
2020-05-01 10:07:38 +08:00
|
|
|
while getopts "h:i" opt; do
|
|
|
|
case "$opt" in
|
|
|
|
\?) exit 0
|
|
|
|
;;
|
|
|
|
h) target_host=$OPTARG
|
|
|
|
;;
|
|
|
|
i) impure=1
|
|
|
|
;;
|
2020-07-04 17:27:21 +08:00
|
|
|
d) pure_dir=$OPTARG;
|
|
|
|
impure_dir=$OPTARG;
|
|
|
|
;;
|
2020-05-01 10:07:38 +08:00
|
|
|
esac
|
|
|
|
done
|
2020-04-11 21:12:16 +08:00
|
|
|
|
2020-05-01 10:07:38 +08:00
|
|
|
target_folder=/tmp/zynq-\$USER
|
|
|
|
|
|
|
|
ssh $target_host "mkdir -p $target_folder"
|
|
|
|
rsync openocd/* $target_host:$target_folder
|
|
|
|
if [ $impure -eq 1 ]; then
|
2020-07-04 17:27:21 +08:00
|
|
|
rsync $impure_dir/firmware/armv7-none-eabihf/release/szl $target_host:$target_folder/szl.elf
|
|
|
|
rsync $impure_dir/gateware/top.bit $target_host:$target_folder
|
2020-05-01 10:07:38 +08:00
|
|
|
else
|
2020-07-04 17:27:21 +08:00
|
|
|
rsync -L $pure_dir/szl.elf $target_host:$target_folder
|
|
|
|
rsync -L $pure_dir/top.bit $target_host:$target_folder
|
2020-05-01 10:07:38 +08:00
|
|
|
fi
|
2020-05-01 11:22:45 +08:00
|
|
|
ssh $target_host "cd $target_folder; openocd -f zc706.cfg -c 'pld load 0 top.bit; load_image szl.elf; resume 0; exit'"
|