1
0
Fork 0

move build artifacts out of tree

This commit is contained in:
Sebastien Bourdeauducq 2020-05-07 13:52:40 +08:00
parent 743b0e198d
commit 4464b85ab3
8 changed files with 26 additions and 34 deletions

5
.gitignore vendored
View File

@ -2,7 +2,4 @@ result
examples/*.elf examples/*.elf
__pycache__ __pycache__
src/runtime/src/pl.rs build
src/szl/src/payload.bin
src/szl/src/payload.bin.lzma
src/target

View File

@ -17,7 +17,7 @@ Impure incremental build:
```shell ```shell
nix-shell nix-shell
cd src cd src
./zc706.py -g # build gateware ./zc706.py -g ../build/gateware # build gateware
make # build firmware make # build firmware
cd .. cd ..
./remote_run.sh -i ./remote_run.sh -i

View File

@ -27,14 +27,13 @@ in
buildPhase = '' buildPhase = ''
export XARGO_RUST_SRC="${rustPlatform.rust.rustc.src}/src" export XARGO_RUST_SRC="${rustPlatform.rust.rustc.src}/src"
export CARGO_HOME=$(mktemp -d cargo-home.XXX) export CARGO_HOME=$(mktemp -d cargo-home.XXX)
make clean
make make
''; '';
installPhase = '' installPhase = ''
mkdir -p $out $out/nix-support mkdir -p $out $out/nix-support
cp target/armv7-none-eabihf/release/runtime $out/runtime.elf cp ../build/firmware/armv7-none-eabihf/release/runtime $out/runtime.elf
cp target/armv7-none-eabihf/release/szl $out/szl.elf cp ../build/firmware/armv7-none-eabihf/release/szl $out/szl.elf
echo file binary-dist $out/runtime.elf >> $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 echo file binary-dist $out/szl.elf >> $out/nix-support/hydra-build-products
''; '';
@ -50,7 +49,7 @@ in
]; ];
} }
'' ''
python ${./src/zc706.py} -g python ${./src/zc706.py} -g build
mkdir -p $out $out/nix-support mkdir -p $out $out/nix-support
cp build/top.bit $out cp build/top.bit $out
echo file binary-dist $out/top.bit >> $out/nix-support/hydra-build-products echo file binary-dist $out/top.bit >> $out/nix-support/hydra-build-products

View File

@ -21,8 +21,8 @@ target_folder=/tmp/zynq-\$USER
ssh $target_host "mkdir -p $target_folder" ssh $target_host "mkdir -p $target_folder"
rsync openocd/* $target_host:$target_folder rsync openocd/* $target_host:$target_folder
if [ $impure -eq 1 ]; then if [ $impure -eq 1 ]; then
rsync src/target/armv7-none-eabihf/release/szl $target_host:$target_folder/szl.elf rsync build/firmware/armv7-none-eabihf/release/szl $target_host:$target_folder/szl.elf
rsync src/build/top.bit $target_host:$target_folder rsync build/gateware/top.bit $target_host:$target_folder
else else
rsync -L result/szl.elf $target_host:$target_folder rsync -L result/szl.elf $target_host:$target_folder
rsync -L result/top.bit $target_host:$target_folder rsync -L result/top.bit $target_host:$target_folder

View File

@ -1,23 +1,18 @@
all: target/armv7-none-eabihf/release/szl all: ../build/firmware/armv7-none-eabihf/release/szl
clean: .PHONY: all
rm -f runtime/src/pl.rs
rm -f szl/src/payload.bin
rm -f szl/src/payload.bin.lzma
rm -rf target
.PHONY: all clean
runtime/src/pl.rs: zc706.py ../build/pl.rs: zc706.py
python zc706.py -r runtime/src/pl.rs mkdir -p ../build
python zc706.py -r ../build/pl.rs
target/armv7-none-eabihf/release/runtime: .cargo/* armv7-none-eabihf.json Cargo.lock Cargo.toml libdyld/* libdyld/src/* runtime/* runtime/src/* runtime/src/pl.rs ../build/firmware/armv7-none-eabihf/release/runtime: .cargo/* armv7-none-eabihf.json Cargo.lock Cargo.toml libdyld/* libdyld/src/* runtime/* runtime/src/* ../build/pl.rs
cargo xbuild --release -p runtime cargo xbuild --release -p runtime --target-dir ../build/firmware
szl/src/payload.bin.lzma: target/armv7-none-eabihf/release/runtime ../build/szl-payload.bin.lzma: ../build/firmware/armv7-none-eabihf/release/runtime
llvm-objcopy -O binary target/armv7-none-eabihf/release/runtime szl/src/payload.bin llvm-objcopy -O binary ../build/firmware/armv7-none-eabihf/release/runtime ../build/szl-payload.bin
lzma --keep -f szl/src/payload.bin lzma --keep -f ../build/szl-payload.bin
target/armv7-none-eabihf/release/szl: .cargo/* armv7-none-eabihf.json Cargo.lock Cargo.toml szl/* szl/src/* szl/src/payload.bin.lzma ../build/firmware/armv7-none-eabihf/release/szl: .cargo/* armv7-none-eabihf.json Cargo.lock Cargo.toml szl/* szl/src/* ../build/szl-payload.bin.lzma
cargo xbuild --release -p szl cargo xbuild --release -p szl --target-dir ../build/firmware

View File

@ -13,6 +13,7 @@ use libsupport_zynq::ram;
mod proto; mod proto;
mod comms; mod comms;
#[path = "../../../build/pl.rs"]
mod pl; mod pl;
mod rtio; mod rtio;
mod kernel; mod kernel;

View File

@ -40,7 +40,7 @@ pub fn main_core0() {
libboard_zynq::stdio::drop_uart(); // reinitialize UART after clocking change libboard_zynq::stdio::drop_uart(); // reinitialize UART after clocking change
let mut ddr = zynq::ddr::DdrRam::new(); let mut ddr = zynq::ddr::DdrRam::new();
let payload = include_bytes!("payload.bin.lzma"); let payload = include_bytes!("../../../build/szl-payload.bin.lzma");
info!("decompressing payload"); info!("decompressing payload");
let result = unsafe { let result = unsafe {
unlzma_simple(payload.as_ptr(), payload.len() as i32, ddr.ptr(), lzma_error) unlzma_simple(payload.as_ptr(), payload.len() as i32, ddr.ptr(), lzma_error)

View File

@ -60,15 +60,15 @@ def main():
description="ARTIQ port to the ZC706 Zynq development kit") description="ARTIQ port to the ZC706 Zynq development kit")
parser.add_argument("-r", default=None, parser.add_argument("-r", default=None,
help="build Rust interface into the specified file") help="build Rust interface into the specified file")
parser.add_argument("-g", action="store_true", parser.add_argument("-g", default=None,
help="build gateware") help="build gateware into the specified directory")
args = parser.parse_args() args = parser.parse_args()
soc = ZC706() soc = ZC706()
soc.finalize() soc.finalize()
if args.g: if args.g is not None:
soc.build() soc.build(build_dir=args.g)
if args.r is not None: if args.r is not None:
write_csr_file(soc, args.r) write_csr_file(soc, args.r)