You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.4 KiB

9 months ago
9 months ago
3 years ago
  1. { stdenv, lib, fetchFromGitHub, autoreconfHook, libftdi, libusb1, pkgconfig, hidapi }:
  2. stdenv.mkDerivation rec {
  3. pname = "openocd-mlabs";
  4. version = "0.10.0";
  5. src = fetchFromGitHub {
  6. owner = "m-labs";
  7. repo = "openocd";
  8. fetchSubmodules = true;
  9. rev = "c383a57adcff332b2c5cf8d55a84626285b42c2c";
  10. sha256 = "0xlj9cs72acx3zqagvr7f1c0v6lnqhl8fgrlhgmhmvk5n9knk492";
  11. };
  12. bscan_spi_bitstreams = fetchFromGitHub {
  13. owner = "quartiq";
  14. repo = "bscan_spi_bitstreams";
  15. rev = "01d8f819f15baf9a8cc5d96945a51e4d267ff564";
  16. sha256 = "1zqv47kzgvbn4c8cr019a6wcja7gn5h1z4kvw5bhpc72fyhagal9";
  17. };
  18. nativeBuildInputs = [ pkgconfig ];
  19. buildInputs = [ autoreconfHook libftdi libusb1 hidapi ];
  20. configureFlags = [
  21. "--enable-jtag_vpi"
  22. "--enable-usb_blaster_libftdi"
  23. "--enable-amtjtagaccel"
  24. "--enable-gw16012"
  25. "--enable-presto_libftdi"
  26. "--enable-openjtag_ftdi"
  27. "--enable-oocd_trace"
  28. "--enable-buspirate"
  29. "--enable-sysfsgpio"
  30. "--enable-remote-bitbang"
  31. "--disable-werror"
  32. ];
  33. NIX_CFLAGS_COMPILE = [
  34. "-Wno-implicit-fallthrough"
  35. "-Wno-format-truncation"
  36. "-Wno-format-overflow"
  37. "-Wno-error=tautological-compare"
  38. ];
  39. postInstall = ''
  40. mkdir -p "$out/etc/udev/rules.d"
  41. rules="$out/share/openocd/contrib/60-openocd.rules"
  42. if [ ! -f "$rules" ]; then
  43. echo "$rules is missing, must update the Nix file."
  44. exit 1
  45. fi
  46. ln -s "$rules" "$out/etc/udev/rules.d/"
  47. mkdir -p "$out/share/bscan-spi-bitstreams"
  48. cp ${bscan_spi_bitstreams}/*.bit "$out/share/bscan-spi-bitstreams"
  49. '';
  50. meta = with lib; {
  51. description = "Free and Open On-Chip Debugging, In-System Programming and Boundary-Scan Testing";
  52. longDescription = ''
  53. OpenOCD provides on-chip programming and debugging support with a layered
  54. architecture of JTAG interface and TAP support, debug target support
  55. (e.g. ARM, MIPS), and flash chip drivers (e.g. CFI, NAND, etc.). Several
  56. network interfaces are available for interactiving with OpenOCD: HTTP,
  57. telnet, TCL, and GDB. The GDB server enables OpenOCD to function as a
  58. "remote target" for source-level debugging of embedded systems using the
  59. GNU GDB program.
  60. '';
  61. homepage = http://openocd.sourceforge.net/;
  62. license = licenses.gpl2Plus;
  63. maintainers = with maintainers; [ sb0 ];
  64. platforms = platforms.linux;
  65. };
  66. }