+
+(define-public stlink
+ (package
+ (name "stlink")
+ (version "1.5.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://github.com/texane/stlink/archive/v"
+ version ".tar.gz"))
+ (file-name (string-append name "-" version ".tar.gz"))
+ (sha256
+ (base32
+ "01z1cz1a5xbbhd163qrqcgp4bi1k145pb80jmwdz50g7sfzmy570"))))
+ (build-system cmake-build-system)
+ (arguments
+ `(#:tests? #f ;no tests
+ #:configure-flags
+ (let* ((out (assoc-ref %outputs "out"))
+ (etc (in-vicinity out "etc"))
+ (modprobe (in-vicinity etc "modprobe.d"))
+ (udev-rules (in-vicinity etc "udev/rules.d")))
+ (list (string-append "-DSTLINK_UDEV_RULES_DIR=" udev-rules)
+ (string-append "-DSTLINK_MODPROBED_DIR=" modprobe)))))
+ (inputs
+ `(("libusb" ,libusb)))
+ (synopsis "Programmer for STM32 Discovery boards")
+ (description "This package provides a firmware programmer for the STM32
+Discovery boards. It supports two versions of the chip: ST-LINK/V1 (on
+STM32VL discovery kits) and ST-LINK/V2 (on STM32L discovery and later kits).
+Two different transport layers are used: ST-LINK/V1 uses SCSI passthru
+commands over USB, and ST-LINK/V2 and ST-LINK/V2-1 (seen on Nucleo boards) use
+raw USB commands.")
+ (home-page "https://github.com/texane/stlink")
+ ;; The flashloaders/stm32l0x.s and flashloaders/stm32lx.s source files are
+ ;; licensed under the GPLv2+.
+ (license (list license:bsd-3 license:gpl2+))))