From 3fe5ce25c529ba6852f392ad3623ca1fb27f3565 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 3 Jul 2019 20:26:30 +0800 Subject: [PATCH] clean up bitstream build Also make the development shell a more ergonomic regular nix-shell instead of the FHS env shell. --- artiq/artiq-board.nix | 20 ++++++++++++++++---- artiq/artiq-dev.nix | 35 ----------------------------------- artiq/pkgs/python-deps.nix | 8 ++++---- artiq/shell-dev.nix | 17 +++++++++++++++-- artiq/vivado.nix | 24 ++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 45 deletions(-) delete mode 100644 artiq/artiq-dev.nix create mode 100644 artiq/vivado.nix diff --git a/artiq/artiq-board.nix b/artiq/artiq-board.nix index e3671e6..05d36ed 100644 --- a/artiq/artiq-board.nix +++ b/artiq/artiq-board.nix @@ -8,10 +8,10 @@ , extraInstallCommands ? ""}: let + artiqSrc = import ./pkgs/artiq-src.nix { fetchgit = pkgs.fetchgit; }; fetchcargo = import ./fetchcargo.nix { inherit (pkgs) stdenv cacert git cargo cargo-vendor; }; - artiqSrc = import ./pkgs/artiq-src.nix { fetchgit = pkgs.fetchgit; }; cargoDeps = fetchcargo rec { name = "artiq-firmware-cargo-deps"; src = "${artiqSrc}/artiq/firmware"; @@ -42,15 +42,27 @@ let ''; }; - buildenv = import ./artiq-dev.nix { inherit pkgs; }; + vivado = import ./vivado.nix { inherit pkgs; }; + artiqpkgs = import ./default.nix { inherit pkgs; }; -in pkgs.python3Packages.buildPythonPackage rec { +in pkgs.stdenv.mkDerivation rec { name = "artiq-board-${target}-${variant}-${version}"; version = import ./pkgs/artiq-version.nix (with pkgs; { inherit stdenv fetchgit git; }); phases = [ "buildPhase" "installCheckPhase" "installPhase" ]; + buildInputs = [ + vivado + pkgs.gnumake + (pkgs.python3.withPackages(ps: with ps; [ jinja2 numpy artiqpkgs.migen artiqpkgs.microscope artiqpkgs.misoc artiqpkgs.jesd204b artiqpkgs.artiq ])) + pkgs.cargo + artiqpkgs.rustc + artiqpkgs.binutils-or1k + artiqpkgs.llvm-or1k + ]; buildPhase = '' - ${buildenv}/bin/artiq-dev -c "export CARGO_HOME=${cargoVendored}; ${buildCommand}" + export CARGO_HOME=${cargoVendored} + export TARGET_AR=or1k-linux-ar + ${buildCommand} ''; checkPhase = '' # Search for PCREs in the Vivado output to check for errors diff --git a/artiq/artiq-dev.nix b/artiq/artiq-dev.nix deleted file mode 100644 index 8f1e3f0..0000000 --- a/artiq/artiq-dev.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ pkgs }: - -let - artiqpkgs = import ./default.nix { inherit pkgs; }; -in - pkgs.buildFHSUserEnv { - name = "artiq-dev"; - targetPkgs = pkgs: ( - with pkgs; [ - ncurses5 - gnumake - zlib - libuuid - xorg.libSM - xorg.libICE - xorg.libXrender - xorg.libX11 - xorg.libXext - xorg.libXtst - xorg.libXi - (python3.withPackages(ps: with ps; [ jinja2 numpy paramiko artiqpkgs.migen artiqpkgs.microscope artiqpkgs.misoc artiqpkgs.jesd204b artiqpkgs.artiq ])) - git - cargo - ] ++ - (with artiqpkgs; [ - rustc - binutils-or1k - llvm-or1k - openocd - ]) - ); - profile = '' - export TARGET_AR=${artiqpkgs.binutils-or1k}/bin/or1k-linux-ar - ''; - } diff --git a/artiq/pkgs/python-deps.nix b/artiq/pkgs/python-deps.nix index 645897d..945b9d6 100644 --- a/artiq/pkgs/python-deps.nix +++ b/artiq/pkgs/python-deps.nix @@ -83,8 +83,8 @@ rec { src = fetchFromGitHub { owner = "m-labs"; repo = "misoc"; - rev = "6e9c1a894312a81b534482949cbfc5f47842edd9"; - sha256 = "0y4jh60bmpzzh06k2gzxl3pqzbvvg8ipz029hvmi8d05hzf4kcf3"; + rev = "ba816951606d5463d3d2df9fcc6e143b17b3a8a8"; + sha256 = "06f2fgp46cgkwgjwdlppl73d8c1k960xm5niq96z647lsblj2d16"; fetchSubmodules = true; }; @@ -107,8 +107,8 @@ rec { src = fetchFromGitHub { owner = "m-labs"; repo = "migen"; - rev = "5c5486ba9900b1a89a405f4b063dd7faf0e59a4a"; - sha256 = "116c5sc8814xmbb99h7sd0j42qak0b5xpl4276lyi2ap4swmxd4h"; + rev = "caab41469f5a0cb4014bc00a03898a0b76b00dd1"; + sha256 = "06zbbbjzlbyq2nlp13hyk8diw06zrffc37n4b6cxzk1i2aq8g83m"; }; propagatedBuildInputs = with python3Packages; [ colorama sphinx sphinx_rtd_theme ]; diff --git a/artiq/shell-dev.nix b/artiq/shell-dev.nix index d7ff9a0..bf9e9a4 100644 --- a/artiq/shell-dev.nix +++ b/artiq/shell-dev.nix @@ -1,6 +1,19 @@ { pkgs ? import {}}: let - artiq-dev = import ./artiq-dev.nix { inherit pkgs; }; + artiqpkgs = import ./default.nix { inherit pkgs; }; + vivado = import ./vivado.nix { inherit pkgs; }; in - artiq-dev.env + pkgs.mkShell { + buildInputs = [ + vivado + pkgs.gnumake + (pkgs.python3.withPackages(ps: with ps; [ jinja2 numpy paramiko artiqpkgs.migen artiqpkgs.microscope artiqpkgs.misoc artiqpkgs.jesd204b artiqpkgs.artiq ])) + pkgs.cargo + artiqpkgs.rustc + artiqpkgs.binutils-or1k + artiqpkgs.llvm-or1k + artiqpkgs.openocd + ]; + TARGET_AR="or1k-linux-ar"; + } diff --git a/artiq/vivado.nix b/artiq/vivado.nix new file mode 100644 index 0000000..f52d873 --- /dev/null +++ b/artiq/vivado.nix @@ -0,0 +1,24 @@ +# Install Vivado in /opt and add to /etc/nixos/configuration.nix: +# nix.sandboxPaths = ["/opt"]; + +{ pkgs, vivadoPath ? "/opt/Xilinx/Vivado/2019.1" }: + +pkgs.buildFHSUserEnv { + name = "vivado"; + targetPkgs = pkgs: ( + with pkgs; [ + ncurses5 + zlib + libuuid + xorg.libSM + xorg.libICE + xorg.libXrender + xorg.libX11 + xorg.libXext + xorg.libXtst + xorg.libXi + ] + ); + profile = "source ${vivadoPath}/settings64.sh"; + runScript = "vivado"; +}