From 6ede148810a87168c0836003a5aa4ae8288b3094 Mon Sep 17 00:00:00 2001 From: pca006132 Date: Tue, 1 Sep 2020 09:41:02 +0800 Subject: [PATCH] Updated build scripts --- default.nix | 9 +++++++-- local_run.sh | 17 ++++++++++++----- remote_run.sh | 20 ++++++++++++-------- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/default.nix b/default.nix index 2431bb9..252e652 100644 --- a/default.nix +++ b/default.nix @@ -15,7 +15,7 @@ let version = "0.1.0"; src = ./src; - cargoSha256 = "1nk9bnvidgq4r7p9pzx1layiqxl48vkfd4hjncd4sxfj50hxjdx4"; + cargoSha256 = "0mf4jyhirkz3grcp2459b8rhw36xkx3rhpz6af0j4knyxb2w707n"; nativeBuildInputs = [ pkgs.gnumake @@ -32,8 +32,10 @@ let installPhase = '' mkdir -p $out $out/nix-support + cp ../build/runtime.bin $out/runtime.bin cp ../build/firmware/armv7-none-eabihf/release/runtime $out/runtime.elf - cp ../build/firmware/armv7-none-eabihf/release/szl $out/szl.elf + cp ../build/firmware/armv7-none-eabihf/debug/szl $out/szl.elf + echo file binary-dist $out/runtime.bin >> $out/nix-support/hydra-build-products echo file binary-dist $out/runtime.elf >> $out/nix-support/hydra-build-products echo file binary-dist $out/szl.elf >> $out/nix-support/hydra-build-products ''; @@ -60,6 +62,7 @@ let '' mkdir $out ln -s ${firmware}/szl.elf $out + ln -s ${firmware}/runtime.bin $out ln -s ${gateware}/top.bit $out ''; sd = pkgs.runCommand "zc706-${variant}-sd" @@ -72,12 +75,14 @@ let bifdir=`mktemp -d` cd $bifdir ln -s ${firmware}/szl.elf szl.elf + ln -s ${firmware}/runtime.elf runtime.elf ln -s ${gateware}/top.bit top.bit cat > boot.bif << EOF the_ROM_image: { [bootloader]szl.elf top.bit + runtime.elf } EOF mkdir $out $out/nix-support diff --git a/local_run.sh b/local_run.sh index 899fb44..9b9191b 100755 --- a/local_run.sh +++ b/local_run.sh @@ -4,8 +4,9 @@ set -e impure=0 load_bitstream=1 +board_host="192.168.1.52" -while getopts "h:il" opt; do +while getopts "ilb:" opt; do case "$opt" in \?) exit 1 ;; @@ -13,6 +14,8 @@ while getopts "h:il" opt; do ;; l) load_bitstream=0 ;; + b) board_host=$OPTARG + ;; esac done @@ -21,12 +24,16 @@ load_bitstream_cmd="" cd openocd if [ $impure -eq 1 ]; then if [ $load_bitstream -eq 1 ]; then - load_bitstream_cmd="pld load 0 ../build/gateware/top.bit;" + load_bitstream_cmd="-g ../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" + openocd -f zc706.cfg -c "load_image ../build/firmware/armv7-none-eabihf/debug/szl; resume 0; exit" + sleep 5 + artiq_netboot $load_bitstream_cmd -f ../build/runtime.bin -b $board_host else if [ $load_bitstream -eq 1 ]; then - load_bitstream_cmd="pld load 0 ../result/top.bit;" + load_bitstream_cmd="-g ../result/top.bit" fi - openocd -f zc706.cfg -c "$load_bitstream_cmd load_image ../result/szl.elf; resume 0; exit" + openocd -f zc706.cfg -c "load_image ../result/szl.elf; resume 0; exit" + sleep 5 + artiq_netboot $load_bitstream_cmd -f ../result/runtime.bin -b $board_host fi diff --git a/remote_run.sh b/remote_run.sh index 55d3a1d..b781fa5 100755 --- a/remote_run.sh +++ b/remote_run.sh @@ -8,6 +8,7 @@ pure_dir="result" impure_dir="build" sshopts="" load_bitstream=1 +board_host="192.168.1.52" while getopts "h:id:o:l" opt; do case "$opt" in @@ -24,29 +25,32 @@ while getopts "h:id:o:l" opt; do ;; l) load_bitstream=0 ;; + b) board_host=$OPTARG + ;; esac done 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..." ssh $sshopts $target_host "mkdir -p $target_folder" echo "Copying files..." rsync -e "ssh $sshopts" openocd/* $target_host:$target_folder if [ $impure -eq 1 ]; then - 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 + load_bitstream_cmd="-g build/gateware/top.bit" fi + firmware="build/runtime.bin" + rsync -e "ssh $sshopts" $impure_dir/firmware/armv7-none-eabihf/debug/szl $target_host:$target_folder/szl.elf else - 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 + load_bitstream_cmd="-g result/top.bit" fi + firmware="result/runtime.bin" + rsync -e "ssh $sshopts" -Lc $pure_dir/szl.elf $target_host:$target_folder fi echo "Programming board..." -ssh $sshopts $target_host "cd $target_folder; openocd -f zc706.cfg -c'$load_bitstream_cmd load_image szl.elf; resume 0; exit'" +ssh $sshopts $target_host "cd $target_folder; openocd -f zc706.cfg -c'load_image szl.elf; resume 0; exit'" +sleep 5 +artiq_netboot $load_bitstream_cmd -f $firmware -b $board_host -- 2.44.1