gnu: Add external-program.
[jackhill/guix/guix.git] / gnu / packages / embedded.scm
index 106675b..67c6fda 100644 (file)
@@ -1,10 +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>
+;;; Copyright © 2018, 2019 Clément Lassieur <clement@lassieur.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -30,6 +30,7 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
   #:use-module (guix build utils)
   #:use-module (gnu packages)
@@ -47,6 +48,7 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages swig)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages xorg)
@@ -85,6 +87,7 @@
                           (origin-patches (package-source xgcc))))))
       (native-inputs
        `(("flex" ,flex)
+         ("gcc" ,gcc-5)
          ,@(package-native-inputs xgcc)))
       (arguments
        (substitute-keyword-arguments (package-arguments xgcc)
@@ -204,6 +207,124 @@ usable on embedded products.")
            "--disable-nls"))))
     (synopsis "Newlib variant for small systems with limited memory")))
 
+\f
+;;; The following definitions are for the "7-2018-q2-update" variant of the
+;;; ARM cross toolchain as offered on https://developer.arm.com
+(define-public gcc-arm-none-eabi-7-2018-q2-update
+  (let ((xgcc (cross-gcc "arm-none-eabi"
+                         #:xgcc gcc-7
+                         #:xbinutils (cross-binutils "arm-none-eabi")))
+        (revision "1")
+        (svn-revision 261907))
+    (package (inherit xgcc)
+      (version (string-append "7-2018-q2-update-"
+                              revision "." (number->string svn-revision)))
+      (source
+       (origin
+         (method svn-fetch)
+         (uri (svn-reference
+               (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-7-branch/")
+               (revision svn-revision)))
+         (file-name (string-append "gcc-arm-embedded-" version "-checkout"))
+         (sha256
+          (base32
+           "192ggs63bixf3irpijgfkjks73yx1r3a4i6grk1y0i0iny76pmx5"))
+         (patches
+          (append
+           (origin-patches (package-source gcc-7))
+           (search-patches "gcc-7-cross-environment-variables.patch")))))
+      (native-inputs
+       `(("gcc" ,gcc-5)
+         ("flex" ,flex)
+         ("isl" ,isl-0.18)
+         ,@(alist-delete "isl" (package-native-inputs xgcc))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments xgcc)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-after 'unpack 'expand-version-string
+               (lambda _
+                 (make-file-writable "gcc/DEV-PHASE")
+                 (with-output-to-file "gcc/DEV-PHASE"
+                   (lambda ()
+                     (display "7-2018-q2-update")))
+                 #t))
+             (add-after 'unpack 'fix-genmultilib
+               (lambda _
+                 (substitute* "gcc/genmultilib"
+                   (("#!/bin/sh") (string-append "#!" (which "sh"))))
+                 #t))))
+         ((#:configure-flags flags)
+          ;; The configure flags are largely identical to the flags used by the
+          ;; "GCC ARM embedded" project.
+          `(append (list "--enable-multilib"
+                         "--with-newlib"
+                         "--with-multilib-list=rmprofile"
+                         "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
+                         "--enable-plugins"
+                         "--disable-decimal-float"
+                         "--disable-libffi"
+                         "--disable-libgomp"
+                         "--disable-libmudflap"
+                         "--disable-libquadmath"
+                         "--disable-libssp"
+                         "--disable-libstdcxx-pch"
+                         "--disable-nls"
+                         "--disable-shared"
+                         "--disable-threads"
+                         "--disable-tls")
+                   (delete "--disable-multilib" ,flags)))))
+      (native-search-paths
+       (list (search-path-specification
+              (variable "CROSS_C_INCLUDE_PATH")
+              (files '("arm-none-eabi/include")))
+             (search-path-specification
+              (variable "CROSS_CPLUS_INCLUDE_PATH")
+              (files '("arm-none-eabi/include")))
+             (search-path-specification
+              (variable "CROSS_LIBRARY_PATH")
+              (files '("arm-none-eabi/lib"))))))))
+
+(define-public newlib-arm-none-eabi-7-2018-q2-update
+  ;; This is the same commit as used for the 7-2018-q2-update release
+  ;; according to the release.txt.
+  (let ((commit "3ccfb407af410ba7e54ea0da11ae1e40b554a6f4")
+        (revision "0"))
+    (package
+      (inherit newlib-arm-none-eabi)
+      (version (git-version "3.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "http://sourceware.org/git/newlib-cygwin.git")
+               (commit commit)))
+         (file-name (git-file-name "newlib" commit))
+         (sha256
+          (base32
+           "1dq23fqrk75g1a4v7569fvnnw5q440zawbxi3w0g05n8jlqsmvcy"))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments newlib-arm-none-eabi)
+         ;; The configure flags are identical to the flags used by the "GCC ARM
+         ;; embedded" project.
+         ((#:configure-flags flags)
+          `(cons* "--enable-newlib-io-c99-formats"
+                  "--enable-newlib-retargetable-locking"
+                  "--with-headers=yes"
+                  ,flags))))
+      (native-inputs
+       `(("xbinutils" ,(cross-binutils "arm-none-eabi"))
+         ("xgcc" ,gcc-arm-none-eabi-7-2018-q2-update)
+         ("texinfo" ,texinfo))))))
+
+(define-public newlib-nano-arm-none-eabi-7-2018-q2-update
+  (package (inherit newlib-arm-none-eabi-7-2018-q2-update)
+    (name "newlib-nano")
+    (arguments
+     (package-arguments newlib-nano-arm-none-eabi))
+    (synopsis "Newlib variant for small systems with limited memory")))
+
+\f
 (define (make-libstdc++-arm-none-eabi xgcc newlib)
   (let ((libstdc++ (make-libstdc++ xgcc)))
     (package (inherit libstdc++)
@@ -284,6 +405,14 @@ languages are C and C++.")
   (arm-none-eabi-toolchain gcc-arm-none-eabi-6
                            newlib-nano-arm-none-eabi))
 
+(define-public arm-none-eabi-toolchain-7-2018-q2-update
+  (arm-none-eabi-toolchain gcc-arm-none-eabi-7-2018-q2-update
+                           newlib-arm-none-eabi-7-2018-q2-update))
+
+(define-public arm-none-eabi-nano-toolchain-7-2018-q2-update
+  (arm-none-eabi-toolchain gcc-arm-none-eabi-7-2018-q2-update
+                           newlib-nano-arm-none-eabi-7-2018-q2-update))
+
 (define-public gdb-arm-none-eabi
   (package
     (inherit gdb)
@@ -1000,14 +1129,14 @@ SPI, I2C, JTAG.")
 (define-public fc-host-tools
   (package
     (name "fc-host-tools")
-    (version "10")
+    (version "11")
     (source (origin
               (method url-fetch)
               (uri (string-append "ftp://ftp.freecalypso.org/pub/GSM/"
                                   "FreeCalypso/fc-host-tools-r" version ".tar.bz2"))
               (sha256
                (base32
-                "0ybjqkz1cpnxni66p3valv1bva39vpwzdcc4040lqzx6py9h7h8b"))))
+                "0s87lp6gd8i8ivrdd7mnnalysr65035nambcm992rgla7sk76sj1"))))
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f                      ; No tests exist.
@@ -1016,12 +1145,7 @@ SPI, I2C, JTAG.")
              (string-append "INCLUDE_INSTALL_DIR=" %output "include/rvinterf"))
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
-         (add-after 'unpack 'handle-tarbomb
-           (lambda _
-             (chdir "..") ; url-fetch/tarbomb doesn't work for some reason.
-             #t))
-         (add-after 'handle-tarbomb 'patch-installation-paths
+         (add-after 'unpack 'patch-installation-paths
            (lambda* (#:key outputs #:allow-other-keys)
              (substitute* '("Makefile"
                             "rvinterf/etmsync/fsiomain.c"
@@ -1038,13 +1162,16 @@ SPI, I2C, JTAG.")
                 (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
                (("\\$\\{INSTALL_PREFIX\\}/loadtools")
                 (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
+               (("\\$\\{INSTALL_PREFIX\\}/target-bin")
+                (string-append (assoc-ref outputs "out") "/lib/freecalypso/target-bin"))
                (("/opt/freecalypso")
                 (assoc-ref outputs "out")))
-             #t)))))
+             #t))
+         (delete 'configure))))
     (inputs
      `(("libx11" ,libx11)))
     (synopsis "Freecalypso host tools")
-    (description "This package provides some tools for debugging Freecalypso phones.
+    (description "This package provides some tools for debugging FreeCalypso phones and the FreeCalypso FCDEV3B dev board.
 
 @enumerate
 @item fc-e1decode: Decodes a binary Melody E1 file into an ASCII source file.
@@ -1119,10 +1246,10 @@ 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
+@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)))
@@ -1163,3 +1290,31 @@ raw USB commands.")
     ;; The flashloaders/stm32l0x.s and flashloaders/stm32lx.s source files are
     ;; licensed under the GPLv2+.
     (license (list license:bsd-3 license:gpl2+))))
+
+(define-public west
+  (package
+    (name "west")
+    (version "0.6.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "west" version))
+       (sha256
+        (base32
+         "0ql6ij1hrj2ir5wkxm96zgig5qwvfwa75w77wh2y13w6b9cqcr4b"))))
+    (propagated-inputs
+     `(("python-colorama" ,python-colorama)
+       ("python-configobj" ,python-configobj)
+       ("python-pykwalify" ,python-pykwalify)
+       ("python-pyyaml" ,python-pyyaml)))
+    (build-system python-build-system)
+    (home-page "https://github.com/zephyrproject-rtos/west")
+    (synopsis "Zephyr RTOS Project meta-tool")
+    (description "West is the swiss-army knife command line tool of the Zephyr
+project.  Its built-in commands provide a multiple repository management
+system with features inspired by Google’s Repo tool and Git submodules.  West
+simplifies configuration and is also pluggable: you can write your own west
+\"extension commands\" which add additional features to west.  Zephyr uses
+this feature to provide conveniences for building applications, flashing and
+debugging them, and more.")
+    (license license:expat)))