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 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)
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 "http://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 (make-libstdc++-arm-none-eabi xgcc newlib)
289 (let ((libstdc++ (make-libstdc++ xgcc)))
290 (package (inherit libstdc++)
291 (name "libstdc++-arm-none-eabi")
293 (substitute-keyword-arguments (package-arguments libstdc++)
294 ((#:configure-flags flags)
295 ``("--target=arm-none-eabi"
296 "--host=arm-none-eabi"
297 "--disable-libstdcxx-pch"
299 "--with-multilib-list=armv6-m,armv7-m,armv7e-m"
304 ,(string-append "--with-gxx-include-dir="
305 (assoc-ref %outputs "out")
306 "/arm-none-eabi/include")))))
310 ,@(package-native-inputs libstdc++))))))
312 (define (arm-none-eabi-toolchain xgcc newlib)
313 "Produce a cross-compiler toolchain package with the compiler XGCC and the C
314 library variant NEWLIB."
315 (let ((newlib-with-xgcc (package (inherit newlib)
317 (alist-replace "xgcc" (list xgcc)
318 (package-native-inputs newlib))))))
320 (name (string-append "arm-none-eabi"
321 (if (string=? (package-name newlib-with-xgcc)
325 (version (package-version xgcc))
327 (build-system trivial-build-system)
329 '(#:modules ((guix build union))
332 (use-modules (ice-9 match)
335 (((names . directories) ...)
336 (union-build (assoc-ref %outputs "out")
340 `(("binutils" ,(cross-binutils "arm-none-eabi"))
341 ("libstdc++" ,(make-libstdc++-arm-none-eabi xgcc newlib-with-xgcc))
343 ("newlib" ,newlib-with-xgcc)))
344 (synopsis "Complete GCC tool chain for ARM bare metal development")
345 (description "This package provides a complete GCC tool chain for ARM
346 bare metal development. This includes the GCC arm-none-eabi cross compiler
347 and newlib (or newlib-nano) as the C library. The supported programming
348 languages are C and C++.")
349 (home-page (package-home-page xgcc))
350 (license (package-license xgcc)))))
352 (define-public arm-none-eabi-toolchain-4.9
353 (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9
354 newlib-arm-none-eabi))
356 (define-public arm-none-eabi-nano-toolchain-4.9
357 (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9
358 newlib-nano-arm-none-eabi))
360 (define-public arm-none-eabi-toolchain-6
361 (arm-none-eabi-toolchain gcc-arm-none-eabi-6
362 newlib-arm-none-eabi))
364 (define-public arm-none-eabi-nano-toolchain-6
365 (arm-none-eabi-toolchain gcc-arm-none-eabi-6
366 newlib-nano-arm-none-eabi))
368 (define-public gdb-arm-none-eabi
371 (name "gdb-arm-none-eabi")
373 `(#:configure-flags '("--target=arm-none-eabi"
376 "--enable-languages=c,c++"
378 ,@(package-arguments gdb)))))
380 (define-public libjaylink
381 ;; No release tarballs available.
382 (let ((commit "699b7001d34a79c8e7064503dde1bede786fd7f0")
386 (version (string-append "0.1.0-" revision "."
387 (string-take commit 7)))
391 (url "https://git.zapb.de/libjaylink.git")
393 (file-name (string-append name "-" version "-checkout"))
396 "034872d44myycnzn67v5b8ixrgmg8sk32aqalvm5x7108w2byww1"))))
397 (build-system gnu-build-system)
399 `(("autoconf" ,autoconf)
400 ("automake" ,automake)
402 ("pkg-config" ,pkg-config)))
404 `(("libusb" ,libusb)))
405 (home-page "http://repo.or.cz/w/libjaylink.git")
406 (synopsis "Library to interface Segger J-Link devices")
407 (description "libjaylink is a shared library written in C to access
408 SEGGER J-Link and compatible devices.")
409 (license license:gpl2+))))
411 (define-public jimtcl
418 "https://github.com/msteveb/jimtcl"
419 "/archive/" version ".tar.gz"))
420 (file-name (string-append name "-" version ".tar.gz"))
423 "1cmk3qscqckg70chjyimzxa2qcka4qac0j4wq908kiijp45cax08"))))
424 (build-system gnu-build-system)
427 (modify-phases %standard-phases
428 ;; Doesn't use autoconf.
430 (lambda* (#:key outputs #:allow-other-keys)
431 (let ((out (assoc-ref outputs "out")))
432 (invoke "./configure"
433 (string-append "--prefix=" out))))))))
434 (home-page "http://jim.tcl.tk")
435 (synopsis "Small footprint Tcl implementation")
436 (description "Jim is a small footprint implementation of the Tcl programming
438 (license license:bsd-2)))
440 (define-public openocd
446 (uri (string-append "mirror://sourceforge/openocd/openocd/"
447 version "/openocd-" version ".tar.gz"))
450 "09p57y3c2spqx4vjjlz1ljm1lcd0j9q8g76ywxqgn3yc34wv18zd"))
451 ;; FIXME: Remove after nrf52 patch is merged.
453 (search-patches "openocd-nrf52.patch"))))
454 (build-system gnu-build-system)
456 `(("autoconf" ,autoconf)
457 ("automake" ,automake)
459 ("pkg-config" ,pkg-config)))
464 ("libjaylink" ,libjaylink)
465 ("libusb-compat" ,libusb-compat)))
468 (append (list "--disable-werror"
470 "--disable-internal-jimtcl"
471 "--disable-internal-libjaylink")
472 (map (lambda (programmer)
473 (string-append "--enable-" programmer))
474 '("amtjtagaccel" "armjtagew" "buspirate" "ftdi"
475 "gw16012" "jlink" "opendous" "osbdm"
476 "parport" "aice" "cmsis-dap" "dummy" "jtag_vpi"
477 "remote-bitbang" "rlink" "stlink" "ti-icdi" "ulink"
478 "usbprog" "vsllink" "usb-blaster-2" "usb_blaster"
479 "presto" "openjtag")))
481 (modify-phases %standard-phases
482 ;; Required because of patched sources.
483 (add-before 'configure 'autoreconf
484 (lambda _ (invoke "autoreconf" "-vfi") #t))
485 (add-after 'autoreconf 'change-udev-group
487 (substitute* "contrib/60-openocd.rules"
488 (("plugdev") "dialout"))
490 (add-after 'install 'install-udev-rules
491 (lambda* (#:key outputs #:allow-other-keys)
492 (install-file "contrib/60-openocd.rules"
494 (assoc-ref outputs "out")
495 "/lib/udev/rules.d/"))
497 (home-page "http://openocd.org")
498 (synopsis "On-Chip Debugger")
499 (description "OpenOCD provides on-chip programming and debugging support
500 with a layered architecture of JTAG interface and TAP support.")
501 (license license:gpl2+)))
503 ;; The commits for all propeller tools are the stable versions published at
504 ;; https://github.com/propellerinc/propgcc in the release_1_0. According to
505 ;; personal correspondence with the developers in July 2017, more recent
506 ;; versions are currently incompatible with the "Simple Libraries".
508 (define propeller-binutils
509 (let ((xbinutils (cross-binutils "propeller-elf"))
510 (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
514 (name "propeller-binutils")
515 (version (string-append "0.0.0-" revision "." (string-take commit 9)))
516 (source (origin (inherit (package-source xbinutils))
519 (url "https://github.com/parallaxinc/propgcc.git")
521 (file-name (string-append name "-" commit "-checkout"))
524 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
525 (patch-flags (list "-p1" "--directory=binutils"))))
527 `(;; FIXME: For some reason there are many test failures. It's not
528 ;; obvious how to fix the failures.
531 (modify-phases %standard-phases
532 (add-after 'unpack 'chdir
533 (lambda _ (chdir "binutils") #t)))
534 ,@(substitute-keyword-arguments (package-arguments xbinutils)
535 ((#:configure-flags flags)
536 `(cons "--disable-werror" ,flags)))))
542 ,@(package-native-inputs xbinutils))))))
544 (define-public propeller-gcc-6
545 (let ((xgcc (cross-gcc "propeller-elf"
546 #:xbinutils propeller-binutils))
547 (commit "b4f45a4725e0b6d0af59e594c4e3e35ca4105867")
549 (package (inherit xgcc)
550 (name "propeller-gcc")
551 (version (string-append "6.0.0-" revision "." (string-take commit 9)))
555 (url "https://github.com/totalspectrum/gcc-propeller.git")
557 (file-name (string-append name "-" commit "-checkout"))
560 "0d9kdxm2fzanjqa7q5850kzbsfl0fqyaahxn74h6nkxxacwa11zb"))
563 (origin-patches (package-source gcc-6))
564 (search-patches "gcc-cross-environment-variables.patch")))))
567 ,@(package-native-inputs xgcc)))
568 ;; All headers and cross libraries of the propeller toolchain are
569 ;; installed under the "propeller-elf" prefix.
571 (list (search-path-specification
572 (variable "CROSS_C_INCLUDE_PATH")
573 (files '("propeller-elf/include")))
574 (search-path-specification
575 (variable "CROSS_LIBRARY_PATH")
576 (files '("propeller-elf/lib")))))
577 (home-page "https://github.com/totalspectrum/gcc-propeller")
578 (synopsis "GCC for the Parallax Propeller"))))
580 (define-public propeller-gcc-4
581 (let ((xgcc propeller-gcc-6)
582 (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
584 (package (inherit xgcc)
585 (name "propeller-gcc")
586 (version (string-append "4.6.1-" revision "." (string-take commit 9)))
590 (url "https://github.com/parallaxinc/propgcc.git")
592 (file-name (string-append name "-" commit "-checkout"))
595 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
596 (patch-flags (list "-p1" "--directory=gcc"))
599 (origin-patches (package-source gcc-4.7))
600 (search-patches "gcc-4.6-gnu-inline.patch"
601 "gcc-cross-environment-variables.patch")))))
603 (substitute-keyword-arguments (package-arguments propeller-gcc-6)
605 `(modify-phases ,phases
606 (add-after 'unpack 'chdir
607 (lambda _ (chdir "gcc") #t))))))
610 ,@(package-native-inputs propeller-gcc-6)))
611 (home-page "https://github.com/parallaxinc/propgcc")
612 (supported-systems (delete "aarch64-linux" %supported-systems)))))
614 ;; Version 6 is experimental and may not work correctly. This is why we
615 ;; default to version 4, which is also used in the binary toolchain bundle
616 ;; provided by Parallax Inc.
617 (define-public propeller-gcc propeller-gcc-4)
620 ;; FIXME: We do not build the tiny library because that would require C++
621 ;; headers, which are not available. This may require adding a propeller-elf
622 ;; variant of the libstdc++ package.
623 (define-public proplib
624 (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
628 (version (string-append "0.0.0-" revision "." (string-take commit 9)))
632 (url "https://github.com/parallaxinc/propgcc.git")
634 (file-name (string-append name "-" commit "-checkout"))
637 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
638 (build-system gnu-build-system)
640 `(#:tests? #f ; no tests
642 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
643 (string-append "BUILD=" (getcwd) "/build"))
645 (modify-phases %standard-phases
647 (add-after 'unpack 'chdir
648 (lambda _ (chdir "lib") #t))
649 (add-after 'chdir 'fix-Makefile
651 (substitute* "Makefile"
652 ;; Control the installation time of the headers.
653 ((" install-includes") ""))
655 ;; The Makefile does not separate building from installation, so we
656 ;; have to create the target directories at build time.
657 (add-before 'build 'create-target-directories
658 (lambda* (#:key make-flags #:allow-other-keys)
659 (apply invoke "make" "install-dirs" make-flags)))
660 (add-before 'build 'set-cross-environment-variables
661 (lambda* (#:key outputs #:allow-other-keys)
662 (setenv "CROSS_LIBRARY_PATH"
663 (string-append (assoc-ref outputs "out")
664 "/propeller-elf/lib:"
665 (or (getenv "CROSS_LIBRARY_PATH") "")))
666 (setenv "CROSS_C_INCLUDE_PATH"
667 (string-append (assoc-ref outputs "out")
668 "/propeller-elf/include:"
669 (or (getenv "CROSS_C_INCLUDE_PATH") "")))
671 (add-before 'install 'install-includes
672 (lambda* (#:key make-flags #:allow-other-keys)
673 (apply invoke "make" "install-includes" make-flags))))))
675 `(("propeller-gcc" ,propeller-gcc)
676 ("propeller-binutils" ,propeller-binutils)
678 (home-page "https://github.com/parallaxinc/propgcc")
679 (synopsis "C library for the Parallax Propeller")
680 (description "This is a C library for the Parallax Propeller
682 ;; Most of the code is released under the Expat license. Some of the
683 ;; included code is public domain and some changes are BSD licensed.
684 (license license:expat))))
686 (define-public propeller-toolchain
688 (name "propeller-toolchain")
689 (version (package-version propeller-gcc))
691 (build-system trivial-build-system)
692 (arguments '(#:builder (begin (mkdir %output) #t)))
694 `(("binutils" ,propeller-binutils)
696 ("gcc" ,propeller-gcc)))
697 (synopsis "Complete GCC tool chain for Propeller micro-controllers")
698 (description "This package provides a complete GCC tool chain for
699 Propeller micro-controller development.")
700 (home-page (package-home-page propeller-gcc))
701 (license (package-license propeller-gcc))))
703 (define-public openspin
709 (uri (string-append "https://github.com/parallaxinc/"
710 "OpenSpin/archive/" version ".tar.gz"))
711 (file-name (string-append name "-" version ".tar.gz"))
714 "1k2dbz1v604g4r2d9qhckg2m8dnhiya760mbsqfsg4waxal87yb7"))))
715 (build-system gnu-build-system)
717 `(#:tests? #f ; no tests
719 (modify-phases %standard-phases
721 (add-after 'unpack 'remove-timestamp
723 (substitute* "SpinSource/openspin.cpp"
724 ((" Compiled on.*$") "\\n\");"))
726 ;; Makefile does not include "install" target
728 (lambda* (#:key outputs #:allow-other-keys)
729 (let ((bin (string-append (assoc-ref outputs "out")
732 (install-file "build/openspin" bin)
734 (home-page "https://github.com/parallaxinc/OpenSpin")
735 (synopsis "Spin/PASM compiler for the Parallax Propeller")
736 (description "OpenSpin is a compiler for the Spin/PASM language of the
737 Parallax Propeller. It was ported from Chip Gracey's original x86 assembler
739 (license license:expat)))
741 (define-public propeller-load
742 (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
745 (name "propeller-load")
750 (url "https://github.com/parallaxinc/propgcc.git")
752 (file-name (string-append name "-" commit "-checkout"))
755 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
756 (build-system gnu-build-system)
758 `(#:tests? #f ; no tests
761 (string-append "TARGET=" (assoc-ref %outputs "out")))
763 (modify-phases %standard-phases
764 (add-after 'unpack 'chdir
765 (lambda _ (chdir "loader") #t))
766 (delete 'configure))))
768 `(("openspin" ,openspin)
769 ("propeller-toolchain" ,propeller-toolchain)))
770 (home-page "https://github.com/parallaxinc/propgcc")
771 (synopsis "Loader for Parallax Propeller micro-controllers")
772 (description "This package provides the tool @code{propeller-load} to
773 upload binaries to a Parallax Propeller micro-controller.")
774 (license license:expat))))
776 (define-public spin2cpp
782 (uri (string-append "https://github.com/totalspectrum/spin2cpp/"
783 "archive/v" version ".tar.gz"))
784 (file-name (string-append name "-" version ".tar.gz"))
787 "05qak187sn0xg7vhrxw27b19xhmid1b8ab8kax3gv0faavzablfw"))))
788 (build-system gnu-build-system)
790 `(#:tests? #f ;; The tests assume that a micro-controller is connected.
792 (modify-phases %standard-phases
794 (add-before 'build 'set-cross-environment-variables
795 (lambda* (#:key inputs #:allow-other-keys)
796 (setenv "CROSS_LIBRARY_PATH"
797 (string-append (assoc-ref inputs "propeller-toolchain")
798 "/propeller-elf/lib"))
799 (setenv "CROSS_C_INCLUDE_PATH"
800 (string-append (assoc-ref inputs "propeller-toolchain")
801 "/propeller-elf/include"))
804 (lambda* (#:key outputs #:allow-other-keys)
805 (let ((bin (string-append (assoc-ref outputs "out")
807 (for-each (lambda (file)
808 (install-file (string-append "build/" file)
810 '("testlex" "spin2cpp" "fastspin")))
814 ("propeller-load" ,propeller-load)
815 ("propeller-toolchain" ,propeller-toolchain)))
816 (home-page "https://github.com/totalspectrum/spin2cpp")
817 (synopsis "Convert Spin code to C, C++, or PASM code")
818 (description "This is a set of tools for converting the Spin language for
819 the Parallax Propeller micro-controller into C or C++ code, into PASM, or even
820 directly into an executable binary. The binaries produced use LMM PASM, so
821 they are much faster than regular Spin bytecodes (but also quite a bit
823 (license license:expat)))
825 (define-public spinsim
826 (let ((commit "66915a7ad1a3a2cf990a725bb341fab8d11eb620")
830 (version (string-append "0.75-" revision "." (string-take commit 9)))
834 (url "https://github.com/parallaxinc/spinsim.git")
836 (file-name (string-append name "-" commit "-checkout"))
839 "1n9kdhlxsdx7bz6c80w8dhi96zp633gd6qs0x9i4ii8qv4i7sj5k"))))
840 (build-system gnu-build-system)
842 `(#:tests? #f ; no tests
844 (modify-phases %standard-phases
847 (lambda* (#:key outputs #:allow-other-keys)
848 (let ((bin (string-append (assoc-ref outputs "out")
850 (install-file "build/spinsim" bin))
852 (home-page "https://github.com/parallaxinc/spinsim")
853 (synopsis "Spin simulator")
854 (description "This package provides the tool @code{spinsim}, a simulator
855 and simple debugger for Spin programs written for a Parallax Propeller
856 micro-controller. Spinsim supports execution from cog memory and hub
857 execution, but it does not support multi-tasking. It supports about
858 two-thirds of the opcodes in the P2 instruction set.")
859 (license license:expat))))
861 (define-public propeller-development-suite
863 (name "propeller-development-suite")
864 (version (package-version propeller-gcc))
866 (build-system trivial-build-system)
867 (arguments '(#:builder (begin (mkdir %output) #t)))
869 `(("toolchain" ,propeller-toolchain)
870 ("openspin" ,openspin)
871 ("propeller-load" ,propeller-load)
872 ("spin2cpp" ,spin2cpp)
873 ("spinsim" ,spinsim)))
874 (synopsis "Complete development suite for Propeller micro-controllers")
875 (description "This meta-package provides a complete environment for the
876 development with Parallax Propeller micro-controllers. It includes the GCC
877 toolchain, the loader, the Openspin compiler, the Spin2cpp tool, and the Spin
879 (home-page (package-home-page propeller-gcc))
880 (license (package-license propeller-gcc))))
882 (define-public binutils-vc4
883 (let ((commit "708acc851880dbeda1dd18aca4fd0a95b2573b36"))
885 (name "binutils-vc4")
886 (version (string-append "2.23.51-0." (string-take commit 7)))
890 (url "https://github.com/puppeh/binutils-vc4.git")
892 (file-name (string-append name "-" version "-checkout"))
895 "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63"))))
896 (build-system gnu-build-system)
898 `(#:configure-flags '("--target=vc4-elf"
900 "--enable-cgen-maint")
902 (modify-phases %standard-phases
903 (add-after 'unpack 'unpack-cgen
904 (lambda* (#:key inputs #:allow-other-keys)
905 (copy-recursively (string-append (assoc-ref inputs "cgen")
908 (add-after 'unpack-cgen 'fix-cgen-guile
910 (substitute* "opcodes/Makefile.in"
911 (("guile\\{,-\\}1.8") "guile"))
912 (invoke "which" "guile"))))))
918 (url "https://github.com/puppeh/cgen.git")
919 (commit "d8e2a9eb70425f180fdd5bfd032884b0855f2032")))
922 "14b3h2ji740s8zq5vwm4qdcxs4aa4wxi6wb9di3bv1h39x14nyr9"))))
926 ("guile-1.8" ,guile-1.8)
927 ("which" ,base:which)))
928 (synopsis "Binutils for VC4")
929 (description "This package provides @code{binutils} for VideoCore IV,
930 the Raspberry Pi chip.")
931 (license license:gpl3+)
932 (home-page "https://github.com/puppeh/vc4-toolchain/"))))
934 (define-public gcc-vc4
935 (let ((commit "165f6d0e11d2e76ee799533bb45bd5c92bf60dc2")
936 (xgcc (cross-gcc "vc4-elf" #:xbinutils binutils-vc4)))
937 (package (inherit xgcc)
942 (url "https://github.com/puppeh/gcc-vc4.git")
944 (file-name (string-append name
946 (package-version xgcc)
950 "13h30qjcwnlz6lfma1d82nnvfmjnhh7abkagip4vly6vm5fpnvf2"))))
953 ,@(package-native-inputs xgcc)))
954 (synopsis "GCC for VC4")
955 (description "This package provides @code{gcc} for VideoCore IV,
956 the Raspberry Pi chip."))))
958 (define-public python-libmpsse
960 (name "python-libmpsse")
966 (url "https://github.com/daym/libmpsse.git")
967 (commit (string-append "v" version))))
968 (file-name "libmpsse-checkout")
971 "14f1kiiia4kfd9mzwx4h63aa8bpz9aknbrrr7mychnsp3arw0z25"))))
972 (build-system gnu-build-system)
974 `(("libftdi" ,libftdi)
977 `(("pkg-config" ,pkg-config)
979 ("which" ,base:which)))
981 `(#:tests? #f ; No tests exist.
982 #:parallel-build? #f ; Would be buggy.
984 (list (string-append "CFLAGS=-Wall -fPIC -fno-strict-aliasing -g -O2 "
985 "$(shell pkg-config --cflags libftdi1)"))
987 (modify-phases %standard-phases
988 (add-after 'unpack 'set-environment-up
989 (lambda* (#:key inputs outputs #:allow-other-keys)
990 (let ((python (assoc-ref inputs "python")))
992 (setenv "PYDEV" (string-append python
994 ,(version-major+minor (package-version python))
998 (lambda* (#:key inputs outputs make-flags #:allow-other-keys #:rest args)
999 (let* ((out (assoc-ref outputs "out"))
1000 (out-python (string-append out
1002 ,(version-major+minor (package-version python))
1004 (install (assoc-ref %standard-phases 'install)))
1005 (install #:make-flags (cons (string-append "PYLIB=" out-python)
1007 (home-page "https://code.google.com/archive/p/libmpsse/")
1008 (synopsis "Python library for MPSSE SPI I2C JTAG adapter by FTDI")
1009 (description "This package provides a library in order to support the
1010 MPSSE (Multi-Protocol Synchronous Serial Engine) adapter by FTDI that can do
1012 (license license:gpl2+)))
1014 (define-public python2-libmpsse
1016 (inherit python-libmpsse)
1017 (name "python2-libmpsse")
1019 (substitute-keyword-arguments (package-arguments python-libmpsse)
1021 `(modify-phases ,phases
1022 (replace 'set-environment-up
1023 (lambda* (#:key inputs outputs #:allow-other-keys)
1024 (let ((python (assoc-ref inputs "python")))
1026 (setenv "PYDEV" (string-append python
1028 ,(version-major+minor (package-version python-2))))
1031 (lambda* (#:key inputs outputs make-flags #:allow-other-keys #:rest args)
1032 (let* ((out (assoc-ref outputs "out"))
1033 (out-python (string-append out
1035 ,(version-major+minor (package-version python-2))
1037 (install (assoc-ref %standard-phases 'install)))
1038 (install #:make-flags (cons (string-append "PYLIB=" out-python)
1041 (alist-replace "python" (list python-2)
1042 (package-inputs python-libmpsse)))))
1044 (define-public picprog
1050 (uri (string-append "http://www.iki.fi/hyvatti/pic/picprog-"
1052 (file-name (string-append name "-" version ".tar.gz"))
1055 "1r04hg1n3v2jf915qr05la3q9cxy7a5jnh9cc98j04lh6c9p4x85"))
1056 (patches (search-patches "picprog-non-intel-support.patch"))))
1057 (build-system gnu-build-system)
1059 `(#:tests? #f ; No tests exist.
1061 (modify-phases %standard-phases
1062 (add-after 'unpack 'patch-paths
1063 (lambda* (#:key outputs #:allow-other-keys)
1064 (substitute* "Makefile"
1065 (("/usr/local") (assoc-ref outputs "out"))
1066 ((" -o 0 -g 0 ") " ")
1069 (add-before 'install 'mkdir
1070 (lambda* (#:key outputs #:allow-other-keys)
1071 (let ((out (assoc-ref outputs "out")))
1072 (mkdir-p (string-append out "/bin"))
1073 (mkdir-p (string-append out "/man/man1"))
1075 (delete 'configure))))
1076 (synopsis "Programs Microchip's PIC microcontrollers")
1077 (description "This program programs Microchip's PIC microcontrollers.")
1078 (home-page "http://hyvatti.iki.fi/~jaakko/pic/picprog.html")
1079 (license license:gpl3+)))
1081 (define-public fc-host-tools
1083 (name "fc-host-tools")
1087 (uri (string-append "ftp://ftp.freecalypso.org/pub/GSM/"
1088 "FreeCalypso/fc-host-tools-r" version ".tar.bz2"))
1091 "0s87lp6gd8i8ivrdd7mnnalysr65035nambcm992rgla7sk76sj1"))))
1092 (build-system gnu-build-system)
1094 `(#:tests? #f ; No tests exist.
1096 (list (string-append "INSTALL_PREFIX=" %output)
1097 (string-append "INCLUDE_INSTALL_DIR=" %output "include/rvinterf"))
1099 (modify-phases %standard-phases
1100 (add-after 'unpack 'patch-installation-paths
1101 (lambda* (#:key outputs #:allow-other-keys)
1102 (substitute* '("Makefile"
1103 "rvinterf/etmsync/fsiomain.c"
1104 "rvinterf/etmsync/fsnew.c"
1105 "rvinterf/asyncshell/help.c"
1106 "rvinterf/libinterf/launchrvif.c"
1107 "loadtools/defpath.c"
1108 "loadtools/Makefile"
1109 "miscutil/c139explore"
1110 "miscutil/pirexplore"
1111 "ffstools/tiffs-wrappers/installpath.c"
1112 "uptools/atcmd/atinterf.c")
1113 (("/opt/freecalypso/loadtools")
1114 (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
1115 (("\\$\\{INSTALL_PREFIX\\}/loadtools")
1116 (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
1117 (("\\$\\{INSTALL_PREFIX\\}/target-bin")
1118 (string-append (assoc-ref outputs "out") "/lib/freecalypso/target-bin"))
1119 (("/opt/freecalypso")
1120 (assoc-ref outputs "out")))
1122 (delete 'configure))))
1124 `(("libx11" ,libx11)))
1125 (synopsis "Freecalypso host tools")
1126 (description "This package provides some tools for debugging FreeCalypso phones and the FreeCalypso FCDEV3B dev board.
1129 @item fc-e1decode: Decodes a binary Melody E1 file into an ASCII source file.
1130 @item fc-e1gen: Encodes an ASCII Melody E1 file into a binary Melody E1 file.
1131 @item fc-fr2tch: Converts a GSM 06.10 speech recording from libgsm to hex
1132 strings of TCH bits to be fed to the GSM 05.03 channel encoder of a TI
1134 @item fc-tch2fr: Converts hex strings of TCH bits to libgsm.
1135 @item fc-gsm2vm: utility converts a GSM 06.10 speech sample from the libgsm
1136 source format into a voice memo file that can be uploaded into the FFS of a
1137 FreeCalypso device and played with the audio_vm_play_start() API or the
1138 AT@@VMP command that invokes the latter.
1139 @item fc-rgbconv: Convers RGB 5:6:5 to RGB 8:8:8 and vice versa.
1140 @item rvinterf: Communicates with a TI Calypso GSM device via RVTMUX.
1141 @item rvtdump: produces a human-readable dump of all output emitted by a
1142 TI-based GSM fw on the RVTMUX binary packet interface.
1143 @item fc-shell: FreeCalypso firmwares have a feature of our own invention
1144 (not present in any pre-existing ones) to accept AT commands over the RVTMUX
1145 interface. It is useful when no second UART is available for a dedicated
1146 standard AT command interface. fc-shell is the tool that allows you to send
1147 AT commands to the firmware in this manner.
1148 @item fc-memdump: Captures a memory dump from a GSM device.
1149 @item fc-serterm: Trivial serial terminal. Escapes binary chars.
1150 @item fc-fsio: Going through rvinterf, this tool connects to GSM devices and
1151 allows you to manipulate the device's flash file system.
1152 @item tiaud-compile: Compiles an audio mode configuration table for TI's
1153 Audio Service from our own ASCII source format into the binary format for
1154 uploading into FreeCalypso GSM device FFS with fc-fsio.
1155 @item tiaud-decomp: Decodes TI's audio mode configuration files read out of
1156 FFS into our own ASCII format.
1157 @item tiaud-mkvol: Generates the *.vol binary files which need to accompany
1158 the main *.cfg ones.
1159 @item fc-compalram: Allows running programs on the device without writing
1160 them to flash storage.
1161 @item fc-xram: Allows running programs on the device without writing them
1163 @item fc-iram: Allows running programs on the device without writing them
1165 @item fc-loadtool: Writes programs to the device's flash storage.
1166 @item pirffs: Allows listing and extracting FFS content captured as a raw
1167 flash image from Pirelli phones.
1168 @item mokoffs: Allows listing and extracting FFS content captured as a raw
1169 flash image from OpenMoko phones.
1170 @item tiffs: Allows listing and extracting FFS content captured as a raw
1171 flash image from TI phones.
1172 @item c139explore: Run-from-RAM program for C139 phones that
1173 exercises their peripheral hardware: LCD, keypad backlight, buzzer, vibrator.
1174 @item pirexplore: Run-from-RAM program for Pirelli DP-L10 phones that
1175 exercises their peripheral hardware, primarily their LCD.
1176 @item tfc139: Breaks into Mot C1xx phones via shellcode injection, allowing
1177 you to reflash locked phones with new firmware with fc-loadtool.
1178 @item ctracedec: GSM firmwares built in TI's Windows environment have a
1179 compressed trace misfeature whereby many of the ASCII strings
1180 in debug trace messages get replaced with numeric indices at
1181 build time, and these numeric indices are all that gets emitted
1182 on the RVTMUX serial channel. This tools decodes these numeric indices
1183 back to strings in trace output.
1184 @item fc-cal2text: This utility takes a dump of TI's /gsm/rf flash file system
1185 directory subtree as input (either extracted in vitro with tiffs
1186 or read out in vivo with fc-fsio) and converts all RF tables
1187 found therein into a readable ASCII format.
1188 @item imei-luhn: Computes or verifies the Luhn check digit of an IMEI number.
1189 @item fc-dspapidump: Reads and dumps the contents of the DSP API RAM in a
1190 target Calypso GSM device.
1191 @item fc-vm2hex: Converts the old-fashioned (non-AMR) voice memo files read
1192 out of FFS into hex strings.
1193 @item fc-buzplay: Plays piezoelectic buzzer melodies on an actual
1194 Calypso device equipped with such a buzzer (Mot C1xx, TI's D-Sample board,
1195 our planned future HSMBP) by loading a buzplayer agent onto the target and
1196 feeding melodies to be played to it.
1197 @item fc-tmsh: TI-based GSM firmwares provide a rich set of Test Mode commands
1198 that can be issued through the RVTMUX (debug trace) serial channel.
1199 This program is our test mode shell for sending Test Mode commands to targets
1200 and displaying decoded target responses.
1201 @item fcup-smsend: Send a short message via SMS
1202 @item fcup-smsendmult: Send multiple short messages via SMS in one go
1203 @item fcup-smsendpdu: Send multiple short messages given in PDU format via SMS
1204 @item sms-pdu-decode: Decode PDU format messages
1206 (home-page "https://www.freecalypso.org/")
1207 (license license:public-domain)))
1209 (define-public stlink
1216 (uri (string-append "https://github.com/texane/stlink/archive/v"
1218 (file-name (string-append name "-" version ".tar.gz"))
1221 "01z1cz1a5xbbhd163qrqcgp4bi1k145pb80jmwdz50g7sfzmy570"))))
1222 (build-system cmake-build-system)
1224 `(#:tests? #f ;no tests
1226 (let* ((out (assoc-ref %outputs "out"))
1227 (etc (in-vicinity out "etc"))
1228 (modprobe (in-vicinity etc "modprobe.d"))
1229 (udev-rules (in-vicinity etc "udev/rules.d")))
1230 (list (string-append "-DSTLINK_UDEV_RULES_DIR=" udev-rules)
1231 (string-append "-DSTLINK_MODPROBED_DIR=" modprobe)))))
1233 `(("libusb" ,libusb)))
1234 (synopsis "Programmer for STM32 Discovery boards")
1235 (description "This package provides a firmware programmer for the STM32
1236 Discovery boards. It supports two versions of the chip: ST-LINK/V1 (on
1237 STM32VL discovery kits) and ST-LINK/V2 (on STM32L discovery and later kits).
1238 Two different transport layers are used: ST-LINK/V1 uses SCSI passthru
1239 commands over USB, and ST-LINK/V2 and ST-LINK/V2-1 (seen on Nucleo boards) use
1241 (home-page "https://github.com/texane/stlink")
1242 ;; The flashloaders/stm32l0x.s and flashloaders/stm32lx.s source files are
1243 ;; licensed under the GPLv2+.
1244 (license (list license:bsd-3 license:gpl2+))))
1253 (uri (pypi-uri "west" version))
1256 "0ql6ij1hrj2ir5wkxm96zgig5qwvfwa75w77wh2y13w6b9cqcr4b"))))
1258 `(("python-colorama" ,python-colorama)
1259 ("python-configobj" ,python-configobj)
1260 ("python-pykwalify" ,python-pykwalify)
1261 ("python-pyyaml" ,python-pyyaml)))
1262 (build-system python-build-system)
1263 (home-page "https://github.com/zephyrproject-rtos/west")
1264 (synopsis "Zephyr RTOS Project meta-tool")
1265 (description "West is the swiss-army knife command line tool of the Zephyr
1266 project. Its built-in commands provide a multiple repository management
1267 system with features inspired by Google’s Repo tool and Git submodules. West
1268 simplifies configuration and is also pluggable: you can write your own west
1269 \"extension commands\" which add additional features to west. Zephyr uses
1270 this feature to provide conveniences for building applications, flashing and
1271 debugging them, and more.")
1272 (license license:expat)))