2020-11-13 21:44:07 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchgit
|
|
|
|
, autoreconfHook
|
|
|
|
, pkg-config
|
|
|
|
, hidapi
|
|
|
|
, libftdi1
|
|
|
|
, libusb1
|
|
|
|
}:
|
2009-09-20 17:43:16 +01:00
|
|
|
|
2013-02-09 13:07:30 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "openocd";
|
2020-11-13 21:44:07 +00:00
|
|
|
version = "unstable-2020-11-11";
|
2009-09-20 17:43:16 +01:00
|
|
|
|
2020-09-03 13:53:46 +01:00
|
|
|
src = fetchgit {
|
|
|
|
url = "https://git.code.sf.net/p/openocd/code";
|
2020-11-13 21:44:07 +00:00
|
|
|
rev = "06c7a53f1fff20bcc4be9e63f83ae98664777f34";
|
|
|
|
sha256 = "0g0w7g94r88ylfpwswnhh8czlf5iqvd991ssn4gfcfd725lpdb01";
|
2020-09-03 13:53:46 +01:00
|
|
|
fetchSubmodules = true;
|
2009-09-20 17:43:16 +01:00
|
|
|
};
|
|
|
|
|
2020-11-13 21:44:07 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook pkg-config ];
|
|
|
|
|
|
|
|
buildInputs = [ hidapi libftdi1 libusb1 ];
|
2014-03-30 14:45:00 +01:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--enable-jtag_vpi"
|
|
|
|
"--enable-usb_blaster_libftdi"
|
2019-05-01 10:56:15 +01:00
|
|
|
(lib.enableFeature (! stdenv.isDarwin) "amtjtagaccel")
|
|
|
|
(lib.enableFeature (! stdenv.isDarwin) "gw16012")
|
2014-03-30 14:45:00 +01:00
|
|
|
"--enable-presto_libftdi"
|
|
|
|
"--enable-openjtag_ftdi"
|
2019-05-01 10:56:15 +01:00
|
|
|
(lib.enableFeature (! stdenv.isDarwin) "oocd_trace")
|
2014-03-30 14:45:00 +01:00
|
|
|
"--enable-buspirate"
|
2019-05-01 10:56:15 +01:00
|
|
|
(lib.enableFeature stdenv.isLinux "sysfsgpio")
|
2014-03-30 14:45:00 +01:00
|
|
|
"--enable-remote-bitbang"
|
|
|
|
];
|
2009-09-24 22:28:27 +01:00
|
|
|
|
2020-09-03 13:53:46 +01:00
|
|
|
NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
|
2020-02-10 15:25:58 +00:00
|
|
|
"-Wno-error=cpp"
|
2020-11-13 21:44:07 +00:00
|
|
|
"-Wno-error=strict-prototypes" # fixes build failure with hidapi 0.10.0
|
2020-09-03 13:53:46 +01:00
|
|
|
];
|
2018-02-18 23:41:10 +00:00
|
|
|
|
2019-05-01 10:56:15 +01:00
|
|
|
postInstall = lib.optionalString stdenv.isLinux ''
|
2014-03-08 08:30:36 +00:00
|
|
|
mkdir -p "$out/etc/udev/rules.d"
|
2017-02-06 19:09:45 +00:00
|
|
|
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/"
|
2014-03-08 08:30:36 +00:00
|
|
|
'';
|
|
|
|
|
2019-05-01 10:56:15 +01:00
|
|
|
meta = with lib; {
|
2014-06-25 19:36:16 +01:00
|
|
|
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-03 13:53:46 +01:00
|
|
|
homepage = "https://openocd.sourceforge.net/";
|
2014-06-25 19:36:16 +01:00
|
|
|
license = licenses.gpl2Plus;
|
2018-07-22 20:50:19 +01:00
|
|
|
maintainers = with maintainers; [ bjornfor ];
|
2019-05-01 10:56:15 +01:00
|
|
|
platforms = platforms.unix;
|
2009-09-20 17:43:16 +01:00
|
|
|
};
|
|
|
|
}
|