1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2016, 2017 Theodoros Foradis <theodoros@foradis.org>
4 ;;; Copyright © 2016 David Craven <david@craven.ch>
5 ;;; Copyright © 2017, 2020 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2018, 2019 Clément Lassieur <clement@lassieur.org>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages embedded)
25 #:use-module (guix utils)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix svn-download)
29 #:use-module (guix git-download)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix build-system cmake)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system python)
34 #:use-module (guix build-system trivial)
35 #:use-module ((guix build utils) #:select (alist-replace))
36 #:use-module (gnu packages)
37 #:use-module (gnu packages autotools)
38 #:use-module ((gnu packages base) #:prefix base:)
39 #:use-module (gnu packages bison)
40 #:use-module (gnu packages cross-base)
41 #:use-module (gnu packages dejagnu)
42 #:use-module (gnu packages flex)
43 #:use-module (gnu packages gcc)
44 #:use-module (gnu packages gdb)
45 #:use-module (gnu packages guile)
46 #:use-module (gnu packages libftdi)
47 #:use-module (gnu packages libusb)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages python-xyz)
52 #:use-module (gnu packages swig)
53 #:use-module (gnu packages texinfo)
54 #:use-module (gnu packages xorg)
55 #:use-module (srfi srfi-1))
57 ;; We must not use the released GCC sources here, because the cross-compiler
58 ;; does not produce working binaries. Instead we take the very same SVN
59 ;; revision from the branch that is used for a release of the "GCC ARM
60 ;; embedded" project on launchpad.
61 ;; See https://launchpadlibrarian.net/218827644/release.txt
62 (define-public gcc-arm-none-eabi-4.9
63 (let ((xgcc (cross-gcc "arm-none-eabi"
65 #:xbinutils (cross-binutils "arm-none-eabi")))
67 (svn-revision 227977))
68 (package (inherit xgcc)
69 (version (string-append (package-version xgcc) "-"
70 revision "." (number->string svn-revision)))
75 (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-4_9-branch/")
76 (revision svn-revision)))
77 (file-name (string-append "gcc-arm-embedded-" version "-checkout"))
80 "113r98kygy8rrjfv2pd3z6zlfzbj543pq7xyq8bgh72c608mmsbr"))
82 ;; Remove the one patch that doesn't apply to this 4.9 snapshot (the
83 ;; patch is for 4.9.4 and later but this svn snapshot is older).
84 (patches (remove (lambda (patch)
85 (string=? (basename patch)
86 "gcc-arm-bug-71399.patch"))
87 (origin-patches (package-source xgcc))))))
91 ,@(package-native-inputs xgcc)))
93 (substitute-keyword-arguments (package-arguments xgcc)
95 `(modify-phases ,phases
96 (add-after 'unpack 'fix-genmultilib
98 (substitute* "gcc/genmultilib"
99 (("#!/bin/sh") (string-append "#!" (which "sh"))))
101 ((#:configure-flags flags)
102 ;; The configure flags are largely identical to the flags used by the
103 ;; "GCC ARM embedded" project.
104 `(append (list "--enable-multilib"
106 "--with-multilib-list=armv6-m,armv7-m,armv7e-m"
107 "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
109 "--disable-decimal-float"
112 "--disable-libmudflap"
113 "--disable-libquadmath"
115 "--disable-libstdcxx-pch"
120 (delete "--disable-multilib" ,flags)))))
122 (list (search-path-specification
123 (variable "CROSS_C_INCLUDE_PATH")
124 (files '("arm-none-eabi/include")))
125 (search-path-specification
126 (variable "CROSS_CPLUS_INCLUDE_PATH")
127 (files '("arm-none-eabi/include")))
128 (search-path-specification
129 (variable "CROSS_LIBRARY_PATH")
130 (files '("arm-none-eabi/lib"))))))))
132 (define-public gcc-arm-none-eabi-6
134 (inherit gcc-arm-none-eabi-4.9)
135 (version (package-version gcc-6))
136 (source (origin (inherit (package-source gcc-6))
139 (origin-patches (package-source gcc-6))
140 (search-patches "gcc-6-cross-environment-variables.patch"
141 "gcc-6-arm-none-eabi-multilib.patch")))))))
143 (define-public newlib-arm-none-eabi
149 (uri (string-append "ftp://sourceware.org/pub/newlib/newlib-"
153 "01i7qllwicf05vsvh39qj7qp5fdifpvvky0x95hjq39mbqiksnsl"))))
154 (build-system gnu-build-system)
156 `(#:out-of-source? #t
157 ;; The configure flags are identical to the flags used by the "GCC ARM
158 ;; embedded" project.
159 #:configure-flags '("--target=arm-none-eabi"
160 "--enable-newlib-io-long-long"
161 "--enable-newlib-register-fini"
162 "--disable-newlib-supplied-syscalls"
165 (modify-phases %standard-phases
166 (add-after 'unpack 'fix-references-to-/bin/sh
168 (substitute* '("libgloss/arm/cpu-init/Makefile.in"
169 "libgloss/arm/Makefile.in"
170 "libgloss/libnosys/Makefile.in"
171 "libgloss/Makefile.in")
172 (("/bin/sh") (which "sh")))
175 `(("xbinutils" ,(cross-binutils "arm-none-eabi"))
176 ("xgcc" ,gcc-arm-none-eabi-4.9)
177 ("texinfo" ,texinfo)))
178 (home-page "https://www.sourceware.org/newlib/")
179 (synopsis "C library for use on embedded systems")
180 (description "Newlib is a C library intended for use on embedded
181 systems. It is a conglomeration of several library parts that are easily
182 usable on embedded products.")
183 (license (license:non-copyleft
184 "https://www.sourceware.org/newlib/COPYING.NEWLIB"))))
186 (define-public newlib-nano-arm-none-eabi
187 (package (inherit newlib-arm-none-eabi)
190 (substitute-keyword-arguments (package-arguments newlib-arm-none-eabi)
191 ;; The configure flags are identical to the flags used by the "GCC ARM
192 ;; embedded" project. They optimize newlib for use on small embedded
193 ;; systems with limited memory.
194 ((#:configure-flags flags)
195 ''("--target=arm-none-eabi"
197 "--disable-newlib-supplied-syscalls"
198 "--enable-newlib-reent-small"
199 "--disable-newlib-fvwrite-in-streamio"
200 "--disable-newlib-fseek-optimization"
201 "--disable-newlib-wide-orient"
202 "--enable-newlib-nano-malloc"
203 "--disable-newlib-unbuf-stream-opt"
205 "--enable-newlib-global-atexit"
206 "--enable-newlib-nano-formatted-io"
208 (synopsis "Newlib variant for small systems with limited memory")))
211 ;;; The following definitions are for the "7-2018-q2-update" variant of the
212 ;;; ARM cross toolchain as offered on https://developer.arm.com
213 (define-public gcc-arm-none-eabi-7-2018-q2-update
214 (let ((xgcc (cross-gcc "arm-none-eabi"
216 #:xbinutils (cross-binutils "arm-none-eabi")))
218 (svn-revision 261907))
219 (package (inherit xgcc)
220 (version (string-append "7-2018-q2-update-"
221 revision "." (number->string svn-revision)))
226 (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-7-branch/")
227 (revision svn-revision)))
228 (file-name (string-append "gcc-arm-embedded-" version "-checkout"))
231 "192ggs63bixf3irpijgfkjks73yx1r3a4i6grk1y0i0iny76pmx5"))
234 (origin-patches (package-source gcc-7))
235 (search-patches "gcc-7-cross-environment-variables.patch")))))
240 ,@(alist-delete "isl" (package-native-inputs xgcc))))
242 (substitute-keyword-arguments (package-arguments xgcc)
244 `(modify-phases ,phases
245 (add-after 'unpack 'expand-version-string
247 (make-file-writable "gcc/DEV-PHASE")
248 (with-output-to-file "gcc/DEV-PHASE"
250 (display "7-2018-q2-update")))
252 (add-after 'unpack 'fix-genmultilib
254 (substitute* "gcc/genmultilib"
255 (("#!/bin/sh") (string-append "#!" (which "sh"))))
257 ((#:configure-flags flags)
258 ;; The configure flags are largely identical to the flags used by the
259 ;; "GCC ARM embedded" project.
260 `(append (list "--enable-multilib"
262 "--with-multilib-list=rmprofile"
263 "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
265 "--disable-decimal-float"
268 "--disable-libmudflap"
269 "--disable-libquadmath"
271 "--disable-libstdcxx-pch"
276 (delete "--disable-multilib" ,flags)))))
278 (list (search-path-specification
279 (variable "CROSS_C_INCLUDE_PATH")
280 (files '("arm-none-eabi/include")))
281 (search-path-specification
282 (variable "CROSS_CPLUS_INCLUDE_PATH")
283 (files '("arm-none-eabi/include")))
284 (search-path-specification
285 (variable "CROSS_LIBRARY_PATH")
286 (files '("arm-none-eabi/lib"))))))))
288 (define-public newlib-arm-none-eabi-7-2018-q2-update
289 ;; This is the same commit as used for the 7-2018-q2-update release
290 ;; according to the release.txt.
291 (let ((commit "3ccfb407af410ba7e54ea0da11ae1e40b554a6f4")
294 (inherit newlib-arm-none-eabi)
295 (version (git-version "3.0.0" revision commit))
300 (url "http://sourceware.org/git/newlib-cygwin.git")
302 (file-name (git-file-name "newlib" commit))
305 "1dq23fqrk75g1a4v7569fvnnw5q440zawbxi3w0g05n8jlqsmvcy"))))
307 (substitute-keyword-arguments (package-arguments newlib-arm-none-eabi)
308 ;; The configure flags are identical to the flags used by the "GCC ARM
309 ;; embedded" project.
310 ((#:configure-flags flags)
311 `(cons* "--enable-newlib-io-c99-formats"
312 "--enable-newlib-retargetable-locking"
316 `(("xbinutils" ,(cross-binutils "arm-none-eabi"))
317 ("xgcc" ,gcc-arm-none-eabi-7-2018-q2-update)
318 ("texinfo" ,texinfo))))))
320 (define-public newlib-nano-arm-none-eabi-7-2018-q2-update
321 (package (inherit newlib-arm-none-eabi-7-2018-q2-update)
324 (package-arguments newlib-nano-arm-none-eabi))
325 (synopsis "Newlib variant for small systems with limited memory")))
328 (define (make-libstdc++-arm-none-eabi xgcc newlib)
329 (let ((libstdc++ (make-libstdc++ xgcc)))
330 (package (inherit libstdc++)
331 (name "libstdc++-arm-none-eabi")
333 (substitute-keyword-arguments (package-arguments libstdc++)
334 ((#:configure-flags flags)
335 ``("--target=arm-none-eabi"
336 "--host=arm-none-eabi"
337 "--disable-libstdcxx-pch"
339 "--with-multilib-list=armv6-m,armv7-m,armv7e-m"
344 ,(string-append "--with-gxx-include-dir="
345 (assoc-ref %outputs "out")
346 "/arm-none-eabi/include")))))
350 ,@(package-native-inputs libstdc++))))))
352 (define (arm-none-eabi-toolchain xgcc newlib)
353 "Produce a cross-compiler toolchain package with the compiler XGCC and the C
354 library variant NEWLIB."
355 (let ((newlib-with-xgcc (package (inherit newlib)
357 (alist-replace "xgcc" (list xgcc)
358 (package-native-inputs newlib))))))
360 (name (string-append "arm-none-eabi"
361 (if (string=? (package-name newlib-with-xgcc)
365 (version (package-version xgcc))
367 (build-system trivial-build-system)
369 '(#:modules ((guix build union))
372 (use-modules (ice-9 match)
375 (((names . directories) ...)
376 (union-build (assoc-ref %outputs "out")
380 `(("binutils" ,(cross-binutils "arm-none-eabi"))
381 ("libstdc++" ,(make-libstdc++-arm-none-eabi xgcc newlib-with-xgcc))
383 ("newlib" ,newlib-with-xgcc)))
384 (synopsis "Complete GCC tool chain for ARM bare metal development")
385 (description "This package provides a complete GCC tool chain for ARM
386 bare metal development. This includes the GCC arm-none-eabi cross compiler
387 and newlib (or newlib-nano) as the C library. The supported programming
388 languages are C and C++.")
389 (home-page (package-home-page xgcc))
390 (license (package-license xgcc)))))
392 (define-public arm-none-eabi-toolchain-4.9
393 (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9
394 newlib-arm-none-eabi))
396 (define-public arm-none-eabi-nano-toolchain-4.9
397 (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9
398 newlib-nano-arm-none-eabi))
400 (define-public arm-none-eabi-toolchain-6
401 (arm-none-eabi-toolchain gcc-arm-none-eabi-6
402 newlib-arm-none-eabi))
404 (define-public arm-none-eabi-nano-toolchain-6
405 (arm-none-eabi-toolchain gcc-arm-none-eabi-6
406 newlib-nano-arm-none-eabi))
408 (define-public arm-none-eabi-toolchain-7-2018-q2-update
409 (arm-none-eabi-toolchain gcc-arm-none-eabi-7-2018-q2-update
410 newlib-arm-none-eabi-7-2018-q2-update))
412 (define-public arm-none-eabi-nano-toolchain-7-2018-q2-update
413 (arm-none-eabi-toolchain gcc-arm-none-eabi-7-2018-q2-update
414 newlib-nano-arm-none-eabi-7-2018-q2-update))
416 (define-public gdb-arm-none-eabi
419 (name "gdb-arm-none-eabi")
421 `(#:configure-flags '("--target=arm-none-eabi"
424 "--enable-languages=c,c++"
426 ,@(package-arguments gdb)))))
428 (define-public libjaylink
429 ;; No release tarballs available.
430 (let ((commit "699b7001d34a79c8e7064503dde1bede786fd7f0")
434 (version (string-append "0.1.0-" revision "."
435 (string-take commit 7)))
439 (url "https://git.zapb.de/libjaylink.git")
441 (file-name (string-append name "-" version "-checkout"))
444 "034872d44myycnzn67v5b8ixrgmg8sk32aqalvm5x7108w2byww1"))))
445 (build-system gnu-build-system)
447 `(("autoconf" ,autoconf)
448 ("automake" ,automake)
450 ("pkg-config" ,pkg-config)))
452 `(("libusb" ,libusb)))
453 (home-page "https://repo.or.cz/w/libjaylink.git")
454 (synopsis "Library to interface Segger J-Link devices")
455 (description "libjaylink is a shared library written in C to access
456 SEGGER J-Link and compatible devices.")
457 (license license:gpl2+))))
459 (define-public jimtcl
466 (url "https://github.com/msteveb/jimtcl")
468 (file-name (git-file-name name version))
471 "1k88hz0v3bi19xdvlp0i9nsx38imzwpjh632w7326zwbv2wldf0h"))))
472 (build-system gnu-build-system)
475 (modify-phases %standard-phases
476 ;; Doesn't use autoconf.
478 (lambda* (#:key outputs #:allow-other-keys)
479 (let ((out (assoc-ref outputs "out")))
480 (invoke "./configure"
481 (string-append "--prefix=" out))))))))
482 (home-page "http://jim.tcl.tk/index.html")
483 (synopsis "Small footprint Tcl implementation")
484 (description "Jim is a small footprint implementation of the Tcl programming
486 (license license:bsd-2)))
488 (define-public openocd
494 (uri (string-append "mirror://sourceforge/openocd/openocd/"
495 version "/openocd-" version ".tar.gz"))
498 "09p57y3c2spqx4vjjlz1ljm1lcd0j9q8g76ywxqgn3yc34wv18zd"))
499 ;; FIXME: Remove after nrf52 patch is merged.
501 (search-patches "openocd-nrf52.patch"))))
502 (build-system gnu-build-system)
504 `(("autoconf" ,autoconf)
505 ("automake" ,automake)
507 ("pkg-config" ,pkg-config)))
512 ("libjaylink" ,libjaylink)
513 ("libusb-compat" ,libusb-compat)))
516 (append (list "--disable-werror"
518 "--disable-internal-jimtcl"
519 "--disable-internal-libjaylink")
520 (map (lambda (programmer)
521 (string-append "--enable-" programmer))
522 '("amtjtagaccel" "armjtagew" "buspirate" "ftdi"
523 "gw16012" "jlink" "opendous" "osbdm"
524 "parport" "aice" "cmsis-dap" "dummy" "jtag_vpi"
525 "remote-bitbang" "rlink" "stlink" "ti-icdi" "ulink"
526 "usbprog" "vsllink" "usb-blaster-2" "usb_blaster"
527 "presto" "openjtag")))
529 (modify-phases %standard-phases
530 ;; Required because of patched sources.
531 (add-before 'configure 'autoreconf
532 (lambda _ (invoke "autoreconf" "-vfi") #t))
533 (add-after 'autoreconf 'change-udev-group
535 (substitute* "contrib/60-openocd.rules"
536 (("plugdev") "dialout"))
538 (add-after 'install 'install-udev-rules
539 (lambda* (#:key outputs #:allow-other-keys)
540 (install-file "contrib/60-openocd.rules"
542 (assoc-ref outputs "out")
543 "/lib/udev/rules.d/"))
545 (home-page "http://openocd.org")
546 (synopsis "On-Chip Debugger")
547 (description "OpenOCD provides on-chip programming and debugging support
548 with a layered architecture of JTAG interface and TAP support.")
549 (license license:gpl2+)))
551 ;; The commits for all propeller tools are the stable versions published at
552 ;; https://github.com/propellerinc/propgcc in the release_1_0. According to
553 ;; personal correspondence with the developers in July 2017, more recent
554 ;; versions are currently incompatible with the "Simple Libraries".
556 (define propeller-binutils
557 (let ((xbinutils (cross-binutils "propeller-elf"))
558 (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
562 (name "propeller-binutils")
563 (version (string-append "0.0.0-" revision "." (string-take commit 9)))
564 (source (origin (inherit (package-source xbinutils))
567 (url "https://github.com/parallaxinc/propgcc.git")
569 (file-name (string-append name "-" commit "-checkout"))
572 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
573 (patch-flags (list "-p1" "--directory=binutils"))))
575 `(;; FIXME: For some reason there are many test failures. It's not
576 ;; obvious how to fix the failures.
579 (modify-phases %standard-phases
580 (add-after 'unpack 'chdir
581 (lambda _ (chdir "binutils") #t)))
582 ,@(substitute-keyword-arguments (package-arguments xbinutils)
583 ((#:configure-flags flags)
584 `(cons "--disable-werror" ,flags)))))
590 ,@(package-native-inputs xbinutils))))))
592 (define-public propeller-gcc-6
593 (let ((xgcc (cross-gcc "propeller-elf"
594 #:xbinutils propeller-binutils))
595 (commit "b4f45a4725e0b6d0af59e594c4e3e35ca4105867")
597 (package (inherit xgcc)
598 (name "propeller-gcc")
599 (version (string-append "6.0.0-" revision "." (string-take commit 9)))
603 (url "https://github.com/totalspectrum/gcc-propeller.git")
605 (file-name (string-append name "-" commit "-checkout"))
608 "0d9kdxm2fzanjqa7q5850kzbsfl0fqyaahxn74h6nkxxacwa11zb"))
611 (origin-patches (package-source gcc-6))
612 (search-patches "gcc-cross-environment-variables.patch")))))
615 ,@(package-native-inputs xgcc)))
616 ;; All headers and cross libraries of the propeller toolchain are
617 ;; installed under the "propeller-elf" prefix.
619 (list (search-path-specification
620 (variable "CROSS_C_INCLUDE_PATH")
621 (files '("propeller-elf/include")))
622 (search-path-specification
623 (variable "CROSS_LIBRARY_PATH")
624 (files '("propeller-elf/lib")))))
625 (home-page "https://github.com/totalspectrum/gcc-propeller")
626 (synopsis "GCC for the Parallax Propeller"))))
628 (define-public propeller-gcc-4
629 (let ((xgcc propeller-gcc-6)
630 (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
632 (package (inherit xgcc)
633 (name "propeller-gcc")
634 (version (string-append "4.6.1-" revision "." (string-take commit 9)))
638 (url "https://github.com/parallaxinc/propgcc.git")
640 (file-name (string-append name "-" commit "-checkout"))
643 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
644 (patch-flags (list "-p1" "--directory=gcc"))
647 (origin-patches (package-source gcc-4.7))
648 (search-patches "gcc-4.6-gnu-inline.patch"
649 "gcc-cross-environment-variables.patch")))))
651 (substitute-keyword-arguments (package-arguments propeller-gcc-6)
653 `(modify-phases ,phases
654 (add-after 'unpack 'chdir
655 (lambda _ (chdir "gcc") #t))))))
658 ,@(package-native-inputs propeller-gcc-6)))
659 (home-page "https://github.com/parallaxinc/propgcc")
660 (supported-systems (delete "aarch64-linux" %supported-systems)))))
662 ;; Version 6 is experimental and may not work correctly. This is why we
663 ;; default to version 4, which is also used in the binary toolchain bundle
664 ;; provided by Parallax Inc.
665 (define-public propeller-gcc propeller-gcc-4)
668 ;; FIXME: We do not build the tiny library because that would require C++
669 ;; headers, which are not available. This may require adding a propeller-elf
670 ;; variant of the libstdc++ package.
671 (define-public proplib
672 (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
676 (version (string-append "0.0.0-" revision "." (string-take commit 9)))
680 (url "https://github.com/parallaxinc/propgcc.git")
682 (file-name (string-append name "-" commit "-checkout"))
685 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
686 (build-system gnu-build-system)
688 `(#:tests? #f ; no tests
690 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
691 (string-append "BUILD=" (getcwd) "/build"))
693 (modify-phases %standard-phases
695 (add-after 'unpack 'chdir
696 (lambda _ (chdir "lib") #t))
697 (add-after 'chdir 'fix-Makefile
699 (substitute* "Makefile"
700 ;; Control the installation time of the headers.
701 ((" install-includes") ""))
703 ;; The Makefile does not separate building from installation, so we
704 ;; have to create the target directories at build time.
705 (add-before 'build 'create-target-directories
706 (lambda* (#:key make-flags #:allow-other-keys)
707 (apply invoke "make" "install-dirs" make-flags)))
708 (add-before 'build 'set-cross-environment-variables
709 (lambda* (#:key outputs #:allow-other-keys)
710 (setenv "CROSS_LIBRARY_PATH"
711 (string-append (assoc-ref outputs "out")
712 "/propeller-elf/lib:"
713 (or (getenv "CROSS_LIBRARY_PATH") "")))
714 (setenv "CROSS_C_INCLUDE_PATH"
715 (string-append (assoc-ref outputs "out")
716 "/propeller-elf/include:"
717 (or (getenv "CROSS_C_INCLUDE_PATH") "")))
719 (add-before 'install 'install-includes
720 (lambda* (#:key make-flags #:allow-other-keys)
721 (apply invoke "make" "install-includes" make-flags))))))
723 `(("propeller-gcc" ,propeller-gcc)
724 ("propeller-binutils" ,propeller-binutils)
726 (home-page "https://github.com/parallaxinc/propgcc")
727 (synopsis "C library for the Parallax Propeller")
728 (description "This is a C library for the Parallax Propeller
730 ;; Most of the code is released under the Expat license. Some of the
731 ;; included code is public domain and some changes are BSD licensed.
732 (license license:expat))))
734 (define-public propeller-toolchain
736 (name "propeller-toolchain")
737 (version (package-version propeller-gcc))
739 (build-system trivial-build-system)
740 (arguments '(#:builder (begin (mkdir %output) #t)))
742 `(("binutils" ,propeller-binutils)
744 ("gcc" ,propeller-gcc)))
745 (synopsis "Complete GCC tool chain for Propeller micro-controllers")
746 (description "This package provides a complete GCC tool chain for
747 Propeller micro-controller development.")
748 (home-page (package-home-page propeller-gcc))
749 (license (package-license propeller-gcc))))
751 (define-public openspin
758 (url "https://github.com/parallaxinc/OpenSpin")
760 (file-name (git-file-name name version))
763 "0ghk8hj4717ydhqzx2pfs6737s1cxng6sgg2xgbkwvcfclxdbrd0"))))
764 (build-system gnu-build-system)
766 `(#:tests? #f ; no tests
768 (modify-phases %standard-phases
770 (add-after 'unpack 'remove-timestamp
772 (substitute* "SpinSource/openspin.cpp"
773 ((" Compiled on.*$") "\\n\");"))
775 ;; Makefile does not include "install" target
777 (lambda* (#:key outputs #:allow-other-keys)
778 (let ((bin (string-append (assoc-ref outputs "out")
781 (install-file "build/openspin" bin)
783 (home-page "https://github.com/parallaxinc/OpenSpin")
784 (synopsis "Spin/PASM compiler for the Parallax Propeller")
785 (description "OpenSpin is a compiler for the Spin/PASM language of the
786 Parallax Propeller. It was ported from Chip Gracey's original x86 assembler
788 (license license:expat)))
790 (define-public propeller-load
791 (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
794 (name "propeller-load")
799 (url "https://github.com/parallaxinc/propgcc.git")
801 (file-name (string-append name "-" commit "-checkout"))
804 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
805 (build-system gnu-build-system)
807 `(#:tests? #f ; no tests
810 (string-append "TARGET=" (assoc-ref %outputs "out")))
812 (modify-phases %standard-phases
813 (add-after 'unpack 'chdir
814 (lambda _ (chdir "loader") #t))
815 (delete 'configure))))
817 `(("openspin" ,openspin)
818 ("propeller-toolchain" ,propeller-toolchain)))
819 (home-page "https://github.com/parallaxinc/propgcc")
820 (synopsis "Loader for Parallax Propeller micro-controllers")
821 (description "This package provides the tool @code{propeller-load} to
822 upload binaries to a Parallax Propeller micro-controller.")
823 (license license:expat))))
825 (define-public spin2cpp
832 (url "https://github.com/totalspectrum/spin2cpp")
833 (commit (string-append "v" version))))
834 (file-name (git-file-name name version))
837 "0wznqvsckzzz4hdy2rpvj6jqpxw4yn7i0c7zxfm6i46k8gg9327b"))))
838 (build-system gnu-build-system)
840 `(#:tests? #f ;; The tests assume that a micro-controller is connected.
842 (modify-phases %standard-phases
844 (add-before 'build 'set-cross-environment-variables
845 (lambda* (#:key inputs #:allow-other-keys)
846 (setenv "CROSS_LIBRARY_PATH"
847 (string-append (assoc-ref inputs "propeller-toolchain")
848 "/propeller-elf/lib"))
849 (setenv "CROSS_C_INCLUDE_PATH"
850 (string-append (assoc-ref inputs "propeller-toolchain")
851 "/propeller-elf/include"))
854 (lambda* (#:key outputs #:allow-other-keys)
855 (let ((bin (string-append (assoc-ref outputs "out")
857 (for-each (lambda (file)
858 (install-file (string-append "build/" file)
860 '("testlex" "spin2cpp" "fastspin")))
864 ("propeller-load" ,propeller-load)
865 ("propeller-toolchain" ,propeller-toolchain)))
866 (home-page "https://github.com/totalspectrum/spin2cpp")
867 (synopsis "Convert Spin code to C, C++, or PASM code")
868 (description "This is a set of tools for converting the Spin language for
869 the Parallax Propeller micro-controller into C or C++ code, into PASM, or even
870 directly into an executable binary. The binaries produced use LMM PASM, so
871 they are much faster than regular Spin bytecodes (but also quite a bit
873 (license license:expat)))
875 (define-public spinsim
876 (let ((commit "66915a7ad1a3a2cf990a725bb341fab8d11eb620")
880 (version (string-append "0.75-" revision "." (string-take commit 9)))
884 (url "https://github.com/parallaxinc/spinsim.git")
886 (file-name (string-append name "-" commit "-checkout"))
889 "1n9kdhlxsdx7bz6c80w8dhi96zp633gd6qs0x9i4ii8qv4i7sj5k"))))
890 (build-system gnu-build-system)
892 `(#:tests? #f ; no tests
894 (modify-phases %standard-phases
897 (lambda* (#:key outputs #:allow-other-keys)
898 (let ((bin (string-append (assoc-ref outputs "out")
900 (install-file "build/spinsim" bin))
902 (home-page "https://github.com/parallaxinc/spinsim")
903 (synopsis "Spin simulator")
904 (description "This package provides the tool @code{spinsim}, a simulator
905 and simple debugger for Spin programs written for a Parallax Propeller
906 micro-controller. Spinsim supports execution from cog memory and hub
907 execution, but it does not support multi-tasking. It supports about
908 two-thirds of the opcodes in the P2 instruction set.")
909 (license license:expat))))
911 (define-public propeller-development-suite
913 (name "propeller-development-suite")
914 (version (package-version propeller-gcc))
916 (build-system trivial-build-system)
917 (arguments '(#:builder (begin (mkdir %output) #t)))
919 `(("toolchain" ,propeller-toolchain)
920 ("openspin" ,openspin)
921 ("propeller-load" ,propeller-load)
922 ("spin2cpp" ,spin2cpp)
923 ("spinsim" ,spinsim)))
924 (synopsis "Complete development suite for Propeller micro-controllers")
925 (description "This meta-package provides a complete environment for the
926 development with Parallax Propeller micro-controllers. It includes the GCC
927 toolchain, the loader, the Openspin compiler, the Spin2cpp tool, and the Spin
929 (home-page (package-home-page propeller-gcc))
930 (license (package-license propeller-gcc))))
932 (define-public binutils-vc4
933 (let ((commit "708acc851880dbeda1dd18aca4fd0a95b2573b36"))
935 (name "binutils-vc4")
936 (version (string-append "2.23.51-0." (string-take commit 7)))
940 (url "https://github.com/puppeh/binutils-vc4.git")
942 (file-name (string-append name "-" version "-checkout"))
945 "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63"))))
946 (build-system gnu-build-system)
948 `(#:configure-flags '("--target=vc4-elf"
950 "--enable-cgen-maint")
952 (modify-phases %standard-phases
953 (add-after 'unpack 'unpack-cgen
954 (lambda* (#:key inputs #:allow-other-keys)
955 (copy-recursively (string-append (assoc-ref inputs "cgen")
958 (add-after 'unpack-cgen 'fix-cgen-guile
960 (substitute* "opcodes/Makefile.in"
961 (("guile\\{,-\\}1.8") "guile"))
962 (invoke "which" "guile"))))))
968 (url "https://github.com/puppeh/cgen.git")
969 (commit "d8e2a9eb70425f180fdd5bfd032884b0855f2032")))
972 "14b3h2ji740s8zq5vwm4qdcxs4aa4wxi6wb9di3bv1h39x14nyr9"))))
976 ("guile-1.8" ,guile-1.8)
977 ("which" ,base:which)))
978 (synopsis "Binutils for VC4")
979 (description "This package provides @code{binutils} for VideoCore IV,
980 the Raspberry Pi chip.")
981 (license license:gpl3+)
982 (home-page "https://github.com/puppeh/vc4-toolchain/"))))
984 (define-public gcc-vc4
985 (let ((commit "165f6d0e11d2e76ee799533bb45bd5c92bf60dc2")
986 (xgcc (cross-gcc "vc4-elf" #:xbinutils binutils-vc4)))
987 (package (inherit xgcc)
992 (url "https://github.com/puppeh/gcc-vc4.git")
994 (file-name (string-append name
996 (package-version xgcc)
1000 "13h30qjcwnlz6lfma1d82nnvfmjnhh7abkagip4vly6vm5fpnvf2"))))
1003 ,@(package-native-inputs xgcc)))
1004 (synopsis "GCC for VC4")
1005 (description "This package provides @code{gcc} for VideoCore IV,
1006 the Raspberry Pi chip."))))
1008 (define-public python-libmpsse
1010 (name "python-libmpsse")
1016 (url "https://github.com/daym/libmpsse.git")
1017 (commit (string-append "v" version))))
1018 (file-name "libmpsse-checkout")
1021 "14f1kiiia4kfd9mzwx4h63aa8bpz9aknbrrr7mychnsp3arw0z25"))))
1022 (build-system gnu-build-system)
1024 `(("libftdi" ,libftdi)
1025 ("python" ,python)))
1027 `(("pkg-config" ,pkg-config)
1029 ("which" ,base:which)))
1031 `(#:tests? #f ; No tests exist.
1032 #:parallel-build? #f ; Would be buggy.
1034 (list (string-append "CFLAGS=-Wall -fPIC -fno-strict-aliasing -g -O2 "
1035 "$(shell pkg-config --cflags libftdi1)"))
1037 (modify-phases %standard-phases
1038 (add-after 'unpack 'set-environment-up
1039 (lambda* (#:key inputs outputs #:allow-other-keys)
1040 (let ((python (assoc-ref inputs "python")))
1042 (setenv "PYDEV" (string-append python
1044 ,(version-major+minor (package-version python))
1048 (lambda* (#:key inputs outputs make-flags #:allow-other-keys #:rest args)
1049 (let* ((out (assoc-ref outputs "out"))
1050 (out-python (string-append out
1052 ,(version-major+minor (package-version python))
1054 (install (assoc-ref %standard-phases 'install)))
1055 (install #:make-flags (cons (string-append "PYLIB=" out-python)
1057 (home-page "https://code.google.com/archive/p/libmpsse/")
1058 (synopsis "Python library for MPSSE SPI I2C JTAG adapter by FTDI")
1059 (description "This package provides a library in order to support the
1060 MPSSE (Multi-Protocol Synchronous Serial Engine) adapter by FTDI that can do
1062 (license license:gpl2+)))
1064 (define-public python2-libmpsse
1066 (inherit python-libmpsse)
1067 (name "python2-libmpsse")
1069 (substitute-keyword-arguments (package-arguments python-libmpsse)
1071 `(modify-phases ,phases
1072 (replace 'set-environment-up
1073 (lambda* (#:key inputs outputs #:allow-other-keys)
1074 (let ((python (assoc-ref inputs "python")))
1076 (setenv "PYDEV" (string-append python
1078 ,(version-major+minor (package-version python-2))))
1081 (lambda* (#:key inputs outputs make-flags #:allow-other-keys #:rest args)
1082 (let* ((out (assoc-ref outputs "out"))
1083 (out-python (string-append out
1085 ,(version-major+minor (package-version python-2))
1087 (install (assoc-ref %standard-phases 'install)))
1088 (install #:make-flags (cons (string-append "PYLIB=" out-python)
1091 (alist-replace "python" (list python-2)
1092 (package-inputs python-libmpsse)))))
1094 (define-public picprog
1100 (uri (string-append "http://www.iki.fi/hyvatti/pic/picprog-"
1102 (file-name (string-append name "-" version ".tar.gz"))
1105 "1r04hg1n3v2jf915qr05la3q9cxy7a5jnh9cc98j04lh6c9p4x85"))
1106 (patches (search-patches "picprog-non-intel-support.patch"))))
1107 (build-system gnu-build-system)
1109 `(#:tests? #f ; No tests exist.
1111 (modify-phases %standard-phases
1112 (add-after 'unpack 'patch-paths
1113 (lambda* (#:key outputs #:allow-other-keys)
1114 (substitute* "Makefile"
1115 (("/usr/local") (assoc-ref outputs "out"))
1116 ((" -o 0 -g 0 ") " ")
1119 (add-before 'install 'mkdir
1120 (lambda* (#:key outputs #:allow-other-keys)
1121 (let ((out (assoc-ref outputs "out")))
1122 (mkdir-p (string-append out "/bin"))
1123 (mkdir-p (string-append out "/man/man1"))
1125 (delete 'configure))))
1126 (synopsis "Programs Microchip's PIC microcontrollers")
1127 (description "This program programs Microchip's PIC microcontrollers.")
1128 (home-page "https://hyvatti.iki.fi/~jaakko/pic/picprog.html")
1129 (license license:gpl3+)))
1131 (define-public fc-host-tools
1133 (name "fc-host-tools")
1137 (uri (string-append "ftp://ftp.freecalypso.org/pub/GSM/"
1138 "FreeCalypso/fc-host-tools-r" version ".tar.bz2"))
1141 "0s87lp6gd8i8ivrdd7mnnalysr65035nambcm992rgla7sk76sj1"))))
1142 (build-system gnu-build-system)
1144 `(#:tests? #f ; No tests exist.
1146 (list (string-append "INSTALL_PREFIX=" %output)
1147 (string-append "INCLUDE_INSTALL_DIR=" %output "include/rvinterf"))
1149 (modify-phases %standard-phases
1150 (add-after 'unpack 'patch-installation-paths
1151 (lambda* (#:key outputs #:allow-other-keys)
1152 (substitute* '("Makefile"
1153 "rvinterf/etmsync/fsiomain.c"
1154 "rvinterf/etmsync/fsnew.c"
1155 "rvinterf/asyncshell/help.c"
1156 "rvinterf/libinterf/launchrvif.c"
1157 "loadtools/defpath.c"
1158 "loadtools/Makefile"
1159 "miscutil/c139explore"
1160 "miscutil/pirexplore"
1161 "ffstools/tiffs-wrappers/installpath.c"
1162 "uptools/atcmd/atinterf.c")
1163 (("/opt/freecalypso/loadtools")
1164 (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
1165 (("\\$\\{INSTALL_PREFIX\\}/loadtools")
1166 (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
1167 (("\\$\\{INSTALL_PREFIX\\}/target-bin")
1168 (string-append (assoc-ref outputs "out") "/lib/freecalypso/target-bin"))
1169 (("/opt/freecalypso")
1170 (assoc-ref outputs "out")))
1172 (delete 'configure))))
1174 `(("libx11" ,libx11)))
1175 (synopsis "Freecalypso host tools")
1176 (description "This package provides some tools for debugging FreeCalypso phones and the FreeCalypso FCDEV3B dev board.
1179 @item fc-e1decode: Decodes a binary Melody E1 file into an ASCII source file.
1180 @item fc-e1gen: Encodes an ASCII Melody E1 file into a binary Melody E1 file.
1181 @item fc-fr2tch: Converts a GSM 06.10 speech recording from libgsm to hex
1182 strings of TCH bits to be fed to the GSM 05.03 channel encoder of a TI
1184 @item fc-tch2fr: Converts hex strings of TCH bits to libgsm.
1185 @item fc-gsm2vm: utility converts a GSM 06.10 speech sample from the libgsm
1186 source format into a voice memo file that can be uploaded into the FFS of a
1187 FreeCalypso device and played with the audio_vm_play_start() API or the
1188 AT@@VMP command that invokes the latter.
1189 @item fc-rgbconv: Convers RGB 5:6:5 to RGB 8:8:8 and vice versa.
1190 @item rvinterf: Communicates with a TI Calypso GSM device via RVTMUX.
1191 @item rvtdump: produces a human-readable dump of all output emitted by a
1192 TI-based GSM fw on the RVTMUX binary packet interface.
1193 @item fc-shell: FreeCalypso firmwares have a feature of our own invention
1194 (not present in any pre-existing ones) to accept AT commands over the RVTMUX
1195 interface. It is useful when no second UART is available for a dedicated
1196 standard AT command interface. fc-shell is the tool that allows you to send
1197 AT commands to the firmware in this manner.
1198 @item fc-memdump: Captures a memory dump from a GSM device.
1199 @item fc-serterm: Trivial serial terminal. Escapes binary chars.
1200 @item fc-fsio: Going through rvinterf, this tool connects to GSM devices and
1201 allows you to manipulate the device's flash file system.
1202 @item tiaud-compile: Compiles an audio mode configuration table for TI's
1203 Audio Service from our own ASCII source format into the binary format for
1204 uploading into FreeCalypso GSM device FFS with fc-fsio.
1205 @item tiaud-decomp: Decodes TI's audio mode configuration files read out of
1206 FFS into our own ASCII format.
1207 @item tiaud-mkvol: Generates the *.vol binary files which need to accompany
1208 the main *.cfg ones.
1209 @item fc-compalram: Allows running programs on the device without writing
1210 them to flash storage.
1211 @item fc-xram: Allows running programs on the device without writing them
1213 @item fc-iram: Allows running programs on the device without writing them
1215 @item fc-loadtool: Writes programs to the device's flash storage.
1216 @item pirffs: Allows listing and extracting FFS content captured as a raw
1217 flash image from Pirelli phones.
1218 @item mokoffs: Allows listing and extracting FFS content captured as a raw
1219 flash image from OpenMoko phones.
1220 @item tiffs: Allows listing and extracting FFS content captured as a raw
1221 flash image from TI phones.
1222 @item c139explore: Run-from-RAM program for C139 phones that
1223 exercises their peripheral hardware: LCD, keypad backlight, buzzer, vibrator.
1224 @item pirexplore: Run-from-RAM program for Pirelli DP-L10 phones that
1225 exercises their peripheral hardware, primarily their LCD.
1226 @item tfc139: Breaks into Mot C1xx phones via shellcode injection, allowing
1227 you to reflash locked phones with new firmware with fc-loadtool.
1228 @item ctracedec: GSM firmwares built in TI's Windows environment have a
1229 compressed trace misfeature whereby many of the ASCII strings
1230 in debug trace messages get replaced with numeric indices at
1231 build time, and these numeric indices are all that gets emitted
1232 on the RVTMUX serial channel. This tools decodes these numeric indices
1233 back to strings in trace output.
1234 @item fc-cal2text: This utility takes a dump of TI's /gsm/rf flash file system
1235 directory subtree as input (either extracted in vitro with tiffs
1236 or read out in vivo with fc-fsio) and converts all RF tables
1237 found therein into a readable ASCII format.
1238 @item imei-luhn: Computes or verifies the Luhn check digit of an IMEI number.
1239 @item fc-dspapidump: Reads and dumps the contents of the DSP API RAM in a
1240 target Calypso GSM device.
1241 @item fc-vm2hex: Converts the old-fashioned (non-AMR) voice memo files read
1242 out of FFS into hex strings.
1243 @item fc-buzplay: Plays piezoelectic buzzer melodies on an actual
1244 Calypso device equipped with such a buzzer (Mot C1xx, TI's D-Sample board,
1245 our planned future HSMBP) by loading a buzplayer agent onto the target and
1246 feeding melodies to be played to it.
1247 @item fc-tmsh: TI-based GSM firmwares provide a rich set of Test Mode commands
1248 that can be issued through the RVTMUX (debug trace) serial channel.
1249 This program is our test mode shell for sending Test Mode commands to targets
1250 and displaying decoded target responses.
1251 @item fcup-smsend: Send a short message via SMS
1252 @item fcup-smsendmult: Send multiple short messages via SMS in one go
1253 @item fcup-smsendpdu: Send multiple short messages given in PDU format via SMS
1254 @item sms-pdu-decode: Decode PDU format messages
1256 (home-page "https://www.freecalypso.org/")
1257 (license license:public-domain)))
1259 (define-public stlink
1267 (url "https://github.com/texane/stlink")
1268 (commit (string-append "v" version))))
1269 (file-name (git-file-name name version))
1272 "1d5gxiqpsm8fc105cxlp27af9fk339fap5h6nay21x5a7n61jgyc"))))
1273 (build-system cmake-build-system)
1275 `(#:tests? #f ;no tests
1277 (let* ((out (assoc-ref %outputs "out"))
1278 (etc (in-vicinity out "etc"))
1279 (modprobe (in-vicinity etc "modprobe.d"))
1280 (udev-rules (in-vicinity etc "udev/rules.d")))
1281 (list (string-append "-DSTLINK_UDEV_RULES_DIR=" udev-rules)
1282 (string-append "-DSTLINK_MODPROBED_DIR=" modprobe)))))
1284 `(("libusb" ,libusb)))
1285 (synopsis "Programmer for STM32 Discovery boards")
1286 (description "This package provides a firmware programmer for the STM32
1287 Discovery boards. It supports two versions of the chip: ST-LINK/V1 (on
1288 STM32VL discovery kits) and ST-LINK/V2 (on STM32L discovery and later kits).
1289 Two different transport layers are used: ST-LINK/V1 uses SCSI passthru
1290 commands over USB, and ST-LINK/V2 and ST-LINK/V2-1 (seen on Nucleo boards) use
1292 (home-page "https://github.com/texane/stlink")
1293 ;; The flashloaders/stm32l0x.s and flashloaders/stm32lx.s source files are
1294 ;; licensed under the GPLv2+.
1295 (license (list license:bsd-3 license:gpl2+))))
1304 (uri (pypi-uri "west" version))
1307 "0ql6ij1hrj2ir5wkxm96zgig5qwvfwa75w77wh2y13w6b9cqcr4b"))))
1309 `(("python-colorama" ,python-colorama)
1310 ("python-configobj" ,python-configobj)
1311 ("python-pykwalify" ,python-pykwalify)
1312 ("python-pyyaml" ,python-pyyaml)))
1313 (build-system python-build-system)
1314 (home-page "https://github.com/zephyrproject-rtos/west")
1315 (synopsis "Zephyr RTOS Project meta-tool")
1316 (description "West is the swiss-army knife command line tool of the Zephyr
1317 project. Its built-in commands provide a multiple repository management
1318 system with features inspired by Google’s Repo tool and Git submodules. West
1319 simplifies configuration and is also pluggable: you can write your own west
1320 \"extension commands\" which add additional features to west. Zephyr uses
1321 this feature to provide conveniences for building applications, flashing and
1322 debugging them, and more.")
1323 (license license:expat)))