forked from M-Labs/artiq-zynq
parent
0ebe14c474
commit
c28c567e72
@ -1,4 +1,3 @@ |
||||
build/ |
||||
runtime/src/pl.rs |
||||
target/ |
||||
result |
||||
examples/*.elf |
||||
__pycache__ |
||||
|
@ -1,6 +0,0 @@ |
||||
Build with: |
||||
|
||||
```shell |
||||
cargo xbuild -p runtime --release |
||||
cargo xbuild -p szl --release |
||||
``` |
@ -0,0 +1,72 @@ |
||||
{ |
||||
mozillaOverlay ? import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz), |
||||
}: |
||||
|
||||
let |
||||
pkgs = import <nixpkgs> { overlays = [ mozillaOverlay ]; }; |
||||
artiq-fast = <artiq-fast>; |
||||
rustPlatform = (import ./rustPlatform.nix { inherit pkgs; }); |
||||
buildFirmware = { name, src }: |
||||
rustPlatform.buildRustPackage rec { |
||||
inherit name; |
||||
version = "0.1.0"; |
||||
|
||||
inherit src; |
||||
cargoSha256 = (import "${src}/cargosha256.nix"); |
||||
|
||||
nativeBuildInputs = [ pkgs.cargo-xbuild pkgs.llvm_9 pkgs.clang_9 ]; |
||||
buildPhase = '' |
||||
export XARGO_RUST_SRC="${rustPlatform.rust.rustc.src}/src" |
||||
export CARGO_HOME=$(mktemp -d cargo-home.XXX) |
||||
cargo xbuild --release -p ${name} |
||||
''; |
||||
|
||||
doCheck = false; |
||||
installPhase = '' |
||||
mkdir -p $out $out/nix-support |
||||
cp target/armv7-none-eabihf/release/${name} $out/${name}.elf |
||||
echo file binary-dist $out/${name}.elf >> $out/nix-support/hydra-build-products |
||||
''; |
||||
dontFixup = true; |
||||
}; |
||||
|
||||
artiqpkgs = import "${artiq-fast}/default.nix" { inherit pkgs; }; |
||||
vivado = import "${artiq-fast}/vivado.nix" { inherit pkgs; }; |
||||
in |
||||
rec { |
||||
zc706-runtime-src = pkgs.runCommand "zc706-runtime-src" |
||||
{ buildInputs = [ |
||||
(pkgs.python3.withPackages(ps: (with artiqpkgs; [ migen migen-axi misoc artiq ]))) |
||||
]; } |
||||
'' |
||||
cp --no-preserve=mode,ownership -R ${./firmware} $out |
||||
cd $out/runtime/src |
||||
python ${./zc706.py} rustif |
||||
''; |
||||
zc706-runtime = buildFirmware { name = "runtime"; src = zc706-runtime-src; }; |
||||
zc706-szl-src = pkgs.runCommand "zc706-szl-src" |
||||
{ nativeBuildInputs = [ pkgs.llvm_9 ]; } |
||||
'' |
||||
cp --no-preserve=mode,ownership -R ${./firmware} $out |
||||
llvm-objcopy -O binary ${zc706-runtime}/runtime.elf $out/szl/src/payload.bin |
||||
lzma $out/szl/src/payload.bin |
||||
''; |
||||
zc706-szl = buildFirmware { name = "szl"; src = zc706-szl-src; }; |
||||
zc706-gateware = pkgs.runCommand "zc706-gateware" |
||||
{ buildInputs = [ |
||||
(pkgs.python3.withPackages(ps: (with artiqpkgs; [ migen migen-axi misoc artiq ]))) |
||||
vivado |
||||
]; } |
||||
'' |
||||
python ${./zc706.py} gateware |
||||
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 |
||||
ln -s ${zc706-szl}/szl $out |
||||
ln -s ${zc706-gateware}/top.bit $out |
||||
''; |
||||
} |
@ -0,0 +1 @@ |
||||
"1mfprkcq4cr4jiihy1qn8q8qymxwhafh90vyr3i4brj4aq5kksn1" |
Binary file not shown.
@ -0,0 +1,24 @@ |
||||
{ pkgs }: |
||||
|
||||
let |
||||
rustcSrc = pkgs.fetchgit { |
||||
url = "https://github.com/rust-lang/rust.git"; |
||||
# master of 2020-04-10 |
||||
rev = "94d346360da50f159e0dc777dc9bc3c5b6b51a00"; |
||||
sha256 = "1hcqdz4w2vqb12rrqqcjbfs5s0w4qwjn7z45d1zh0fzncdcf6f7d"; |
||||
fetchSubmodules = true; |
||||
}; |
||||
rustManifest = ./channel-rust-nightly.toml; |
||||
|
||||
targets = []; |
||||
rustChannelOfTargets = _channel: _date: targets: |
||||
(pkgs.lib.rustLib.fromManifestFile rustManifest { |
||||
inherit (pkgs) stdenv fetchurl patchelf; |
||||
}).rust.override { inherit targets; }; |
||||
rust = |
||||
rustChannelOfTargets "nightly" null targets; |
||||
in |
||||
pkgs.recurseIntoAttrs (pkgs.makeRustPlatform { |
||||
rustc = rust // { src = rustcSrc; }; |
||||
cargo = rust; |
||||
}) |
@ -1,50 +0,0 @@ |
||||
let |
||||
mozillaOverlay = import (builtins.fetchTarball "https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz"); |
||||
artiq-fast = builtins.fetchTarball "https://nixbld.m-labs.hk/channel/custom/artiq/fast-beta/artiq-fast/nixexprs.tar.xz"; |
||||
|
||||
pkgs = import <nixpkgs> { overlays = [ mozillaOverlay ]; }; |
||||
|
||||
rustcSrc = pkgs.fetchgit { |
||||
url = "https://github.com/rust-lang/rust.git"; |
||||
# master of 2020-04-10 |
||||
rev = "94d346360da50f159e0dc777dc9bc3c5b6b51a00"; |
||||
sha256 = "1hcqdz4w2vqb12rrqqcjbfs5s0w4qwjn7z45d1zh0fzncdcf6f7d"; |
||||
fetchSubmodules = true; |
||||
}; |
||||
rustManifest = ./channel-rust-nightly.toml; |
||||
|
||||
targets = []; |
||||
rustChannelOfTargets = _channel: _date: targets: |
||||
(pkgs.lib.rustLib.fromManifestFile rustManifest { |
||||
inherit (pkgs) stdenv fetchurl patchelf; |
||||
}).rust.override { inherit targets; }; |
||||
rust = |
||||
rustChannelOfTargets "nightly" null targets; |
||||
rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform { |
||||
rustc = rust // { src = rustcSrc; }; |
||||
cargo = rust; |
||||
}); |
||||
|
||||
artiqpkgs = import "${artiq-fast}/default.nix" { inherit pkgs; }; |
||||
vivado = import "${artiq-fast}/vivado.nix" { inherit pkgs; }; |
||||
in |
||||
pkgs.stdenv.mkDerivation { |
||||
name = "artiq-zynq-env"; |
||||
buildInputs = [ |
||||
rustPlatform.rust.rustc |
||||
rustPlatform.rust.cargo |
||||
rustcSrc |
||||
pkgs.clang_9 |
||||
pkgs.cacert |
||||
pkgs.cargo-xbuild |
||||
|
||||
pkgs.openssh pkgs.rsync |
||||
|
||||
(pkgs.python3.withPackages(ps: (with artiqpkgs; [ migen migen-axi misoc artiq ]))) |
||||
vivado |
||||
pkgs.llvm_9 |
||||
pkgs.lld_9 |
||||
]; |
||||
|
||||
XARGO_RUST_SRC = "${rustcSrc}/src"; |
||||
} |
Loading…
Reference in new issue