forked from M-Labs/nac3
1
0
Fork 0

run scripts: added option to avoid loading bitstream

This commit is contained in:
pca006132 2020-07-06 11:06:18 +08:00
parent 27f4c12571
commit cd12ebf9e9
2 changed files with 29 additions and 7 deletions

View File

@ -3,19 +3,30 @@
set -e set -e
impure=0 impure=0
load_bitstream=1
while getopts "h:i" opt; do while getopts "h:i:l" opt; do
case "$opt" in case "$opt" in
\?) exit 1 \?) exit 1
;; ;;
i) impure=1 i) impure=1
;; ;;
l) load_bitstream=0
;;
esac esac
done done
load_bitstream_cmd=""
cd openocd cd openocd
if [ $impure -eq 1 ]; then if [ $impure -eq 1 ]; then
openocd -f zc706.cfg -c 'pld load 0 ../build/gateware/top.bit; load_image ../build/firmware/armv7-none-eabihf/release/szl; resume 0; exit' if [ $load_bitstream -eq 1 ]; then
else load_bitstream_cmd="pld load 0 ../build/gateware/top.bit;"
openocd -f zc706.cfg -c 'pld load 0 ../result/top.bit; load_image ../result/szl.elf; resume 0; exit' fi
openocd -f zc706.cfg -c "$load_bitstream_cmd load_image ../build/firmware/armv7-none-eabihf/release/szl; resume 0; exit"
else
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"
fi fi

View File

@ -7,8 +7,9 @@ impure=0
pure_dir="result" pure_dir="result"
impure_dir="build" impure_dir="build"
sshopts="" sshopts=""
load_bitstream=1
while getopts "h:id:o:" opt; do while getopts "h:id:o:l" opt; do
case "$opt" in case "$opt" in
\?) exit 1 \?) exit 1
;; ;;
@ -21,10 +22,16 @@ while getopts "h:id:o:" opt; do
;; ;;
o) sshopts=$OPTARG o) sshopts=$OPTARG
;; ;;
l) load_bitstream=0
;;
esac esac
done done
target_folder="/tmp/zynq-$USER" target_folder="/tmp/zynq-$USER"
load_bitstream_cmd=""
if [ $load_bitstream -eq 1 ]; then
load_bitstream_cmd="pld load 0 top.bit;"
fi
echo "Creating $target_folder..." echo "Creating $target_folder..."
ssh $sshopts $target_host "mkdir -p $target_folder" ssh $sshopts $target_host "mkdir -p $target_folder"
@ -32,10 +39,14 @@ echo "Copying files..."
rsync -e "ssh $sshopts" openocd/* $target_host:$target_folder rsync -e "ssh $sshopts" openocd/* $target_host:$target_folder
if [ $impure -eq 1 ]; then if [ $impure -eq 1 ]; then
rsync -e "ssh $sshopts" $impure_dir/firmware/armv7-none-eabihf/release/szl $target_host:$target_folder/szl.elf rsync -e "ssh $sshopts" $impure_dir/firmware/armv7-none-eabihf/release/szl $target_host:$target_folder/szl.elf
if [ $load_bitstream -eq 1 ]; then
rsync -e "ssh $sshopts" $impure_dir/gateware/top.bit $target_host:$target_folder rsync -e "ssh $sshopts" $impure_dir/gateware/top.bit $target_host:$target_folder
fi
else else
rsync -e "ssh $sshopts" -Lc $pure_dir/szl.elf $target_host:$target_folder rsync -e "ssh $sshopts" -Lc $pure_dir/szl.elf $target_host:$target_folder
if [ $load_bitstream -eq 1 ]; then
rsync -e "ssh $sshopts" -Lc $pure_dir/top.bit $target_host:$target_folder rsync -e "ssh $sshopts" -Lc $pure_dir/top.bit $target_host:$target_folder
fi fi
fi
echo "Programming board..." echo "Programming board..."
ssh $sshopts $target_host "cd $target_folder; openocd -f zc706.cfg -c 'pld load 0 top.bit; load_image szl.elf; resume 0; exit'" ssh $sshopts $target_host "cd $target_folder; openocd -f zc706.cfg -c'$load_bitstream_cmd load_image szl.elf; resume 0; exit'"