1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
{ lib
, stdenv
, fetchgit
, pkg-config
, hidapi
, libftdi1
, libusb1
, which
, libtool
, autoconf
, automake
, texinfo
, git
, libgpiod_1
}:
stdenv.mkDerivation {
pname = "openocd-rp2040";
version = "0.12.0";
src = fetchgit {
url = "https://github.com/raspberrypi/openocd";
rev = "4d87f6dcae77d3cbcd8ac3f7dc887adf46ffa504";
sha256 = "sha256-SYC0qqNx09yO/qeKDDN8dF/9d/dofJ5B1h/PofhG8Jw=";
fetchSubmodules = true;
};
nativeBuildInputs = [
pkg-config
];
buildInputs = [
hidapi
libftdi1
libusb1
which
libtool
autoconf
automake
texinfo
git
]
++
# tracking issue for v2 api changes https://sourceforge.net/p/openocd/tickets/306/
lib.optional stdenv.isLinux libgpiod_1;
configurePhase = ''
SKIP_SUBMODULE=1 ./bootstrap
./configure --prefix=$out
'';
enableParallelBuilding = true;
postInstall = lib.optionalString stdenv.isLinux ''
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 lib; {
description = "OpenOCD fork for rp2040 microcontroller";
longDescription = ''
This is a fork of OpenOCD by Raspberry Pi,
which brings support to the rp2040 microcontroller.
'';
homepage = "https://github.com/raspberrypi/openocd";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ lu15w1r7h ];
platforms = platforms.linux;
};
}
|