2020-11-15 13:44:38 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchgit
|
|
|
|
, autoreconfHook
|
|
|
|
, pkg-config
|
|
|
|
, hidapi
|
|
|
|
, libftdi1
|
|
|
|
, libusb1
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "openocd";
|
2021-01-05 17:05:55 +00:00
|
|
|
version = "0.11.0-rc1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
src = fetchgit {
|
|
|
|
url = "https://git.code.sf.net/p/openocd/code";
|
2021-01-05 17:05:55 +00:00
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "15g8qalyxhdp0imfrg8mxwnp0nimd836fc5laaavajw49gcm65m4";
|
2020-09-25 04:45:31 +00:00
|
|
|
fetchSubmodules = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-11-15 13:44:38 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook pkg-config ];
|
|
|
|
|
|
|
|
buildInputs = [ hidapi libftdi1 libusb1 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--enable-jtag_vpi"
|
|
|
|
"--enable-usb_blaster_libftdi"
|
|
|
|
(lib.enableFeature (! stdenv.isDarwin) "amtjtagaccel")
|
|
|
|
(lib.enableFeature (! stdenv.isDarwin) "gw16012")
|
|
|
|
"--enable-presto_libftdi"
|
|
|
|
"--enable-openjtag_ftdi"
|
|
|
|
(lib.enableFeature (! stdenv.isDarwin) "oocd_trace")
|
|
|
|
"--enable-buspirate"
|
|
|
|
(lib.enableFeature stdenv.isLinux "sysfsgpio")
|
|
|
|
"--enable-remote-bitbang"
|
|
|
|
];
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
|
2020-04-24 23:36:52 +00:00
|
|
|
"-Wno-error=cpp"
|
2020-11-15 13:44:38 +00:00
|
|
|
"-Wno-error=strict-prototypes" # fixes build failure with hidapi 0.10.0
|
2020-09-25 04:45:31 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
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 = "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.
|
|
|
|
'';
|
2020-09-25 04:45:31 +00:00
|
|
|
homepage = "https://openocd.sourceforge.net/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
maintainers = with maintainers; [ bjornfor ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|