forked from M-Labs/nac3
use Nix files from zynq-rs
This commit is contained in:
parent
c3f9a76f2a
commit
a99ee3ec32
File diff suppressed because it is too large
Load Diff
12
default.nix
12
default.nix
|
@ -1,10 +1,11 @@
|
||||||
let
|
let
|
||||||
pkgs = import <nixpkgs> { overlays = [ (import ./mozilla-overlay.nix) ]; };
|
zynq-rs = (import ./zynq-rs.nix);
|
||||||
rustPlatform = (import ./rustPlatform.nix { inherit pkgs; });
|
pkgs = import <nixpkgs> { overlays = [ (import "${zynq-rs}/nix/mozilla-overlay.nix") ]; };
|
||||||
|
rustPlatform = (import "${zynq-rs}/nix/rust-platform.nix" { inherit pkgs; });
|
||||||
|
zc706-fsbl = import "${zynq-rs}/nix/fsbl.nix" { inherit pkgs; };
|
||||||
|
mkbootimage = import "${zynq-rs}/nix/mkbootimage.nix" { inherit pkgs; };
|
||||||
artiqpkgs = import <artiq-fast/default.nix> { inherit pkgs; };
|
artiqpkgs = import <artiq-fast/default.nix> { inherit pkgs; };
|
||||||
vivado = import <artiq-fast/vivado.nix> { inherit pkgs; };
|
vivado = import <artiq-fast/vivado.nix> { inherit pkgs; };
|
||||||
zc706-fsbl = import ./fsbl.nix { inherit pkgs; };
|
|
||||||
mkbootimage = (import ./mkbootimage.nix { inherit pkgs; });
|
|
||||||
build-zc706 = { variant }: let
|
build-zc706 = { variant }: let
|
||||||
firmware = rustPlatform.buildRustPackage rec {
|
firmware = rustPlatform.buildRustPackage rec {
|
||||||
name = "zc706-${variant}-firmware";
|
name = "zc706-${variant}-firmware";
|
||||||
|
@ -123,6 +124,5 @@ in
|
||||||
(build-zc706 { variant = "nist_qc2"; }) //
|
(build-zc706 { variant = "nist_qc2"; }) //
|
||||||
(build-zc706 { variant = "acpki_simple"; }) //
|
(build-zc706 { variant = "acpki_simple"; }) //
|
||||||
(build-zc706 { variant = "acpki_nist_clock"; }) //
|
(build-zc706 { variant = "acpki_nist_clock"; }) //
|
||||||
(build-zc706 { variant = "acpki_nist_qc2"; }) //
|
(build-zc706 { variant = "acpki_nist_qc2"; })
|
||||||
{ inherit zc706-fsbl; }
|
|
||||||
)
|
)
|
||||||
|
|
37
fsbl.nix
37
fsbl.nix
|
@ -1,37 +0,0 @@
|
||||||
{ pkgs, board ? "zc706" }:
|
|
||||||
let
|
|
||||||
gnutoolchain = import ./gnutoolchain.nix { inherit pkgs; };
|
|
||||||
in
|
|
||||||
pkgs.stdenv.mkDerivation {
|
|
||||||
name = "${board}-fsbl";
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "Xilinx";
|
|
||||||
repo = "embeddedsw";
|
|
||||||
rev = "65c849ed46c88c67457e1fc742744f96db968ff1";
|
|
||||||
sha256 = "1rvl06ha40dzd6s9aa4sylmksh4xb9dqaxq462lffv1fdk342pda";
|
|
||||||
};
|
|
||||||
patches = [ ./fsbl.patch ];
|
|
||||||
nativeBuildInputs = [
|
|
||||||
pkgs.gnumake
|
|
||||||
gnutoolchain.binutils
|
|
||||||
gnutoolchain.gcc
|
|
||||||
];
|
|
||||||
patchPhase =
|
|
||||||
''
|
|
||||||
patch -p1 -i ${./fsbl.patch}
|
|
||||||
patchShebangs lib/sw_apps/zynq_fsbl/misc/copy_bsp.sh
|
|
||||||
echo 'SEARCH_DIR("${gnutoolchain.newlib}/arm-none-eabi/lib");' >> lib/sw_apps/zynq_fsbl/src/lscript.ld
|
|
||||||
'';
|
|
||||||
buildPhase =
|
|
||||||
''
|
|
||||||
cd lib/sw_apps/zynq_fsbl/src
|
|
||||||
make BOARD=${board} "CFLAGS=-DFSBL_DEBUG_INFO -g"
|
|
||||||
'';
|
|
||||||
installPhase =
|
|
||||||
''
|
|
||||||
mkdir $out
|
|
||||||
cp fsbl.elf $out
|
|
||||||
'';
|
|
||||||
doCheck = false;
|
|
||||||
dontFixup = true;
|
|
||||||
}
|
|
31
fsbl.patch
31
fsbl.patch
|
@ -1,31 +0,0 @@
|
||||||
diff --git a/lib/sw_apps/zynq_fsbl/src/Makefile b/lib/sw_apps/zynq_fsbl/src/Makefile
|
|
||||||
index 0e3ccdf1c5..a5b02f386e 100644
|
|
||||||
--- a/lib/sw_apps/zynq_fsbl/src/Makefile
|
|
||||||
+++ b/lib/sw_apps/zynq_fsbl/src/Makefile
|
|
||||||
@@ -71,11 +71,14 @@ endif
|
|
||||||
all: $(EXEC)
|
|
||||||
|
|
||||||
$(EXEC): $(LIBS) $(OBJS) $(INCLUDES)
|
|
||||||
- cp $(BSP_DIR)/$(BOARD)/ps7_init.* .
|
|
||||||
$(LINKER) $(LD1FLAGS) -o $@ $(OBJS) $(LDFLAGS)
|
|
||||||
rm -rf $(OBJS)
|
|
||||||
-
|
|
||||||
-
|
|
||||||
+
|
|
||||||
+.PHONY: ps7_init
|
|
||||||
+
|
|
||||||
+ps7_init:
|
|
||||||
+ cp $(BSP_DIR)/$(BOARD)/ps7_init.* .
|
|
||||||
+
|
|
||||||
$(LIBS):
|
|
||||||
echo "Copying BSP files"
|
|
||||||
$(BSP_DIR)/copy_bsp.sh $(BOARD) $(CC)
|
|
||||||
@@ -86,7 +89,7 @@ $(LIBS):
|
|
||||||
make -C $(BSP_DIR) -k all "CC=armcc" "AR=armar" "C_FLAGS= -O2 -c" "EC_FLAGS=--debug --wchar32"; \
|
|
||||||
fi;
|
|
||||||
|
|
||||||
-%.o:%.c
|
|
||||||
+%.o:%.c ps7_init
|
|
||||||
$(CC) $(CC_FLAGS) $(CFLAGS) $(ECFLAGS) -c $< -o $@ $(INCLUDEPATH)
|
|
||||||
|
|
||||||
%.o:%.S
|
|
134
gnutoolchain.nix
134
gnutoolchain.nix
|
@ -1,134 +0,0 @@
|
||||||
{ pkgs ? import <nixpkgs> }:
|
|
||||||
let
|
|
||||||
|
|
||||||
platform = "arm-none-eabi";
|
|
||||||
|
|
||||||
binutils-pkg = { stdenv, buildPackages
|
|
||||||
, fetchurl, zlib
|
|
||||||
, extraConfigureFlags ? []
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
basename = "binutils";
|
|
||||||
version = "2.30";
|
|
||||||
name = "${basename}-${platform}-${version}";
|
|
||||||
src = fetchurl {
|
|
||||||
url = "https://ftp.gnu.org/gnu/binutils/binutils-${version}.tar.bz2";
|
|
||||||
sha256 = "028cklfqaab24glva1ks2aqa1zxa6w6xmc8q34zs1sb7h22dxspg";
|
|
||||||
};
|
|
||||||
configureFlags = [
|
|
||||||
"--enable-deterministic-archives"
|
|
||||||
"--target=${platform}"
|
|
||||||
"--with-cpu=cortex-a9"
|
|
||||||
"--with-fpu=vfpv3"
|
|
||||||
"--with-float=hard"
|
|
||||||
"--with-mode=thumb"
|
|
||||||
] ++ extraConfigureFlags;
|
|
||||||
outputs = [ "out" "info" "man" ];
|
|
||||||
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
||||||
buildInputs = [ zlib ];
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
meta = {
|
|
||||||
description = "Tools for manipulating binaries (linker, assembler, etc.)";
|
|
||||||
longDescription = ''
|
|
||||||
The GNU Binutils are a collection of binary tools. The main
|
|
||||||
ones are `ld' (the GNU linker) and `as' (the GNU assembler).
|
|
||||||
They also include the BFD (Binary File Descriptor) library,
|
|
||||||
`gprof', `nm', `strip', etc.
|
|
||||||
'';
|
|
||||||
homepage = http://www.gnu.org/software/binutils/;
|
|
||||||
license = stdenv.lib.licenses.gpl3Plus;
|
|
||||||
/* Give binutils a lower priority than gcc-wrapper to prevent a
|
|
||||||
collision due to the ld/as wrappers/symlinks in the latter. */
|
|
||||||
priority = "10";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
gcc-pkg = { stdenv, buildPackages
|
|
||||||
, fetchurl, gmp, mpfr, libmpc, platform-binutils
|
|
||||||
, extraConfigureFlags ? []
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
basename = "gcc";
|
|
||||||
version = "9.1.0";
|
|
||||||
name = "${basename}-${platform}-${version}";
|
|
||||||
src = fetchurl {
|
|
||||||
url = "https://ftp.gnu.org/gnu/gcc/gcc-${version}/gcc-${version}.tar.xz";
|
|
||||||
sha256 = "1817nc2bqdc251k0lpc51cimna7v68xjrnvqzvc50q3ax4s6i9kr";
|
|
||||||
};
|
|
||||||
preConfigure =
|
|
||||||
''
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
'';
|
|
||||||
configureScript = "../configure";
|
|
||||||
configureFlags =
|
|
||||||
[ "--target=${platform}"
|
|
||||||
"--with-arch=armv7-a"
|
|
||||||
"--with-tune=cortex-a9"
|
|
||||||
"--with-fpu=vfpv3"
|
|
||||||
"--with-float=hard"
|
|
||||||
"--disable-libssp"
|
|
||||||
"--enable-languages=c"
|
|
||||||
"--with-as=${platform-binutils}/bin/${platform}-as"
|
|
||||||
"--with-ld=${platform-binutils}/bin/${platform}-ld" ] ++ extraConfigureFlags;
|
|
||||||
outputs = [ "out" "info" "man" ];
|
|
||||||
hardeningDisable = [ "format" "pie" ];
|
|
||||||
propagatedBuildInputs = [ gmp mpfr libmpc platform-binutils ];
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
dontFixup = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
newlib-pkg = { stdenv, fetchurl, buildPackages, platform-binutils, platform-gcc }:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "newlib";
|
|
||||||
version = "3.1.0";
|
|
||||||
src = fetchurl {
|
|
||||||
url = "ftp://sourceware.org/pub/newlib/newlib-${version}.tar.gz";
|
|
||||||
sha256 = "0ahh3n079zjp7d9wynggwrnrs27440aac04340chf1p9476a2kzv";
|
|
||||||
};
|
|
||||||
|
|
||||||
nativeBuildInputs = [ platform-binutils platform-gcc ];
|
|
||||||
|
|
||||||
configureFlags = [
|
|
||||||
"--target=${platform}"
|
|
||||||
|
|
||||||
"--with-cpu=cortex-a9"
|
|
||||||
"--with-fpu=vfpv3"
|
|
||||||
"--with-float=hard"
|
|
||||||
"--with-mode=thumb"
|
|
||||||
"--enable-interwork"
|
|
||||||
"--disable-multilib"
|
|
||||||
|
|
||||||
"--disable-newlib-supplied-syscalls"
|
|
||||||
"--with-gnu-ld"
|
|
||||||
"--with-gnu-as"
|
|
||||||
"--disable-newlib-io-float"
|
|
||||||
"--disable-werror"
|
|
||||||
];
|
|
||||||
dontFixup = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
in rec {
|
|
||||||
binutils-bootstrap = pkgs.callPackage binutils-pkg { };
|
|
||||||
gcc-bootstrap = pkgs.callPackage gcc-pkg {
|
|
||||||
platform-binutils = binutils-bootstrap;
|
|
||||||
extraConfigureFlags = [ "--disable-libgcc" ];
|
|
||||||
};
|
|
||||||
newlib = pkgs.callPackage newlib-pkg {
|
|
||||||
platform-binutils = binutils-bootstrap;
|
|
||||||
platform-gcc = gcc-bootstrap;
|
|
||||||
};
|
|
||||||
binutils = pkgs.callPackage binutils-pkg {
|
|
||||||
extraConfigureFlags = [ "--with-lib-path=${newlib}/arm-none-eabi/lib" ];
|
|
||||||
};
|
|
||||||
gcc = pkgs.callPackage gcc-pkg {
|
|
||||||
platform-binutils = binutils;
|
|
||||||
extraConfigureFlags = [ "--enable-newlib" "--with-headers=${newlib}/arm-none-eabi/include" ];
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
{ pkgs }:
|
|
||||||
|
|
||||||
pkgs.stdenv.mkDerivation {
|
|
||||||
pname = "mkbootimage";
|
|
||||||
version = "2.2";
|
|
||||||
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "antmicro";
|
|
||||||
repo = "zynq-mkbootimage";
|
|
||||||
rev = "4ee42d782a9ba65725ed165a4916853224a8edf7";
|
|
||||||
sha256 = "1k1mbsngqadqihzjgvwvsrkvryxy5ladpxd9yh9iqn2s7fxqwqa9";
|
|
||||||
};
|
|
||||||
|
|
||||||
propagatedBuildInputs = [ pkgs.libelf pkgs.pcre ];
|
|
||||||
patchPhase =
|
|
||||||
''
|
|
||||||
substituteInPlace Makefile --replace "git rev-parse --short HEAD" "echo nix"
|
|
||||||
'';
|
|
||||||
installPhase =
|
|
||||||
''
|
|
||||||
mkdir -p $out/bin
|
|
||||||
cp mkbootimage $out/bin
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
let
|
|
||||||
pkgs = import <nixpkgs> {};
|
|
||||||
overlay = pkgs.fetchFromGitHub {
|
|
||||||
owner = "mozilla";
|
|
||||||
repo = "nixpkgs-mozilla";
|
|
||||||
rev = "efda5b357451dbb0431f983cca679ae3cd9b9829";
|
|
||||||
sha256 = "11wqrg86g3qva67vnk81ynvqyfj0zxk83cbrf0p9hsvxiwxs8469";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
import overlay
|
|
|
@ -1,24 +0,0 @@
|
||||||
{ pkgs }:
|
|
||||||
|
|
||||||
let
|
|
||||||
rustcSrc = pkgs.fetchgit {
|
|
||||||
url = "https://github.com/rust-lang/rust.git";
|
|
||||||
# sync with git_commit_hash from pkg.rust in channel-rust-nightly.toml
|
|
||||||
rev = "5ef299eb9805b4c86b227b718b39084e8bf24454";
|
|
||||||
sha256 = "0gc9hmb1sfkaf3ba8fsynl1n6bs8nk65hbhhx7ss89dfkrsxrn0x";
|
|
||||||
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,8 +1,8 @@
|
||||||
let
|
let
|
||||||
pkgs = import <nixpkgs> { overlays = [ (import ./mozilla-overlay.nix) ]; };
|
zynq-rs = (import ./zynq-rs.nix);
|
||||||
|
pkgs = import <nixpkgs> { overlays = [ (import "${zynq-rs}/nix/mozilla-overlay.nix") ]; };
|
||||||
|
rustPlatform = (import "${zynq-rs}/nix/rust-platform.nix" { inherit pkgs; });
|
||||||
artiq-fast = <artiq-fast>;
|
artiq-fast = <artiq-fast>;
|
||||||
zynq-rs = (import ./zynq-rs.nix { inherit pkgs; });
|
|
||||||
rustPlatform = (import ./rustPlatform.nix { inherit pkgs; });
|
|
||||||
artiqpkgs = import "${artiq-fast}/default.nix" { inherit pkgs; };
|
artiqpkgs = import "${artiq-fast}/default.nix" { inherit pkgs; };
|
||||||
vivado = import "${artiq-fast}/vivado.nix" { inherit pkgs; };
|
vivado = import "${artiq-fast}/vivado.nix" { inherit pkgs; };
|
||||||
cargo-xbuild = import ./cargo-xbuild.nix { inherit pkgs; };
|
cargo-xbuild = import ./cargo-xbuild.nix { inherit pkgs; };
|
||||||
|
@ -25,7 +25,7 @@ in
|
||||||
vivado
|
vivado
|
||||||
artiqpkgs.binutils-arm
|
artiqpkgs.binutils-arm
|
||||||
|
|
||||||
(import ./mkbootimage.nix { inherit pkgs; })
|
(import "${zynq-rs}/nix/mkbootimage.nix" { inherit pkgs; })
|
||||||
];
|
];
|
||||||
|
|
||||||
XARGO_RUST_SRC = "${rustPlatform.rust.rustc.src}/src";
|
XARGO_RUST_SRC = "${rustPlatform.rust.rustc.src}/src";
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
{ pkgs }:
|
let
|
||||||
|
pkgs = import <nixpkgs> {};
|
||||||
|
in
|
||||||
pkgs.fetchgit {
|
pkgs.fetchgit {
|
||||||
url = "https://git.m-labs.hk/M-Labs/zynq-rs.git";
|
url = "https://git.m-labs.hk/M-Labs/zynq-rs.git";
|
||||||
rev = "4e18368aaf59c29e703d5ecae6c0eb93ef89c2d2";
|
rev = "450ccef18e609aa6c88540d6791e0b41d2de01d2";
|
||||||
sha256 = "0jfnjn76pfq5wp6qnxhkqmvldv02cy60wyp1ikaj9n47p69cabj8";
|
sha256 = "0xlvxczfwyk5zij4gnbxjvcq3hmhjslmfswp6vzl67ddkpc8bb6s";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue