Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / embedded.scm
index 6f09c8f..7678f85 100644 (file)
@@ -1,9 +1,10 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016, 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016, 2017 Theodoros Foradis <theodoros@foradis.org>
 ;;; Copyright © 2016 David Craven <david@craven.ch>
 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -27,6 +28,7 @@
   #:use-module (guix svn-download)
   #:use-module (guix git-download)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
   #:use-module (guix build utils)
@@ -83,6 +85,7 @@
                           (origin-patches (package-source xgcc))))))
       (native-inputs
        `(("flex" ,flex)
+         ("gcc" ,gcc-5)
          ,@(package-native-inputs xgcc)))
       (arguments
        (substitute-keyword-arguments (package-arguments xgcc)
@@ -251,7 +254,8 @@ library variant NEWLIB."
            (match %build-inputs
              (((names . directories) ...)
               (union-build (assoc-ref %outputs "out")
-                           directories))))))
+                           directories)
+              #t)))))
       (propagated-inputs
        `(("binutils" ,(cross-binutils "arm-none-eabi"))
          ("libstdc++" ,(make-libstdc++-arm-none-eabi xgcc newlib-with-xgcc))
@@ -318,12 +322,6 @@ languages are C and C++.")
          ("pkg-config" ,pkg-config)))
       (inputs
        `(("libusb" ,libusb)))
-      (arguments
-       `(#:phases
-         (modify-phases %standard-phases
-           (add-after 'unpack 'autoreconf
-             (lambda _
-               (zero? (system* "autoreconf" "-vfi")))))))
       (home-page "http://repo.or.cz/w/libjaylink.git")
       (synopsis "Library to interface Segger J-Link devices")
       (description "libjaylink is a shared library written in C to access
@@ -351,8 +349,8 @@ SEGGER J-Link and compatible devices.")
          (replace 'configure
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
-               (zero? (system* "./configure"
-                               (string-append "--prefix=" out)))))))))
+               (invoke "./configure"
+                       (string-append "--prefix=" out))))))))
     (home-page "http://jim.tcl.tk")
     (synopsis "Small footprint Tcl implementation")
     (description "Jim is a small footprint implementation of the Tcl programming
@@ -401,9 +399,9 @@ language.")
                       "presto" "openjtag")))
        #:phases
        (modify-phases %standard-phases
+         ;; Required because of patched sources.
          (add-before 'configure 'autoreconf
-           (lambda _
-             (zero? (system* "autoreconf" "-vfi"))))
+           (lambda _ (invoke "autoreconf" "-vfi") #t))
          (add-after 'autoreconf 'change-udev-group
            (lambda _
              (substitute* "contrib/60-openocd.rules"
@@ -414,7 +412,8 @@ language.")
              (install-file "contrib/60-openocd.rules"
                            (string-append
                             (assoc-ref outputs "out")
-                            "/lib/udev/rules.d/")))))))
+                            "/lib/udev/rules.d/"))
+             #t)))))
     (home-page "http://openocd.org")
     (synopsis "On-Chip Debugger")
     (description "OpenOCD provides on-chip programming and debugging support
@@ -577,7 +576,7 @@ with a layered architecture of JTAG interface and TAP support.")
            ;; have to create the target directories at build time.
            (add-before 'build 'create-target-directories
              (lambda* (#:key make-flags #:allow-other-keys)
-               (zero? (apply system* "make" "install-dirs" make-flags))))
+               (apply invoke "make" "install-dirs" make-flags)))
            (add-before 'build 'set-cross-environment-variables
              (lambda* (#:key outputs #:allow-other-keys)
                (setenv "CROSS_LIBRARY_PATH"
@@ -591,7 +590,7 @@ with a layered architecture of JTAG interface and TAP support.")
                #t))
            (add-before 'install 'install-includes
              (lambda* (#:key make-flags #:allow-other-keys)
-               (zero? (apply system* "make" "install-includes" make-flags)))))))
+               (apply invoke "make" "install-includes" make-flags))))))
       (native-inputs
        `(("propeller-gcc" ,propeller-gcc)
          ("propeller-binutils" ,propeller-binutils)
@@ -610,7 +609,7 @@ micro-controller.")
     (version (package-version propeller-gcc))
     (source #f)
     (build-system trivial-build-system)
-    (arguments '(#:builder (mkdir %output)))
+    (arguments '(#:builder (begin (mkdir %output) #t)))
     (propagated-inputs
      `(("binutils" ,propeller-binutils)
        ("libc" ,proplib)
@@ -785,7 +784,7 @@ two-thirds of the opcodes in the P2 instruction set.")
     (version (package-version propeller-gcc))
     (source #f)
     (build-system trivial-build-system)
-    (arguments '(#:builder (mkdir %output)))
+    (arguments '(#:builder (begin (mkdir %output) #t)))
     (propagated-inputs
      `(("toolchain" ,propeller-toolchain)
        ("openspin" ,openspin)
@@ -830,7 +829,7 @@ simulator.")
              (lambda _
                (substitute* "opcodes/Makefile.in"
                  (("guile\\{,-\\}1.8") "guile"))
-               (zero? (system* "which" "guile")))))))
+               (invoke "which" "guile"))))))
       (native-inputs
        `(("cgen"
           ,(origin
@@ -876,30 +875,31 @@ the Raspberry Pi chip.")
       (description "This package provides @code{gcc} for VideoCore IV,
 the Raspberry Pi chip."))))
 
-(define-public python2-libmpsse
+(define-public python-libmpsse
   (package
-    (name "python2-libmpsse")
-    (version "1.3")
+    (name "python-libmpsse")
+    (version "1.4")
     (source
       (origin
-        (method url-fetch)
-        (uri (string-append "https://storage.googleapis.com/"
-                            "google-code-archive-downloads/v2/"
-                            "code.google.com/libmpsse/"
-                            "libmpsse-" version ".tar.gz"))
+        (method git-fetch)
+        (uri (git-reference
+              (url "https://github.com/daym/libmpsse.git")
+              (commit (string-append "v" version))))
+        (file-name "libmpsse-checkout")
         (sha256
           (base32
-            "0jq7nhqq3na8675jnpfcar3pd3dp3adhhc4lw900swkla01a1wh8"))))
+            "14f1kiiia4kfd9mzwx4h63aa8bpz9aknbrrr7mychnsp3arw0z25"))))
     (build-system gnu-build-system)
     (inputs
      `(("libftdi" ,libftdi)
-       ("python" ,python-2)))
+       ("python" ,python)))
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("swig" ,swig)
        ("which" ,base:which)))
     (arguments
      `(#:tests? #f ; No tests exist.
+       #:parallel-build? #f  ; Would be buggy.
        #:make-flags
        (list (string-append "CFLAGS=-Wall -fPIC -fno-strict-aliasing -g -O2 "
                             "$(shell pkg-config --cflags libftdi1)"))
@@ -907,28 +907,20 @@ the Raspberry Pi chip."))))
        (modify-phases %standard-phases
          (add-after 'unpack 'set-environment-up
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (chdir "src")
-             (setenv "PYDEV" (string-append (assoc-ref inputs "python")
-                             "/include/python2.7"))
-             #t))
-         (add-after 'unpack 'patch-global-variable
-           (lambda _
-             ;; fast_rw_buf was defined in a header file which was making
-             ;; the build not reproducible.
-             (substitute* "src/fast.c"
-               (("^int fast_build_block_buffer") "
-
-unsigned char fast_rw_buf[SPI_RW_SIZE + CMD_SIZE];
-int fast_build_block_buffer"))
-             (substitute* "src/mpsse.h"
-               (("unsigned char fast_rw_buf.*") "
-"))
-             #t))
+             (let ((python (assoc-ref inputs "python")))
+               (chdir "src")
+               (setenv "PYDEV" (string-append python
+                               "/include/python"
+                               ,(version-major+minor (package-version python))
+                               "m"))
+               #t)))
          (replace 'install
-           (lambda* (#:key outputs make-flags #:allow-other-keys #:rest args)
+           (lambda* (#:key inputs outputs make-flags #:allow-other-keys #:rest args)
              (let* ((out (assoc-ref outputs "out"))
                     (out-python (string-append out
-                                               "/lib/python2.7/site-packages"))
+                                               "/lib/python"
+                                               ,(version-major+minor (package-version python))
+                                               "/site-packages"))
                     (install (assoc-ref %standard-phases 'install)))
                (install #:make-flags (cons (string-append "PYLIB=" out-python)
                                            make-flags))))))))
@@ -939,6 +931,36 @@ MPSSE (Multi-Protocol Synchronous Serial Engine) adapter by FTDI that can do
 SPI, I2C, JTAG.")
     (license license:gpl2+)))
 
+(define-public python2-libmpsse
+  (package
+    (inherit python-libmpsse)
+    (name "python2-libmpsse")
+    (arguments
+     (substitute-keyword-arguments (package-arguments python-libmpsse)
+      ((#:phases phases)
+       `(modify-phases ,phases
+         (replace 'set-environment-up
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((python (assoc-ref inputs "python")))
+               (chdir "src")
+               (setenv "PYDEV" (string-append python
+                               "/include/python"
+                               ,(version-major+minor (package-version python-2))))
+               #t)))
+         (replace 'install
+           (lambda* (#:key inputs outputs make-flags #:allow-other-keys #:rest args)
+             (let* ((out (assoc-ref outputs "out"))
+                    (out-python (string-append out
+                                               "/lib/python"
+                                               ,(version-major+minor (package-version python-2))
+                                               "/site-packages"))
+                    (install (assoc-ref %standard-phases 'install)))
+               (install #:make-flags (cons (string-append "PYLIB=" out-python)
+                                           make-flags)))))))))
+    (inputs
+     (alist-replace "python" (list python-2)
+                    (package-inputs python-libmpsse)))))
+
 (define-public picprog
   (package
     (name "picprog")
@@ -979,19 +1001,19 @@ SPI, I2C, JTAG.")
 (define-public fc-host-tools
   (package
     (name "fc-host-tools")
-    (version "7")
+    (version "10")
     (source (origin
               (method url-fetch)
               (uri (string-append "ftp://ftp.freecalypso.org/pub/GSM/"
                                   "FreeCalypso/fc-host-tools-r" version ".tar.bz2"))
               (sha256
                (base32
-                "0j0qh5m2irgdf4v9n4yhfdfqz9k8q27k0rx9m0xqc0ckbrih8d9r"))))
+                "0ybjqkz1cpnxni66p3valv1bva39vpwzdcc4040lqzx6py9h7h8b"))))
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f                      ; No tests exist.
        #:make-flags
-       (list (string-append "INSTBIN=" %output "/bin")
+       (list (string-append "INSTALL_PREFIX=" %output)
              (string-append "INCLUDE_INSTALL_DIR=" %output "include/rvinterf"))
        #:phases
        (modify-phases %standard-phases
@@ -1003,13 +1025,20 @@ SPI, I2C, JTAG.")
          (add-after 'handle-tarbomb 'patch-installation-paths
            (lambda* (#:key outputs #:allow-other-keys)
              (substitute* '("Makefile"
-                            "rvinterf/libasync/launchrvif.c"
+                            "rvinterf/etmsync/fsiomain.c"
+                            "rvinterf/etmsync/fsnew.c"
+                            "rvinterf/asyncshell/help.c"
+                            "rvinterf/libinterf/launchrvif.c"
                             "loadtools/defpath.c"
                             "loadtools/Makefile"
                             "miscutil/c139explore"
-                            "miscutil/pirexplore")
+                            "miscutil/pirexplore"
+                            "ffstools/tiffs-wrappers/installpath.c"
+                            "uptools/atcmd/atinterf.c")
                (("/opt/freecalypso/loadtools")
                 (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
+               (("\\$\\{INSTALL_PREFIX\\}/loadtools")
+                (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
                (("/opt/freecalypso")
                 (assoc-ref outputs "out")))
              #t)))))
@@ -1091,6 +1120,47 @@ feeding melodies to be played to it.
 that can be issued through the RVTMUX (debug trace) serial channel.
 This program is our test mode shell for sending Test Mode commands to targets
 and displaying decoded target responses.
+@item fcup-smsend Send a short message via SMS
+@item fcup-smsendmult Send multiple short messages via SMS in one go
+@item fcup-smsendpdu Send multiple short messages given in PDU format via SMS
+@item sms-pdu-decode Decode PDU format messages
 @end enumerate")
     (home-page "https://www.freecalypso.org/")
     (license license:public-domain)))
+
+(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+))))