Skip to content

Commit

Permalink
Merge pull request #12 from clash-lang/add-nix-openocd
Browse files Browse the repository at this point in the history
Add VexRiscv's OpenOCD to Nix environment
  • Loading branch information
hydrolarus authored Jan 31, 2024
2 parents 19897d8 + 42c3717 commit dd29501
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions nix/nixpkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ let
# Nix tooling
niv = (import sources.niv {}).niv;
gitignore = import sources.gitignore { inherit (nixpkgs) lib; };
openocd-vexriscv = import ./openocd-vexriscv.nix { inherit (nixpkgs) pkgs; };

# Haskell overrides
haskellPackages = nixpkgs.haskellPackages.override {
Expand Down
35 changes: 35 additions & 0 deletions nix/openocd-vexriscv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# SPDX-FileCopyrightText: 2023 Google LLC

# SPDX-License-Identifier: CC0-1.0
{ pkgs ? import ./nixpkgs.nix {} }:

pkgs.stdenv.mkDerivation rec {
name = "openocd-vexriscv";

buildInputs = [
pkgs.autoconf
pkgs.automake
pkgs.coreutils
pkgs.git
pkgs.libtool
pkgs.libusb1
pkgs.libyaml
pkgs.pkg-config
pkgs.texinfo
pkgs.which
];

src = pkgs.fetchgit {
url = "https://github.com/SpinalHDL/openocd_riscv.git";
rev = "058dfa50d625893bee9fecf8d604141911fac125";
sha256 = "sha256-5BvR45A3/7NqivQpYwaFnu7ra/Rf8giRig8R3zSYVd8=";
};

installPhase = ''
SKIP_SUBMODULE=1 ./bootstrap
./configure --enable-ftdi --enable-dummy --prefix=$out
make -j $(nproc)
make install
mv $out/bin/openocd $out/bin/openocd-vexriscv
'';
}
3 changes: 3 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ pkgs.mkShell {

(pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml)

# VexRiscV needs a special openocd
pkgs.openocd-vexriscv

# For Cabal to clone git repos
pkgs.buildPackages.git
]
Expand Down

0 comments on commit dd29501

Please sign in to comment.