From 5e2664ae7e7e2dd319110548818c65967d1034af Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 2 Sep 2021 11:18:58 +0800 Subject: [PATCH] flake: add openocd --- flake.nix | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 0ac1723f8..d67076f9b 100644 --- a/flake.nix +++ b/flake.nix @@ -264,6 +264,36 @@ target = "kc705"; variant = "nist_clock"; }; + + openocd-bscanspi = let + bscan_spi_bitstreams-pkg = pkgs.stdenv.mkDerivation { + name = "bscan_spi_bitstreams"; + src = pkgs.fetchFromGitHub { + owner = "quartiq"; + repo = "bscan_spi_bitstreams"; + rev = "01d8f819f15baf9a8cc5d96945a51e4d267ff564"; + sha256 = "1zqv47kzgvbn4c8cr019a6wcja7gn5h1z4kvw5bhpc72fyhagal9"; + }; + phases = ["installPhase"]; + installPhase = + '' + mkdir -p $out/share/bscan-spi-bitstreams + cp $src/*.bit $out/share/bscan-spi-bitstreams + ''; + }; + # https://docs.lambdaconcept.com/screamer/troubleshooting.html#error-contents-differ + openocd-fixed = pkgs.openocd.overrideAttrs(oa: { + patches = oa.patches or [] ++ [ + (pkgs.fetchurl { + url = "https://docs.lambdaconcept.com/screamer/_downloads/f0357c5f44c3c8c49f575cee5b6634a8/flashid.patch"; + sha256 = "015h4fzdrpwy5ssqbpk826snnfkkqijkmjzr5ws0a2v0ci97jzm9"; + }) + ]; + }); + in pkgs.buildEnv { + name = "openocd-bscanspi"; + paths = [ openocd-fixed bscan_spi_bitstreams-pkg ]; + }; }; defaultPackage.x86_64-linux = pkgs.python3.withPackages(ps: [ packages.x86_64-linux.artiq ]); @@ -271,7 +301,7 @@ devShell.x86_64-linux = pkgs.mkShell { name = "artiq-dev-shell"; buildInputs = [ - (pkgs.python3.withPackages(ps: with packages.x86_64-linux; [ migen misoc artiq ])) + (pkgs.python3.withPackages(ps: with packages.x86_64-linux; [ migen misoc artiq ps.paramiko ])) rustPlatform.rust.rustc rustPlatform.rust.cargo pkgs.llvmPackages_11.clang-unwrapped @@ -280,12 +310,13 @@ # use the vivado-env command to enter a FHS shell that lets you run the Vivado installer packages.x86_64-linux.vivadoEnv packages.x86_64-linux.vivado + packages.x86_64-linux.openocd-bscanspi ]; TARGET_AR="llvm-ar"; }; hydraJobs = { - inherit (packages.x86_64-linux) artiq artiq-board-kc705-nist-clock; + inherit (packages.x86_64-linux) artiq artiq-board-kc705-nist-clock openocd-bscanspi; }; };