2020-04-30 21:04:28 +08:00
|
|
|
{
|
|
|
|
mozillaOverlay ? import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz),
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pkgs = import <nixpkgs> { overlays = [ mozillaOverlay ]; };
|
|
|
|
rustPlatform = (import ./rustPlatform.nix { inherit pkgs; });
|
2020-05-03 08:25:19 +08:00
|
|
|
artiqpkgs = import <artiq-fast/default.nix> { inherit pkgs; };
|
|
|
|
vivado = import <artiq-fast/vivado.nix> { inherit pkgs; };
|
2020-05-01 11:23:00 +08:00
|
|
|
mkbootimage = (import ./mkbootimage.nix { inherit pkgs; });
|
2020-05-01 10:07:38 +08:00
|
|
|
in
|
|
|
|
rec {
|
|
|
|
zc706-szl = rustPlatform.buildRustPackage rec {
|
|
|
|
name = "szl";
|
2020-04-30 21:04:28 +08:00
|
|
|
version = "0.1.0";
|
|
|
|
|
2020-05-01 10:07:38 +08:00
|
|
|
src = ./src;
|
|
|
|
cargoSha256 = "199qfs7fbbj8kxkyb0dcns6hdq9hvlppk7l3pnz204j9zkd7dkcp";
|
2020-04-30 21:04:28 +08:00
|
|
|
|
2020-05-01 10:07:38 +08:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkgs.gnumake
|
|
|
|
(pkgs.python3.withPackages(ps: (with artiqpkgs; [ migen migen-axi misoc artiq ])))
|
|
|
|
pkgs.cargo-xbuild
|
|
|
|
pkgs.llvm_9
|
|
|
|
pkgs.clang_9
|
|
|
|
];
|
2020-04-30 21:04:28 +08:00
|
|
|
buildPhase = ''
|
|
|
|
export XARGO_RUST_SRC="${rustPlatform.rust.rustc.src}/src"
|
|
|
|
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
2020-05-01 10:07:38 +08:00
|
|
|
make clean
|
|
|
|
make
|
2020-04-30 21:04:28 +08:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out $out/nix-support
|
2020-05-01 10:48:23 +08:00
|
|
|
cp target/armv7-none-eabihf/release/szl $out/szl.elf
|
2020-05-01 10:07:38 +08:00
|
|
|
echo file binary-dist $out/szl.elf >> $out/nix-support/hydra-build-products
|
2020-04-30 21:04:28 +08:00
|
|
|
'';
|
2020-05-01 10:07:38 +08:00
|
|
|
|
|
|
|
doCheck = false;
|
2020-04-30 21:04:28 +08:00
|
|
|
dontFixup = true;
|
|
|
|
};
|
|
|
|
zc706-gateware = pkgs.runCommand "zc706-gateware"
|
2020-05-01 10:07:38 +08:00
|
|
|
{
|
|
|
|
nativeBuildInputs = [
|
|
|
|
(pkgs.python3.withPackages(ps: (with artiqpkgs; [ migen migen-axi misoc artiq ])))
|
|
|
|
vivado
|
|
|
|
];
|
|
|
|
}
|
2020-04-30 21:04:28 +08:00
|
|
|
''
|
2020-05-01 10:07:38 +08:00
|
|
|
python ${./src/zc706.py} -g
|
2020-04-30 21:04:28 +08:00
|
|
|
mkdir -p $out $out/nix-support
|
|
|
|
cp build/top.bit $out
|
|
|
|
echo file binary-dist $out/top.bit >> $out/nix-support/hydra-build-products
|
|
|
|
'';
|
|
|
|
zc706-jtag = pkgs.runCommand "zc706-jtag" {}
|
|
|
|
''
|
|
|
|
mkdir $out
|
2020-05-01 10:48:23 +08:00
|
|
|
ln -s ${zc706-szl}/szl.elf $out
|
2020-04-30 21:04:28 +08:00
|
|
|
ln -s ${zc706-gateware}/top.bit $out
|
|
|
|
'';
|
2020-05-01 11:23:00 +08:00
|
|
|
zc706-sd = pkgs.runCommand "zc706-sd"
|
|
|
|
{
|
|
|
|
buildInputs = [ mkbootimage ];
|
|
|
|
}
|
|
|
|
''
|
|
|
|
bif=`mktemp`
|
|
|
|
cat > $bif << EOF
|
|
|
|
the_ROM_image:
|
|
|
|
{
|
|
|
|
[bootloader]${zc706-szl}/szl.elf
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
mkdir $out
|
|
|
|
mkbootimage $bif $out/boot.bin
|
|
|
|
ln -s ${zc706-gateware}/top.bit $out
|
|
|
|
'';
|
|
|
|
zc706-sd-zip = pkgs.runCommand "zc706-sd-zip"
|
|
|
|
{
|
|
|
|
buildInputs = [ pkgs.zip ];
|
|
|
|
}
|
|
|
|
''
|
|
|
|
mkdir -p $out $out/nix-support
|
|
|
|
zip -j $out/sd.zip ${zc706-sd}/*
|
|
|
|
echo file binary-dist $out/sd.zip >> $out/nix-support/hydra-build-products
|
|
|
|
'';
|
2020-04-30 21:04:28 +08:00
|
|
|
}
|