forked from M-Labs/artiq
nix: add development environment
This commit is contained in:
parent
421ad9c916
commit
1e7ba3227f
@ -1,12 +1,10 @@
|
||||
Install ARTIQ via the Nix Package Manager
|
||||
=========================================
|
||||
Use ARTIQ via the Nix Package Manager
|
||||
=====================================
|
||||
|
||||
These instructions provide an alternative route to install ARTIQ for people who do not wish to use conda.
|
||||
|
||||
This sets up an environment suitable for using ARTIQ, including the ARTIQ-Python compiler, device drivers, and the graphical user interfaces. This works correctly on Linux, and partially works (but not to a level that we would consider usable) with WSL introduced in Windows 10.
|
||||
|
||||
ARTIQ firmware and gateware development tools (e.g. rustc, Migen) and ARTIQ core device flashing tools (OpenOCD, proxy bitstreams) are currently not available on Nix. Pull requests welcome!
|
||||
|
||||
* Install the Nix package manager
|
||||
|
||||
* many Linux distros already have a package for the `Nix package manager <http://nixos.org/nix/>`_
|
||||
@ -25,4 +23,13 @@ ARTIQ firmware and gateware development tools (e.g. rustc, Migen) and ARTIQ core
|
||||
* $ ``cd artiq/nix``
|
||||
* $ ``nix-env -i -f default.nix``
|
||||
|
||||
The above command will setup your entire environment. Note that it will compile LLVM and Clang, which uses a lot of CPU time and disk space.
|
||||
The above command will setup your entire environment. Note that it will compile LLVM, which uses a lot of CPU time and disk space.
|
||||
|
||||
ARTIQ development environment with Nix
|
||||
======================================
|
||||
|
||||
Run ``nix-shell artiq-dev.nix`` to obtain an environment containing Migen, MiSoC, Clang, Rust, Cargo, and OpenOCD in addition to the user environment above.
|
||||
|
||||
This creates a FHS chroot environment in order to simplify the installation and patching of Xilinx Vivado (it needs to be installed manually e.g. in your home folder).
|
||||
|
||||
You can then build the firmware and gateware with a command such as ``python -m artiq.gateware.targets.kasli --gateware-toolchain-path ~/Xilinx/Vivado``.
|
||||
|
33
nix/artiq-dev.nix
Normal file
33
nix/artiq-dev.nix
Normal file
@ -0,0 +1,33 @@
|
||||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
artiqpkgs = import ./default.nix { inherit pkgs; };
|
||||
in
|
||||
(
|
||||
pkgs.buildFHSUserEnv {
|
||||
name = "artiq-dev";
|
||||
targetPkgs = pkgs: (
|
||||
with pkgs; [
|
||||
ncurses5
|
||||
gnumake
|
||||
xorg.libSM
|
||||
xorg.libICE
|
||||
xorg.libXrender
|
||||
xorg.libX11
|
||||
xorg.libXext
|
||||
xorg.libXtst
|
||||
xorg.libXi
|
||||
(python3.withPackages(ps: with ps; [ jinja2 numpy artiqpkgs.migen artiqpkgs.misoc artiqpkgs.artiq ]))
|
||||
] ++
|
||||
(with artiqpkgs; [
|
||||
rustc
|
||||
cargo
|
||||
binutils-or1k
|
||||
llvm-or1k
|
||||
openocd
|
||||
])
|
||||
);
|
||||
profile = ''
|
||||
export TARGET_AR=${artiqpkgs.binutils-or1k}/bin/or1k-linux-ar
|
||||
'';
|
||||
}
|
||||
).env
|
@ -14,4 +14,5 @@ in rec {
|
||||
llvm-or1k = callPackage ./llvm-or1k.nix { inherit llvm-src; };
|
||||
llvmlite = callPackage ./llvmlite.nix { inherit llvm-or1k; };
|
||||
artiq = callPackage ./artiq.nix { inherit binutils-or1k; inherit llvm-or1k; inherit llvmlite; };
|
||||
openocd = callPackage ./pkgs/openocd.nix {};
|
||||
}
|
||||
|
63
nix/pkgs/openocd.nix
Normal file
63
nix/pkgs/openocd.nix
Normal file
@ -0,0 +1,63 @@
|
||||
{ stdenv, fetchFromGitHub, autoreconfHook, libftdi, libusb1, pkgconfig, hidapi }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "openocd-${version}";
|
||||
version = "0.10.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "openocd";
|
||||
fetchSubmodules = true;
|
||||
rev = "c383a57adcff332b2c5cf8d55a84626285b42c2c";
|
||||
sha256 = "0xlj9cs72acx3zqagvr7f1c0v6lnqhl8fgrlhgmhmvk5n9knk492";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
buildInputs = [ autoreconfHook libftdi libusb1 hidapi ];
|
||||
|
||||
configureFlags = [
|
||||
"--enable-jtag_vpi"
|
||||
"--enable-usb_blaster_libftdi"
|
||||
"--enable-amtjtagaccel"
|
||||
"--enable-gw16012"
|
||||
"--enable-presto_libftdi"
|
||||
"--enable-openjtag_ftdi"
|
||||
"--enable-oocd_trace"
|
||||
"--enable-buspirate"
|
||||
"--enable-sysfsgpio"
|
||||
"--enable-remote-bitbang"
|
||||
];
|
||||
|
||||
NIX_CFLAGS_COMPILE = [
|
||||
"-Wno-implicit-fallthrough"
|
||||
"-Wno-format-truncation"
|
||||
"-Wno-format-overflow"
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p "$out/etc/udev/rules.d"
|
||||
rules="$out/share/openocd/contrib/60-openocd.rules"
|
||||
if [ ! -f "$rules" ]; then
|
||||
echo "$rules is missing, must update the Nix file."
|
||||
exit 1
|
||||
fi
|
||||
ln -s "$rules" "$out/etc/udev/rules.d/"
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Free and Open On-Chip Debugging, In-System Programming and Boundary-Scan Testing";
|
||||
longDescription = ''
|
||||
OpenOCD provides on-chip programming and debugging support with a layered
|
||||
architecture of JTAG interface and TAP support, debug target support
|
||||
(e.g. ARM, MIPS), and flash chip drivers (e.g. CFI, NAND, etc.). Several
|
||||
network interfaces are available for interactiving with OpenOCD: HTTP,
|
||||
telnet, TCL, and GDB. The GDB server enables OpenOCD to function as a
|
||||
"remote target" for source-level debugging of embedded systems using the
|
||||
GNU GDB program.
|
||||
'';
|
||||
homepage = http://openocd.sourceforge.net/;
|
||||
license = licenses.gpl2Plus;
|
||||
maintainers = with maintainers; [ bjornfor ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user