1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016, 2017 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>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages embedded)
23 #:use-module (guix utils)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix svn-download)
27 #:use-module (guix git-download)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system trivial)
31 #:use-module (guix build utils)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages autotools)
34 #:use-module ((gnu packages base) #:prefix base:)
35 #:use-module (gnu packages bison)
36 #:use-module (gnu packages cross-base)
37 #:use-module (gnu packages dejagnu)
38 #:use-module (gnu packages flex)
39 #:use-module (gnu packages gcc)
40 #:use-module (gnu packages gdb)
41 #:use-module (gnu packages guile)
42 #:use-module (gnu packages libftdi)
43 #:use-module (gnu packages libusb)
44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages pkg-config)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages swig)
48 #:use-module (gnu packages texinfo)
49 #:use-module (srfi srfi-1))
51 ;; We must not use the released GCC sources here, because the cross-compiler
52 ;; does not produce working binaries. Instead we take the very same SVN
53 ;; revision from the branch that is used for a release of the "GCC ARM
54 ;; embedded" project on launchpad.
55 ;; See https://launchpadlibrarian.net/218827644/release.txt
56 (define-public gcc-arm-none-eabi-4.9
57 (let ((xgcc (cross-gcc "arm-none-eabi"
59 #:xbinutils (cross-binutils "arm-none-eabi")))
61 (svn-revision 227977))
62 (package (inherit xgcc)
63 (version (string-append (package-version xgcc) "-"
64 revision "." (number->string svn-revision)))
69 (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-4_9-branch/")
70 (revision svn-revision)))
71 (file-name (string-append "gcc-arm-embedded-" version "-checkout"))
74 "113r98kygy8rrjfv2pd3z6zlfzbj543pq7xyq8bgh72c608mmsbr"))
76 ;; Remove the one patch that doesn't apply to this 4.9 snapshot (the
77 ;; patch is for 4.9.4 and later but this svn snapshot is older).
78 (patches (remove (lambda (patch)
79 (string=? (basename patch)
80 "gcc-arm-bug-71399.patch"))
81 (origin-patches (package-source xgcc))))))
84 ,@(package-native-inputs xgcc)))
86 (substitute-keyword-arguments (package-arguments xgcc)
88 `(modify-phases ,phases
89 (add-after 'unpack 'fix-genmultilib
91 (substitute* "gcc/genmultilib"
92 (("#!/bin/sh") (string-append "#!" (which "sh"))))
94 ((#:configure-flags flags)
95 ;; The configure flags are largely identical to the flags used by the
96 ;; "GCC ARM embedded" project.
97 `(append (list "--enable-multilib"
99 "--with-multilib-list=armv6-m,armv7-m,armv7e-m"
100 "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
102 "--disable-decimal-float"
105 "--disable-libmudflap"
106 "--disable-libquadmath"
108 "--disable-libstdcxx-pch"
113 (delete "--disable-multilib" ,flags)))))
115 (list (search-path-specification
116 (variable "CROSS_C_INCLUDE_PATH")
117 (files '("arm-none-eabi/include")))
118 (search-path-specification
119 (variable "CROSS_CPLUS_INCLUDE_PATH")
120 (files '("arm-none-eabi/include")))
121 (search-path-specification
122 (variable "CROSS_LIBRARY_PATH")
123 (files '("arm-none-eabi/lib"))))))))
125 (define-public gcc-arm-none-eabi-6
127 (inherit gcc-arm-none-eabi-4.9)
128 (version (package-version gcc-6))
129 (source (origin (inherit (package-source gcc-6))
132 (origin-patches (package-source gcc-6))
133 (search-patches "gcc-6-cross-environment-variables.patch"
134 "gcc-6-arm-none-eabi-multilib.patch")))))))
136 (define-public newlib-arm-none-eabi
142 (uri (string-append "ftp://sourceware.org/pub/newlib/newlib-"
146 "01i7qllwicf05vsvh39qj7qp5fdifpvvky0x95hjq39mbqiksnsl"))))
147 (build-system gnu-build-system)
149 `(#:out-of-source? #t
150 ;; The configure flags are identical to the flags used by the "GCC ARM
151 ;; embedded" project.
152 #:configure-flags '("--target=arm-none-eabi"
153 "--enable-newlib-io-long-long"
154 "--enable-newlib-register-fini"
155 "--disable-newlib-supplied-syscalls"
158 (modify-phases %standard-phases
159 (add-after 'unpack 'fix-references-to-/bin/sh
161 (substitute* '("libgloss/arm/cpu-init/Makefile.in"
162 "libgloss/arm/Makefile.in"
163 "libgloss/libnosys/Makefile.in"
164 "libgloss/Makefile.in")
165 (("/bin/sh") (which "sh")))
168 `(("xbinutils" ,(cross-binutils "arm-none-eabi"))
169 ("xgcc" ,gcc-arm-none-eabi-4.9)
170 ("texinfo" ,texinfo)))
171 (home-page "http://www.sourceware.org/newlib/")
172 (synopsis "C library for use on embedded systems")
173 (description "Newlib is a C library intended for use on embedded
174 systems. It is a conglomeration of several library parts that are easily
175 usable on embedded products.")
176 (license (license:non-copyleft
177 "https://www.sourceware.org/newlib/COPYING.NEWLIB"))))
179 (define-public newlib-nano-arm-none-eabi
180 (package (inherit newlib-arm-none-eabi)
183 (substitute-keyword-arguments (package-arguments newlib-arm-none-eabi)
184 ;; The configure flags are identical to the flags used by the "GCC ARM
185 ;; embedded" project. They optimize newlib for use on small embedded
186 ;; systems with limited memory.
187 ((#:configure-flags flags)
188 ''("--target=arm-none-eabi"
190 "--disable-newlib-supplied-syscalls"
191 "--enable-newlib-reent-small"
192 "--disable-newlib-fvwrite-in-streamio"
193 "--disable-newlib-fseek-optimization"
194 "--disable-newlib-wide-orient"
195 "--enable-newlib-nano-malloc"
196 "--disable-newlib-unbuf-stream-opt"
198 "--enable-newlib-global-atexit"
199 "--enable-newlib-nano-formatted-io"
201 (synopsis "Newlib variant for small systems with limited memory")))
203 (define (make-libstdc++-arm-none-eabi xgcc newlib)
204 (let ((libstdc++ (make-libstdc++ xgcc)))
205 (package (inherit libstdc++)
206 (name "libstdc++-arm-none-eabi")
208 (substitute-keyword-arguments (package-arguments libstdc++)
209 ((#:configure-flags flags)
210 ``("--target=arm-none-eabi"
211 "--host=arm-none-eabi"
212 "--disable-libstdcxx-pch"
214 "--with-multilib-list=armv6-m,armv7-m,armv7e-m"
219 ,(string-append "--with-gxx-include-dir="
220 (assoc-ref %outputs "out")
221 "/arm-none-eabi/include")))))
225 ,@(package-native-inputs libstdc++))))))
227 (define (arm-none-eabi-toolchain xgcc newlib)
228 "Produce a cross-compiler toolchain package with the compiler XGCC and the C
229 library variant NEWLIB."
230 (let ((newlib-with-xgcc (package (inherit newlib)
232 (alist-replace "xgcc" (list xgcc)
233 (package-native-inputs newlib))))))
235 (name (string-append "arm-none-eabi"
236 (if (string=? (package-name newlib-with-xgcc)
240 (version (package-version xgcc))
242 (build-system trivial-build-system)
244 '(#:modules ((guix build union))
247 (use-modules (ice-9 match)
250 (((names . directories) ...)
251 (union-build (assoc-ref %outputs "out")
254 `(("binutils" ,(cross-binutils "arm-none-eabi"))
255 ("libstdc++" ,(make-libstdc++-arm-none-eabi xgcc newlib-with-xgcc))
257 ("newlib" ,newlib-with-xgcc)))
258 (synopsis "Complete GCC tool chain for ARM bare metal development")
259 (description "This package provides a complete GCC tool chain for ARM
260 bare metal development. This includes the GCC arm-none-eabi cross compiler
261 and newlib (or newlib-nano) as the C library. The supported programming
262 languages are C and C++.")
263 (home-page (package-home-page xgcc))
264 (license (package-license xgcc)))))
266 (define-public arm-none-eabi-toolchain-4.9
267 (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9
268 newlib-arm-none-eabi))
270 (define-public arm-none-eabi-nano-toolchain-4.9
271 (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9
272 newlib-nano-arm-none-eabi))
274 (define-public arm-none-eabi-toolchain-6
275 (arm-none-eabi-toolchain gcc-arm-none-eabi-6
276 newlib-arm-none-eabi))
278 (define-public arm-none-eabi-nano-toolchain-6
279 (arm-none-eabi-toolchain gcc-arm-none-eabi-6
280 newlib-nano-arm-none-eabi))
282 (define-public gdb-arm-none-eabi
285 (name "gdb-arm-none-eabi")
287 `(#:configure-flags '("--target=arm-none-eabi"
290 "--enable-languages=c,c++"
292 ,@(package-arguments gdb)))))
294 (define-public libjaylink
295 ;; No release tarballs available.
296 (let ((commit "699b7001d34a79c8e7064503dde1bede786fd7f0")
300 (version (string-append "0.1.0-" revision "."
301 (string-take commit 7)))
305 (url "https://git.zapb.de/libjaylink.git")
307 (file-name (string-append name "-" version "-checkout"))
310 "034872d44myycnzn67v5b8ixrgmg8sk32aqalvm5x7108w2byww1"))))
311 (build-system gnu-build-system)
313 `(("autoconf" ,autoconf)
314 ("automake" ,automake)
316 ("pkg-config" ,pkg-config)))
318 `(("libusb" ,libusb)))
321 (modify-phases %standard-phases
322 (add-after 'unpack 'autoreconf
324 (zero? (system* "autoreconf" "-vfi")))))))
325 (home-page "http://repo.or.cz/w/libjaylink.git")
326 (synopsis "Library to interface Segger J-Link devices")
327 (description "libjaylink is a shared library written in C to access
328 SEGGER J-Link and compatible devices.")
329 (license license:gpl2+))))
331 (define-public jimtcl
338 "https://github.com/msteveb/jimtcl"
339 "/archive/" version ".tar.gz"))
340 (file-name (string-append name "-" version ".tar.gz"))
343 "1cmk3qscqckg70chjyimzxa2qcka4qac0j4wq908kiijp45cax08"))))
344 (build-system gnu-build-system)
347 (modify-phases %standard-phases
348 ;; Doesn't use autoconf.
350 (lambda* (#:key outputs #:allow-other-keys)
351 (let ((out (assoc-ref outputs "out")))
352 (zero? (system* "./configure"
353 (string-append "--prefix=" out)))))))))
354 (home-page "http://jim.tcl.tk")
355 (synopsis "Small footprint Tcl implementation")
356 (description "Jim is a small footprint implementation of the Tcl programming
358 (license license:bsd-2)))
360 (define-public openocd
366 (uri (string-append "mirror://sourceforge/openocd/openocd/"
367 version "/openocd-" version ".tar.gz"))
370 "09p57y3c2spqx4vjjlz1ljm1lcd0j9q8g76ywxqgn3yc34wv18zd"))
371 ;; FIXME: Remove after nrf52 patch is merged.
373 (search-patches "openocd-nrf52.patch"))))
374 (build-system gnu-build-system)
376 `(("autoconf" ,autoconf)
377 ("automake" ,automake)
379 ("pkg-config" ,pkg-config)))
384 ("libjaylink" ,libjaylink)
385 ("libusb-compat" ,libusb-compat)))
388 (append (list "--disable-werror"
390 "--disable-internal-jimtcl"
391 "--disable-internal-libjaylink")
392 (map (lambda (programmer)
393 (string-append "--enable-" programmer))
394 '("amtjtagaccel" "armjtagew" "buspirate" "ftdi"
395 "gw16012" "jlink" "opendous" "osbdm"
396 "parport" "aice" "cmsis-dap" "dummy" "jtag_vpi"
397 "remote-bitbang" "rlink" "stlink" "ti-icdi" "ulink"
398 "usbprog" "vsllink" "usb-blaster-2" "usb_blaster"
399 "presto" "openjtag")))
401 (modify-phases %standard-phases
402 (add-before 'configure 'autoreconf
404 (zero? (system* "autoreconf" "-vfi"))))
405 (add-after 'autoreconf 'change-udev-group
407 (substitute* "contrib/60-openocd.rules"
408 (("plugdev") "dialout"))
410 (add-after 'install 'install-udev-rules
411 (lambda* (#:key outputs #:allow-other-keys)
412 (install-file "contrib/60-openocd.rules"
414 (assoc-ref outputs "out")
415 "/lib/udev/rules.d/")))))))
416 (home-page "http://openocd.org")
417 (synopsis "On-Chip Debugger")
418 (description "OpenOCD provides on-chip programming and debugging support
419 with a layered architecture of JTAG interface and TAP support.")
420 (license license:gpl2+)))
422 ;; The commits for all propeller tools are the stable versions published at
423 ;; https://github.com/propellerinc/propgcc in the release_1_0. According to
424 ;; personal correspondence with the developers in July 2017, more recent
425 ;; versions are currently incompatible with the "Simple Libraries".
427 (define propeller-binutils
428 (let ((xbinutils (cross-binutils "propeller-elf"))
429 (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
433 (name "propeller-binutils")
434 (version (string-append "0.0.0-" revision "." (string-take commit 9)))
435 (source (origin (inherit (package-source xbinutils))
438 (url "https://github.com/parallaxinc/propgcc.git")
440 (file-name (string-append name "-" commit "-checkout"))
443 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
444 (patch-flags (list "-p1" "--directory=binutils"))))
446 `(;; FIXME: For some reason there are many test failures. It's not
447 ;; obvious how to fix the failures.
450 (modify-phases %standard-phases
451 (add-after 'unpack 'chdir
452 (lambda _ (chdir "binutils") #t)))
453 ,@(substitute-keyword-arguments (package-arguments xbinutils)
454 ((#:configure-flags flags)
455 `(cons "--disable-werror" ,flags)))))
461 ,@(package-native-inputs xbinutils))))))
463 (define-public propeller-gcc-6
464 (let ((xgcc (cross-gcc "propeller-elf"
465 #:xbinutils propeller-binutils))
466 (commit "b4f45a4725e0b6d0af59e594c4e3e35ca4105867")
468 (package (inherit xgcc)
469 (name "propeller-gcc")
470 (version (string-append "6.0.0-" revision "." (string-take commit 9)))
474 (url "https://github.com/totalspectrum/gcc-propeller.git")
476 (file-name (string-append name "-" commit "-checkout"))
479 "0d9kdxm2fzanjqa7q5850kzbsfl0fqyaahxn74h6nkxxacwa11zb"))
482 (origin-patches (package-source gcc-6))
483 (search-patches "gcc-cross-environment-variables.patch")))))
486 ,@(package-native-inputs xgcc)))
487 ;; All headers and cross libraries of the propeller toolchain are
488 ;; installed under the "propeller-elf" prefix.
490 (list (search-path-specification
491 (variable "CROSS_C_INCLUDE_PATH")
492 (files '("propeller-elf/include")))
493 (search-path-specification
494 (variable "CROSS_LIBRARY_PATH")
495 (files '("propeller-elf/lib")))))
496 (home-page "https://github.com/totalspectrum/gcc-propeller")
497 (synopsis "GCC for the Parallax Propeller"))))
499 (define-public propeller-gcc-4
500 (let ((xgcc propeller-gcc-6)
501 (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
503 (package (inherit xgcc)
504 (name "propeller-gcc")
505 (version (string-append "4.6.1-" revision "." (string-take commit 9)))
509 (url "https://github.com/parallaxinc/propgcc.git")
511 (file-name (string-append name "-" commit "-checkout"))
514 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
515 (patch-flags (list "-p1" "--directory=gcc"))
518 (origin-patches (package-source gcc-4.7))
519 (search-patches "gcc-4.6-gnu-inline.patch"
520 "gcc-cross-environment-variables.patch")))))
522 (substitute-keyword-arguments (package-arguments propeller-gcc-6)
524 `(modify-phases ,phases
525 (add-after 'unpack 'chdir
526 (lambda _ (chdir "gcc") #t))))))
527 (home-page "https://github.com/parallaxinc/propgcc")
528 (supported-systems (delete "aarch64-linux" %supported-systems)))))
530 ;; Version 6 is experimental and may not work correctly. This is why we
531 ;; default to version 4, which is also used in the binary toolchain bundle
532 ;; provided by Parallax Inc.
533 (define-public propeller-gcc propeller-gcc-4)
536 ;; FIXME: We do not build the tiny library because that would require C++
537 ;; headers, which are not available. This may require adding a propeller-elf
538 ;; variant of the libstdc++ package.
539 (define-public proplib
540 (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
544 (version (string-append "0.0.0-" revision "." (string-take commit 9)))
548 (url "https://github.com/parallaxinc/propgcc.git")
550 (file-name (string-append name "-" commit "-checkout"))
553 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
554 (build-system gnu-build-system)
556 `(#:tests? #f ; no tests
558 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
559 (string-append "BUILD=" (getcwd) "/build"))
561 (modify-phases %standard-phases
563 (add-after 'unpack 'chdir
564 (lambda _ (chdir "lib") #t))
565 (add-after 'chdir 'fix-Makefile
567 (substitute* "Makefile"
568 ;; Control the installation time of the headers.
569 ((" install-includes") ""))
571 ;; The Makefile does not separate building from installation, so we
572 ;; have to create the target directories at build time.
573 (add-before 'build 'create-target-directories
574 (lambda* (#:key make-flags #:allow-other-keys)
575 (zero? (apply system* "make" "install-dirs" make-flags))))
576 (add-before 'build 'set-cross-environment-variables
577 (lambda* (#:key outputs #:allow-other-keys)
578 (setenv "CROSS_LIBRARY_PATH"
579 (string-append (assoc-ref outputs "out")
580 "/propeller-elf/lib:"
581 (or (getenv "CROSS_LIBRARY_PATH") "")))
582 (setenv "CROSS_C_INCLUDE_PATH"
583 (string-append (assoc-ref outputs "out")
584 "/propeller-elf/include:"
585 (or (getenv "CROSS_C_INCLUDE_PATH") "")))
587 (add-before 'install 'install-includes
588 (lambda* (#:key make-flags #:allow-other-keys)
589 (zero? (apply system* "make" "install-includes" make-flags)))))))
591 `(("propeller-gcc" ,propeller-gcc)
592 ("propeller-binutils" ,propeller-binutils)
594 (home-page "https://github.com/parallaxinc/propgcc")
595 (synopsis "C library for the Parallax Propeller")
596 (description "This is a C library for the Parallax Propeller
598 ;; Most of the code is released under the Expat license. Some of the
599 ;; included code is public domain and some changes are BSD licensed.
600 (license license:expat))))
602 (define-public propeller-toolchain
604 (name "propeller-toolchain")
605 (version (package-version propeller-gcc))
607 (build-system trivial-build-system)
608 (arguments '(#:builder (mkdir %output)))
610 `(("binutils" ,propeller-binutils)
612 ("gcc" ,propeller-gcc)))
613 (synopsis "Complete GCC tool chain for Propeller micro-controllers")
614 (description "This package provides a complete GCC tool chain for
615 Propeller micro-controller development.")
616 (home-page (package-home-page propeller-gcc))
617 (license (package-license propeller-gcc))))
619 (define-public openspin
625 (uri (string-append "https://github.com/parallaxinc/"
626 "OpenSpin/archive/" version ".tar.gz"))
627 (file-name (string-append name "-" version ".tar.gz"))
630 "1k2dbz1v604g4r2d9qhckg2m8dnhiya760mbsqfsg4waxal87yb7"))))
631 (build-system gnu-build-system)
633 `(#:tests? #f ; no tests
635 (modify-phases %standard-phases
637 (add-after 'unpack 'remove-timestamp
639 (substitute* "SpinSource/openspin.cpp"
640 ((" Compiled on.*$") "\\n\");"))
642 ;; Makefile does not include "install" target
644 (lambda* (#:key outputs #:allow-other-keys)
645 (let ((bin (string-append (assoc-ref outputs "out")
648 (install-file "build/openspin" bin)
650 (home-page "https://github.com/parallaxinc/OpenSpin")
651 (synopsis "Spin/PASM compiler for the Parallax Propeller")
652 (description "OpenSpin is a compiler for the Spin/PASM language of the
653 Parallax Propeller. It was ported from Chip Gracey's original x86 assembler
655 (license license:expat)))
657 (define-public propeller-load
658 (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
661 (name "propeller-load")
666 (url "https://github.com/parallaxinc/propgcc.git")
668 (file-name (string-append name "-" commit "-checkout"))
671 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
672 (build-system gnu-build-system)
674 `(#:tests? #f ; no tests
677 (string-append "TARGET=" (assoc-ref %outputs "out")))
679 (modify-phases %standard-phases
680 (add-after 'unpack 'chdir
681 (lambda _ (chdir "loader") #t))
682 (delete 'configure))))
684 `(("openspin" ,openspin)
685 ("propeller-toolchain" ,propeller-toolchain)))
686 (home-page "https://github.com/parallaxinc/propgcc")
687 (synopsis "Loader for Parallax Propeller micro-controllers")
688 (description "This package provides the tool @code{propeller-load} to
689 upload binaries to a Parallax Propeller micro-controller.")
690 (license license:expat))))
692 (define-public spin2cpp
698 (uri (string-append "https://github.com/totalspectrum/spin2cpp/"
699 "archive/v" version ".tar.gz"))
700 (file-name (string-append name "-" version ".tar.gz"))
703 "0v5vzh69bp1r2byrpz12rql1w24ff2v9msr31596zq6hd6n82lnh"))))
704 (build-system gnu-build-system)
706 `(#:tests? #f ;; The tests assume that a micro-controller is connected.
708 (modify-phases %standard-phases
710 (add-before 'build 'set-cross-environment-variables
711 (lambda* (#:key inputs #:allow-other-keys)
712 (setenv "CROSS_LIBRARY_PATH"
713 (string-append (assoc-ref inputs "propeller-toolchain")
714 "/propeller-elf/lib"))
715 (setenv "CROSS_C_INCLUDE_PATH"
716 (string-append (assoc-ref inputs "propeller-toolchain")
717 "/propeller-elf/include"))
720 (lambda* (#:key outputs #:allow-other-keys)
721 (let ((bin (string-append (assoc-ref outputs "out")
723 (for-each (lambda (file)
724 (install-file (string-append "build/" file)
726 '("testlex" "spin2cpp" "fastspin")))
730 ("propeller-load" ,propeller-load)
731 ("propeller-toolchain" ,propeller-toolchain)))
732 (home-page "https://github.com/totalspectrum/spin2cpp")
733 (synopsis "Convert Spin code to C, C++, or PASM code")
734 (description "This is a set of tools for converting the Spin language for
735 the Parallax Propeller micro-controller into C or C++ code, into PASM, or even
736 directly into an executable binary. The binaries produced use LMM PASM, so
737 they are much faster than regular Spin bytecodes (but also quite a bit
739 (license license:expat)))
741 (define-public spinsim
742 (let ((commit "66915a7ad1a3a2cf990a725bb341fab8d11eb620")
746 (version (string-append "0.75-" revision "." (string-take commit 9)))
750 (url "https://github.com/parallaxinc/spinsim.git")
752 (file-name (string-append name "-" commit "-checkout"))
755 "1n9kdhlxsdx7bz6c80w8dhi96zp633gd6qs0x9i4ii8qv4i7sj5k"))))
756 (build-system gnu-build-system)
758 `(#:tests? #f ; no tests
760 (modify-phases %standard-phases
763 (lambda* (#:key outputs #:allow-other-keys)
764 (let ((bin (string-append (assoc-ref outputs "out")
766 (install-file "build/spinsim" bin))
768 (home-page "https://github.com/parallaxinc/spinsim")
769 (synopsis "Spin simulator")
770 (description "This package provides the tool @code{spinsim}, a simulator
771 and simple debugger for Spin programs written for a Parallax Propeller
772 micro-controller. Spinsim supports execution from cog memory and hub
773 execution, but it does not support multi-tasking. It supports about
774 two-thirds of the opcodes in the P2 instruction set.")
775 (license license:expat))))
777 (define-public propeller-development-suite
779 (name "propeller-development-suite")
780 (version (package-version propeller-gcc))
782 (build-system trivial-build-system)
783 (arguments '(#:builder (mkdir %output)))
785 `(("toolchain" ,propeller-toolchain)
786 ("openspin" ,openspin)
787 ("propeller-load" ,propeller-load)
788 ("spin2cpp" ,spin2cpp)
789 ("spinsim" ,spinsim)))
790 (synopsis "Complete development suite for Propeller micro-controllers")
791 (description "This meta-package provides a complete environment for the
792 development with Parallax Propeller micro-controllers. It includes the GCC
793 toolchain, the loader, the Openspin compiler, the Spin2cpp tool, and the Spin
795 (home-page (package-home-page propeller-gcc))
796 (license (package-license propeller-gcc))))
798 (define-public binutils-vc4
799 (let ((commit "708acc851880dbeda1dd18aca4fd0a95b2573b36"))
801 (name "binutils-vc4")
802 (version (string-append "2.23.51-0." (string-take commit 7)))
806 (url "https://github.com/puppeh/binutils-vc4.git")
808 (file-name (string-append name "-" version "-checkout"))
811 "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63"))))
812 (build-system gnu-build-system)
814 `(#:configure-flags '("--target=vc4-elf"
816 "--enable-cgen-maint")
818 (modify-phases %standard-phases
819 (add-after 'unpack 'unpack-cgen
820 (lambda* (#:key inputs #:allow-other-keys)
821 (copy-recursively (string-append (assoc-ref inputs "cgen")
824 (add-after 'unpack-cgen 'fix-cgen-guile
826 (substitute* "opcodes/Makefile.in"
827 (("guile\\{,-\\}1.8") "guile"))
828 (zero? (system* "which" "guile")))))))
834 (url "https://github.com/puppeh/cgen.git")
835 (commit "d8e2a9eb70425f180fdd5bfd032884b0855f2032")))
838 "14b3h2ji740s8zq5vwm4qdcxs4aa4wxi6wb9di3bv1h39x14nyr9"))))
842 ("guile-1.8" ,guile-1.8)
843 ("which" ,base:which)))
844 (synopsis "Binutils for VC4")
845 (description "This package provides @code{binutils} for VideoCore IV,
846 the Raspberry Pi chip.")
847 (license license:gpl3+)
848 (home-page "https://github.com/puppeh/vc4-toolchain/"))))
850 (define-public gcc-vc4
851 (let ((commit "165f6d0e11d2e76ee799533bb45bd5c92bf60dc2")
852 (xgcc (cross-gcc "vc4-elf" #:xbinutils binutils-vc4)))
853 (package (inherit xgcc)
858 (url "https://github.com/puppeh/gcc-vc4.git")
860 (file-name (string-append name
862 (package-version xgcc)
866 "13h30qjcwnlz6lfma1d82nnvfmjnhh7abkagip4vly6vm5fpnvf2"))))
869 ,@(package-native-inputs xgcc)))
870 (synopsis "GCC for VC4")
871 (description "This package provides @code{gcc} for VideoCore IV,
872 the Raspberry Pi chip."))))
874 (define-public python2-libmpsse
876 (name "python2-libmpsse")
881 (uri (string-append "https://storage.googleapis.com/"
882 "google-code-archive-downloads/v2/"
883 "code.google.com/libmpsse/"
884 "libmpsse-" version ".tar.gz"))
887 "0jq7nhqq3na8675jnpfcar3pd3dp3adhhc4lw900swkla01a1wh8"))))
888 (build-system gnu-build-system)
890 `(("libftdi" ,libftdi)
891 ("python" ,python-2)))
893 `(("pkg-config" ,pkg-config)
895 ("which" ,base:which)))
897 `(#:tests? #f ; No tests exist.
899 (list (string-append "CFLAGS=-Wall -fPIC -fno-strict-aliasing -g -O2 "
900 "$(shell pkg-config --cflags libftdi1)"))
902 (modify-phases %standard-phases
903 (add-after 'unpack 'set-environment-up
904 (lambda* (#:key inputs outputs #:allow-other-keys)
906 (setenv "PYDEV" (string-append (assoc-ref inputs "python")
907 "/include/python2.7"))
909 (add-after 'unpack 'patch-global-variable
911 ;; fast_rw_buf was defined in a header file which was making
912 ;; the build not reproducible.
913 (substitute* "src/fast.c"
914 (("^int fast_build_block_buffer") "
916 unsigned char fast_rw_buf[SPI_RW_SIZE + CMD_SIZE];
917 int fast_build_block_buffer"))
918 (substitute* "src/mpsse.h"
919 (("unsigned char fast_rw_buf.*") "
923 (lambda* (#:key outputs make-flags #:allow-other-keys #:rest args)
924 (let* ((out (assoc-ref outputs "out"))
925 (out-python (string-append out
926 "/lib/python2.7/site-packages"))
927 (install (assoc-ref %standard-phases 'install)))
928 (install #:make-flags (cons (string-append "PYLIB=" out-python)
930 (home-page "https://code.google.com/archive/p/libmpsse/")
931 (synopsis "Python library for MPSSE SPI I2C JTAG adapter by FTDI")
932 (description "This package provides a library in order to support the
933 MPSSE (Multi-Protocol Synchronous Serial Engine) adapter by FTDI that can do
935 (license license:gpl2+)))
937 (define-public picprog
943 (uri (string-append "http://www.iki.fi/hyvatti/pic/picprog-"
945 (file-name (string-append name "-" version ".tar.gz"))
948 "1r04hg1n3v2jf915qr05la3q9cxy7a5jnh9cc98j04lh6c9p4x85"))
949 (patches (search-patches "picprog-non-intel-support.patch"))))
950 (build-system gnu-build-system)
952 `(#:tests? #f ; No tests exist.
954 (modify-phases %standard-phases
955 (add-after 'unpack 'patch-paths
956 (lambda* (#:key outputs #:allow-other-keys)
957 (substitute* "Makefile"
958 (("/usr/local") (assoc-ref outputs "out"))
959 ((" -o 0 -g 0 ") " ")
962 (add-before 'install 'mkdir
963 (lambda* (#:key outputs #:allow-other-keys)
964 (let ((out (assoc-ref outputs "out")))
965 (mkdir-p (string-append out "/bin"))
966 (mkdir-p (string-append out "/man/man1"))
968 (delete 'configure))))
969 (synopsis "Programs Microchip's PIC microcontrollers")
970 (description "This program programs Microchip's PIC microcontrollers.")
971 (home-page "http://hyvatti.iki.fi/~jaakko/pic/picprog.html")
972 (license license:gpl3+)))