artiq-board: use legacy code for artiq<6
This commit is contained in:
parent
a30db2ba2e
commit
cb83f38ccd
|
@ -0,0 +1,99 @@
|
||||||
|
# Install Vivado in /opt and add to /etc/nixos/configuration.nix:
|
||||||
|
# nix.sandboxPaths = ["/opt"];
|
||||||
|
|
||||||
|
{ pkgs
|
||||||
|
, vivado ? import ./vivado.nix { inherit pkgs; }
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
artiqSrc = import ./pkgs/artiq-src.nix { fetchgit = pkgs.fetchgit; };
|
||||||
|
artiqpkgs = import ./default.nix { inherit pkgs; };
|
||||||
|
fetchcargo = import ./fetchcargo.nix {
|
||||||
|
inherit (pkgs) stdenv cacert git;
|
||||||
|
inherit (artiqpkgs) cargo cargo-vendor;
|
||||||
|
};
|
||||||
|
cargoDeps = fetchcargo rec {
|
||||||
|
name = "artiq-firmware-cargo-deps";
|
||||||
|
src = "${artiqSrc}/artiq/firmware";
|
||||||
|
sha256 = (import "${artiqSrc}/artiq/firmware/cargosha256.nix");
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoVendored = pkgs.stdenv.mkDerivation {
|
||||||
|
name = "artiq-firmware-cargo-vendored";
|
||||||
|
src = cargoDeps;
|
||||||
|
phases = [ "unpackPhase" "installPhase" ];
|
||||||
|
installPhase =
|
||||||
|
''
|
||||||
|
mkdir -p $out/registry
|
||||||
|
cat << EOF > $out/config
|
||||||
|
[source.crates-io]
|
||||||
|
registry = "https://github.com/rust-lang/crates.io-index"
|
||||||
|
replace-with = "vendored-sources"
|
||||||
|
|
||||||
|
[source."https://github.com/m-labs/libfringe"]
|
||||||
|
git = "https://github.com/m-labs/libfringe"
|
||||||
|
rev = "b8a6d8f"
|
||||||
|
replace-with = "vendored-sources"
|
||||||
|
|
||||||
|
[source.vendored-sources]
|
||||||
|
directory = "$out/registry"
|
||||||
|
EOF
|
||||||
|
cp -R * $out/registry
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
in
|
||||||
|
{ target
|
||||||
|
, variant
|
||||||
|
, src ? null
|
||||||
|
, buildCommand ? "python -m artiq.gateware.targets.${target} -V ${variant}"
|
||||||
|
, extraInstallCommands ? ""}:
|
||||||
|
|
||||||
|
# Board packages are Python modules so that they get added to the ARTIQ Python
|
||||||
|
# environment, and artiq_flash finds them.
|
||||||
|
pkgs.python3Packages.toPythonModule (pkgs.stdenv.mkDerivation rec {
|
||||||
|
name = "artiq-board-${target}-${variant}-${version}";
|
||||||
|
version = import ./pkgs/artiq-version.nix (with pkgs; { inherit stdenv fetchgit git; });
|
||||||
|
inherit src;
|
||||||
|
phases = [ "buildPhase" "installCheckPhase" "installPhase" "checkPhase" ];
|
||||||
|
buildInputs = [
|
||||||
|
vivado
|
||||||
|
pkgs.gnumake
|
||||||
|
(pkgs.python3.withPackages(ps: with ps; [ jinja2 numpy artiqpkgs.migen artiqpkgs.microscope artiqpkgs.misoc artiqpkgs.jesd204b artiqpkgs.artiq ]))
|
||||||
|
artiqpkgs.cargo
|
||||||
|
artiqpkgs.rustc
|
||||||
|
artiqpkgs.binutils-or1k
|
||||||
|
artiqpkgs.llvm-or1k
|
||||||
|
];
|
||||||
|
buildPhase =
|
||||||
|
''
|
||||||
|
export CARGO_HOME=${cargoVendored}
|
||||||
|
export TARGET_AR=or1k-linux-ar
|
||||||
|
${buildCommand}
|
||||||
|
'';
|
||||||
|
# temporarily disabled because there is currently always at least one Kasli bitstream
|
||||||
|
# that fails timing and blocks the conda channel.
|
||||||
|
doCheck = false;
|
||||||
|
checkPhase = ''
|
||||||
|
# Search for PCREs in the Vivado output to check for errors
|
||||||
|
check_log() {
|
||||||
|
grep -Pe "$1" artiq_${target}/${variant}/gateware/vivado.log && exit 1 || true
|
||||||
|
}
|
||||||
|
check_log "\d+ constraint not met\."
|
||||||
|
check_log "Timing constraints are not met\."
|
||||||
|
'';
|
||||||
|
installPhase =
|
||||||
|
''
|
||||||
|
TARGET_DIR=$out/${pkgs.python3Packages.python.sitePackages}/artiq/board-support/${target}-${variant}
|
||||||
|
mkdir -p $TARGET_DIR
|
||||||
|
cp artiq_${target}/${variant}/gateware/top.bit $TARGET_DIR
|
||||||
|
if [ -e artiq_${target}/${variant}/software/bootloader/bootloader.bin ]
|
||||||
|
then cp artiq_${target}/${variant}/software/bootloader/bootloader.bin $TARGET_DIR
|
||||||
|
fi
|
||||||
|
if [ -e artiq_${target}/${variant}/software/runtime ]
|
||||||
|
then cp artiq_${target}/${variant}/software/runtime/runtime.{elf,fbi} $TARGET_DIR
|
||||||
|
else cp artiq_${target}/${variant}/software/satman/satman.{elf,fbi} $TARGET_DIR
|
||||||
|
fi
|
||||||
|
${extraInstallCommands}
|
||||||
|
'';
|
||||||
|
})
|
|
@ -10,7 +10,11 @@ let
|
||||||
];
|
];
|
||||||
boardPackages = pkgs.lib.lists.foldr (board: start:
|
boardPackages = pkgs.lib.lists.foldr (board: start:
|
||||||
let
|
let
|
||||||
boardBinaries = import ./artiq-board.nix { inherit pkgs; } {
|
packageImport =
|
||||||
|
if artiq6
|
||||||
|
then ./artiq-board.nix
|
||||||
|
else ./artiq-board-legacy.nix;
|
||||||
|
boardBinaries = import packageImport { inherit pkgs; } {
|
||||||
target = board.target;
|
target = board.target;
|
||||||
variant = board.variant;
|
variant = board.variant;
|
||||||
};
|
};
|
||||||
|
|
|
@ -108,7 +108,11 @@ let
|
||||||
]);
|
]);
|
||||||
|
|
||||||
vivado = import ./fast/vivado.nix { inherit pkgs; };
|
vivado = import ./fast/vivado.nix { inherit pkgs; };
|
||||||
artiq-board = import ./fast/artiq-board.nix { inherit pkgs vivado; };
|
artiq-board-import =
|
||||||
|
if pkgs.lib.strings.versionAtLeast artiq-fast.artiq.version "6.0"
|
||||||
|
then ./fast/artiq-board.nix
|
||||||
|
else ./fast/artiq-board-legacy.nix;
|
||||||
|
artiq-board = import artiq-board-import { inherit pkgs vivado; };
|
||||||
conda-artiq-board = import ./conda-artiq-board.nix { inherit pkgs; };
|
conda-artiq-board = import ./conda-artiq-board.nix { inherit pkgs; };
|
||||||
src = pkgs.fetchgit {
|
src = pkgs.fetchgit {
|
||||||
url = "https://git.m-labs.hk/M-Labs/sinara-systems.git";
|
url = "https://git.m-labs.hk/M-Labs/sinara-systems.git";
|
||||||
|
|
Loading…
Reference in New Issue