forked from M-Labs/nac3
1
0
Fork 0

Updated build scripts

This commit is contained in:
pca006132 2020-09-01 09:41:02 +08:00
parent ccf8ae5b5d
commit 6ede148810
3 changed files with 31 additions and 15 deletions

View File

@ -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

View File

@ -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

View File

@ -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