gnu: python-pandas: Fix build on 32-bit.
[jackhill/guix/guix.git] / gnu / packages / embedded.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2016 Theodoros Foradis <theodoros.for@openmailbox.org>
4 ;;; Copyright © 2016 David Craven <david@craven.ch>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages embedded)
22 #:use-module (guix utils)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix svn-download)
26 #:use-module (guix git-download)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system trivial)
30 #:use-module (guix build utils)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages autotools)
33 #:use-module ((gnu packages base) #:prefix base:)
34 #:use-module (gnu packages bison)
35 #:use-module (gnu packages cross-base)
36 #:use-module (gnu packages dejagnu)
37 #:use-module (gnu packages flex)
38 #:use-module (gnu packages gcc)
39 #:use-module (gnu packages gdb)
40 #:use-module (gnu packages guile)
41 #:use-module (gnu packages libftdi)
42 #:use-module (gnu packages libusb)
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages texinfo)
46 #:use-module (srfi srfi-1))
47
48 ;; We must not use the released GCC sources here, because the cross-compiler
49 ;; does not produce working binaries. Instead we take the very same SVN
50 ;; revision from the branch that is used for a release of the "GCC ARM
51 ;; embedded" project on launchpad.
52 ;; See https://launchpadlibrarian.net/218827644/release.txt
53 (define-public gcc-arm-none-eabi-4.9
54 (let ((xgcc (cross-gcc "arm-none-eabi"
55 (cross-binutils "arm-none-eabi")))
56 (revision "1")
57 (svn-revision 227977))
58 (package (inherit xgcc)
59 (version (string-append (package-version xgcc) "-"
60 revision "." (number->string svn-revision)))
61 (source
62 (origin
63 (method svn-fetch)
64 (uri (svn-reference
65 (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-4_9-branch/")
66 (revision svn-revision)))
67 (file-name (string-append "gcc-arm-embedded-" version "-checkout"))
68 (sha256
69 (base32
70 "113r98kygy8rrjfv2pd3z6zlfzbj543pq7xyq8bgh72c608mmsbr"))
71
72 ;; Remove the one patch that doesn't apply to this 4.9 snapshot (the
73 ;; patch is for 4.9.4 and later but this svn snapshot is older).
74 (patches (remove (lambda (patch)
75 (string=? (basename patch)
76 "gcc-arm-bug-71399.patch"))
77 (origin-patches (package-source xgcc))))))
78 (native-inputs
79 `(("flex" ,flex)
80 ,@(package-native-inputs xgcc)))
81 (arguments
82 (substitute-keyword-arguments (package-arguments xgcc)
83 ((#:phases phases)
84 `(modify-phases ,phases
85 (add-after 'unpack 'fix-genmultilib
86 (lambda _
87 (substitute* "gcc/genmultilib"
88 (("#!/bin/sh") (string-append "#!" (which "sh"))))
89 #t))))
90 ((#:configure-flags flags)
91 ;; The configure flags are largely identical to the flags used by the
92 ;; "GCC ARM embedded" project.
93 `(append (list "--enable-multilib"
94 "--with-newlib"
95 "--with-multilib-list=armv6-m,armv7-m,armv7e-m"
96 "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
97 "--enable-plugins"
98 "--disable-decimal-float"
99 "--disable-libffi"
100 "--disable-libgomp"
101 "--disable-libmudflap"
102 "--disable-libquadmath"
103 "--disable-libssp"
104 "--disable-libstdcxx-pch"
105 "--disable-nls"
106 "--disable-shared"
107 "--disable-threads"
108 "--disable-tls")
109 (delete "--disable-multilib" ,flags)))))
110 (native-search-paths
111 (list (search-path-specification
112 (variable "CROSS_C_INCLUDE_PATH")
113 (files '("arm-none-eabi/include")))
114 (search-path-specification
115 (variable "CROSS_CPLUS_INCLUDE_PATH")
116 (files '("arm-none-eabi/include")))
117 (search-path-specification
118 (variable "CROSS_LIBRARY_PATH")
119 (files '("arm-none-eabi/lib"))))))))
120
121 (define-public gcc-arm-none-eabi-6
122 (package
123 (inherit gcc-arm-none-eabi-4.9)
124 (version (package-version gcc-6))
125 (source (origin (inherit (package-source gcc-6))
126 (patches
127 (append
128 (origin-patches (package-source gcc-6))
129 (search-patches "gcc-6-cross-environment-variables.patch"
130 "gcc-6-arm-none-eabi-multilib.patch")))))))
131
132 (define-public newlib-arm-none-eabi
133 (package
134 (name "newlib")
135 (version "2.4.0")
136 (source (origin
137 (method url-fetch)
138 (uri (string-append "ftp://sourceware.org/pub/newlib/newlib-"
139 version ".tar.gz"))
140 (sha256
141 (base32
142 "01i7qllwicf05vsvh39qj7qp5fdifpvvky0x95hjq39mbqiksnsl"))))
143 (build-system gnu-build-system)
144 (arguments
145 `(#:out-of-source? #t
146 ;; The configure flags are identical to the flags used by the "GCC ARM
147 ;; embedded" project.
148 #:configure-flags '("--target=arm-none-eabi"
149 "--enable-newlib-io-long-long"
150 "--enable-newlib-register-fini"
151 "--disable-newlib-supplied-syscalls"
152 "--disable-nls")
153 #:phases
154 (modify-phases %standard-phases
155 (add-after 'unpack 'fix-references-to-/bin/sh
156 (lambda _
157 (substitute* '("libgloss/arm/cpu-init/Makefile.in"
158 "libgloss/arm/Makefile.in"
159 "libgloss/libnosys/Makefile.in"
160 "libgloss/Makefile.in")
161 (("/bin/sh") (which "sh")))
162 #t)))))
163 (native-inputs
164 `(("xbinutils" ,(cross-binutils "arm-none-eabi"))
165 ("xgcc" ,gcc-arm-none-eabi-4.9)
166 ("texinfo" ,texinfo)))
167 (home-page "http://www.sourceware.org/newlib/")
168 (synopsis "C library for use on embedded systems")
169 (description "Newlib is a C library intended for use on embedded
170 systems. It is a conglomeration of several library parts that are easily
171 usable on embedded products.")
172 (license (license:non-copyleft
173 "https://www.sourceware.org/newlib/COPYING.NEWLIB"))))
174
175 (define-public newlib-nano-arm-none-eabi
176 (package (inherit newlib-arm-none-eabi)
177 (name "newlib-nano")
178 (arguments
179 (substitute-keyword-arguments (package-arguments newlib-arm-none-eabi)
180 ;; The configure flags are identical to the flags used by the "GCC ARM
181 ;; embedded" project. They optimize newlib for use on small embedded
182 ;; systems with limited memory.
183 ((#:configure-flags flags)
184 ''("--target=arm-none-eabi"
185 "--enable-multilib"
186 "--disable-newlib-supplied-syscalls"
187 "--enable-newlib-reent-small"
188 "--disable-newlib-fvwrite-in-streamio"
189 "--disable-newlib-fseek-optimization"
190 "--disable-newlib-wide-orient"
191 "--enable-newlib-nano-malloc"
192 "--disable-newlib-unbuf-stream-opt"
193 "--enable-lite-exit"
194 "--enable-newlib-global-atexit"
195 "--enable-newlib-nano-formatted-io"
196 "--disable-nls"))))
197 (synopsis "Newlib variant for small systems with limited memory")))
198
199 (define (arm-none-eabi-toolchain xgcc newlib)
200 "Produce a cross-compiler toolchain package with the compiler XGCC and the C
201 library variant NEWLIB."
202 (let ((newlib-with-xgcc (package (inherit newlib)
203 (native-inputs
204 (alist-replace "xgcc" (list xgcc)
205 (package-native-inputs newlib))))))
206 (package
207 (name (string-append "arm-none-eabi"
208 (if (string=? (package-name newlib-with-xgcc)
209 "newlib-nano")
210 "-nano" "")
211 "-toolchain"))
212 (version (package-version xgcc))
213 (source #f)
214 (build-system trivial-build-system)
215 (arguments '(#:builder (mkdir %output)))
216 (propagated-inputs
217 `(("binutils" ,(cross-binutils "arm-none-eabi"))
218 ("gcc" ,xgcc)
219 ("newlib" ,newlib-with-xgcc)))
220 (synopsis "Complete GCC tool chain for ARM bare metal development")
221 (description "This package provides a complete GCC tool chain for ARM
222 bare metal development. This includes the GCC arm-none-eabi cross compiler
223 and newlib (or newlib-nano) as the C library. The supported programming
224 languages are C and C++.")
225 (home-page (package-home-page xgcc))
226 (license (package-license xgcc)))))
227
228 (define-public arm-none-eabi-toolchain-4.9
229 (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9
230 newlib-arm-none-eabi))
231
232 (define-public arm-none-eabi-nano-toolchain-4.9
233 (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9
234 newlib-nano-arm-none-eabi))
235
236 (define-public arm-none-eabi-toolchain-6
237 (arm-none-eabi-toolchain gcc-arm-none-eabi-6
238 newlib-arm-none-eabi))
239
240 (define-public arm-none-eabi-nano-toolchain-6
241 (arm-none-eabi-toolchain gcc-arm-none-eabi-6
242 newlib-nano-arm-none-eabi))
243
244 (define-public gdb-arm-none-eabi
245 (package
246 (inherit gdb)
247 (name "gdb-arm-none-eabi")
248 (arguments
249 `(#:configure-flags '("--target=arm-none-eabi"
250 "--enable-multilib"
251 "--enable-interwork"
252 "--enable-languages=c,c++"
253 "--disable-nls")
254 ,@(package-arguments gdb)))))
255
256 (define-public libjaylink
257 ;; No release tarballs available.
258 (let ((commit "faa2a433fdd3de211728f3da5921133214af9dd3")
259 (revision "1"))
260 (package
261 (name "libjaylink")
262 (version (string-append "0.1.0-" revision "."
263 (string-take commit 7)))
264 (source (origin
265 (method git-fetch)
266 (uri (git-reference
267 (url "git://git.zapb.de/libjaylink.git")
268 (commit commit)))
269 (file-name (string-append name "-" version "-checkout"))
270 (sha256
271 (base32
272 "02crr56csz8whq3q4mrmdzzgwp5b0qvxm0fb18drclc3zj44yxl2"))))
273 (build-system gnu-build-system)
274 (native-inputs
275 `(("autoconf" ,autoconf)
276 ("automake" ,automake)
277 ("libtool" ,libtool)
278 ("pkg-config" ,pkg-config)))
279 (inputs
280 `(("libusb" ,libusb)))
281 (arguments
282 `(#:phases
283 (modify-phases %standard-phases
284 (add-before 'configure 'autoreconf
285 (lambda _
286 (zero? (system* "autoreconf" "-vfi")))))))
287 (home-page "http://repo.or.cz/w/libjaylink.git")
288 (synopsis "Library to interface Segger J-Link devices")
289 (description "libjaylink is a shared library written in C to access
290 SEGGER J-Link and compatible devices.")
291 (license license:gpl2+))))
292
293 (define-public jimtcl
294 (package
295 (name "jimtcl")
296 (version "0.77")
297 (source (origin
298 (method url-fetch)
299 (uri (string-append
300 "https://github.com/msteveb/jimtcl"
301 "/archive/" version ".tar.gz"))
302 (file-name (string-append name "-" version ".tar.gz"))
303 (sha256
304 (base32
305 "1cmk3qscqckg70chjyimzxa2qcka4qac0j4wq908kiijp45cax08"))))
306 (build-system gnu-build-system)
307 (arguments
308 `(#:phases
309 (modify-phases %standard-phases
310 ;; Doesn't use autoconf.
311 (replace 'configure
312 (lambda* (#:key outputs #:allow-other-keys)
313 (let ((out (assoc-ref outputs "out")))
314 (zero? (system* "./configure"
315 (string-append "--prefix=" out)))))))))
316 (home-page "http://jim.tcl.tk")
317 (synopsis "Small footprint Tcl implementation")
318 (description "Jim is a small footprint implementation of the Tcl programming
319 language.")
320 (license license:bsd-2)))
321
322 (define-public openocd
323 ;; FIXME: Use tarball release after nrf52 patch is merged.
324 (let ((commit "674141e8a7a6413cb803d90c2a20150260015f81")
325 (revision "1"))
326 (package
327 (name "openocd")
328 (version (string-append "0.9.0-" revision "."
329 (string-take commit 7)))
330 (source (origin
331 (method git-fetch)
332 (uri (git-reference
333 (url "git://git.code.sf.net/p/openocd/code.git")
334 (commit commit)))
335 (sha256
336 (base32
337 "1i86jp0wawq78d73z8hp7q1pn7lmlvhjjr19f7299h4w40a5jf8j"))
338 (file-name (string-append name "-" version "-checkout"))
339 (patches
340 (search-patches "openocd-nrf52.patch"))))
341 (build-system gnu-build-system)
342 (native-inputs
343 `(("autoconf" ,autoconf)
344 ("automake" ,automake)
345 ("libtool" ,libtool)
346 ("pkg-config" ,pkg-config)))
347 (inputs
348 `(("hidapi" ,hidapi)
349 ("jimtcl" ,jimtcl)
350 ("libftdi" ,libftdi)
351 ("libjaylink" ,libjaylink)
352 ("libusb-compat" ,libusb-compat)))
353 (arguments
354 '(#:configure-flags
355 (append (list "--disable-werror"
356 "--disable-internal-jimtcl"
357 "--disable-internal-libjaylink")
358 (map (lambda (programmer)
359 (string-append "--enable-" programmer))
360 '("amtjtagaccel" "armjtagew" "buspirate" "ftdi"
361 "gw16012" "jlink" "oocd_trace" "opendous" "osbdm"
362 "parport" "aice" "cmsis-dap" "dummy" "jtag_vpi"
363 "remote-bitbang" "rlink" "stlink" "ti-icdi" "ulink"
364 "usbprog" "vsllink" "usb-blaster-2" "usb_blaster"
365 "presto" "openjtag")))
366 #:phases
367 (modify-phases %standard-phases
368 (add-before 'configure 'autoreconf
369 (lambda _
370 (zero? (system* "autoreconf" "-vfi")))))))
371 (home-page "http://openocd.org")
372 (synopsis "On-Chip Debugger")
373 (description "OpenOCD provides on-chip programming and debugging support
374 with a layered architecture of JTAG interface and TAP support.")
375 (license license:gpl2+))))
376
377 ;; The commits for all propeller tools are the latest versions as published
378 ;; here: https://github.com/dbetz/propeller-gcc
379
380 (define propeller-binutils
381 (let ((xbinutils (cross-binutils "propeller-elf"))
382 (commit "3bfba30076f8ce160a2f42914fdb68f24445fd44")
383 (revision "1"))
384 (package
385 (inherit xbinutils)
386 (name "propeller-binutils")
387 (version (string-append "0.0.0-" revision "." (string-take commit 9)))
388 (source (origin (inherit (package-source xbinutils))
389 (method git-fetch)
390 (uri (git-reference
391 (url "https://github.com/totalspectrum/binutils-propeller.git")
392 (commit commit)))
393 (file-name (string-append name "-" commit "-checkout"))
394 (sha256
395 (base32
396 "1v3rgxwj7b8817wy5ccf8621v75qcxvcxygk4acr3hbc6yqybr8h"))))
397 (arguments
398 `(;; FIXME: For some reason there are many test failures. Some of them
399 ;; appear to be due to regular expression mismatch, but it's not
400 ;; obvious how to fix the failures.
401 #:tests? #f
402 #:phases
403 (modify-phases %standard-phases
404 (add-after 'unpack 'patch-/bin/sh-in-tests
405 (lambda _
406 (substitute* '("sim/testsuite/Makefile.in"
407 "sim/testsuite/mips64el-elf/Makefile.in"
408 "sim/testsuite/d10v-elf/Makefile.in"
409 "sim/testsuite/sim/cris/asm/badarch1.ms")
410 (("/bin/sh") (which "sh")))
411 #t)))
412 ,@(package-arguments xbinutils)))
413 (native-inputs
414 `(("bison" ,bison)
415 ("flex" ,flex)
416 ("texinfo" ,texinfo)
417 ("dejagnu" ,dejagnu)
418 ,@(package-native-inputs xbinutils))))))
419
420 (define-public propeller-gcc
421 (let ((xgcc (cross-gcc "propeller-elf"
422 propeller-binutils))
423 (commit "b4f45a4725e0b6d0af59e594c4e3e35ca4105867")
424 (revision "1"))
425 (package (inherit xgcc)
426 (name "propeller-gcc")
427 (version (string-append "6.0.0-" revision "." (string-take commit 9)))
428 (source (origin
429 (method git-fetch)
430 (uri (git-reference
431 (url "https://github.com/totalspectrum/gcc-propeller.git")
432 (commit commit)))
433 (file-name (string-append name "-" commit "-checkout"))
434 (sha256
435 (base32
436 "0d9kdxm2fzanjqa7q5850kzbsfl0fqyaahxn74h6nkxxacwa11zb"))
437 (patches
438 (append
439 (origin-patches (package-source gcc-6))
440 (search-patches "gcc-cross-environment-variables.patch")))))
441 (native-inputs
442 `(("flex" ,flex)
443 ,@(package-native-inputs xgcc)))
444 ;; All headers and cross libraries of the propeller toolchain are
445 ;; installed under the "propeller-elf" prefix.
446 (native-search-paths
447 (list (search-path-specification
448 (variable "CROSS_C_INCLUDE_PATH")
449 (files '("propeller-elf/include")))
450 (search-path-specification
451 (variable "CROSS_LIBRARY_PATH")
452 (files '("propeller-elf/lib")))))
453 (home-page "https://github.com/totalspectrum/gcc-propeller")
454 (synopsis "GCC for the Parallax Propeller"))))
455
456 ;; There is no release, so we take the latest version as referenced from here:
457 ;; https://github.com/dbetz/propeller-gcc
458 (define-public proplib
459 (let ((commit "844741fe0ceb140ab2fdf9d0667f68c1c39c31da")
460 (revision "1"))
461 (package
462 (name "proplib")
463 (version (string-append "0.0.0-" revision "." (string-take commit 9)))
464 (source (origin
465 (method git-fetch)
466 (uri (git-reference
467 (url "https://github.com/totalspectrum/proplib.git")
468 (commit commit)))
469 (file-name (string-append name "-" commit "-checkout"))
470 (sha256
471 (base32
472 "0q7irf1x8iqx07n7lzksax9armrdkizs49swsz76nbks0mw67wiv"))))
473 (build-system gnu-build-system)
474 (arguments
475 `(#:tests? #f ; no tests
476 #:make-flags
477 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
478 (string-append "BUILD=" (getcwd) "/build"))
479 #:phases
480 (modify-phases %standard-phases
481 (delete 'configure)
482 (add-after 'unpack 'fix-Makefile
483 (lambda _
484 (substitute* "Makefile"
485 ;; The GCC sources are not part of this package, so we cannot
486 ;; install the out-of-tree license file.
487 (("cp \\.\\..*") "")
488 ;; Control the installation time of the headers.
489 ((" install-includes") ""))
490 #t))
491 ;; The Makefile does not separate building from installation, so we
492 ;; have to create the target directories at build time.
493 (add-before 'build 'create-target-directories
494 (lambda* (#:key make-flags #:allow-other-keys)
495 (zero? (apply system* "make" "install-dirs" make-flags))))
496 (add-before 'build 'set-cross-environment-variables
497 (lambda* (#:key outputs #:allow-other-keys)
498 (setenv "CROSS_LIBRARY_PATH"
499 (string-append (assoc-ref outputs "out")
500 "/propeller-elf/lib:"
501 (or (getenv "CROSS_LIBRARY_PATH") "")))
502 (setenv "CROSS_C_INCLUDE_PATH"
503 (string-append (assoc-ref outputs "out")
504 "/propeller-elf/include:"
505 (or (getenv "CROSS_C_INCLUDE_PATH") "")))
506 #t))
507 (add-after 'build 'build-tiny
508 (lambda* (#:key make-flags #:allow-other-keys)
509 (zero? (apply system* "make" "tiny" make-flags))))
510 ;; The build of the tiny libraries depends on the includes to be
511 ;; available. Since we set CROSS_C_INCLUDE_PATH to the output
512 ;; directory, we have to install the includes first.
513 (add-before 'build-tiny 'install-includes
514 (lambda* (#:key make-flags #:allow-other-keys)
515 (zero? (apply system* "make" "install-includes" make-flags))))
516 (add-after 'install 'install-tiny
517 (lambda* (#:key make-flags #:allow-other-keys)
518 (zero? (apply system* "make" "install-tiny" make-flags)))))))
519 (native-inputs
520 `(("propeller-gcc" ,propeller-gcc)
521 ("propeller-binutils" ,propeller-binutils)
522 ("perl" ,perl)))
523 (home-page "https://github.com/totalspectrum/proplib")
524 (synopsis "C library for the Parallax Propeller")
525 (description "This is a C library for the Parallax Propeller
526 micro-controller.")
527 ;; Most of the code is released under the Expat license. Some of the
528 ;; included code is public domain and some changes are BSD licensed.
529 (license license:expat))))
530
531 (define-public propeller-toolchain
532 (package
533 (name "propeller-toolchain")
534 (version (package-version propeller-gcc))
535 (source #f)
536 (build-system trivial-build-system)
537 (arguments '(#:builder (mkdir %output)))
538 (propagated-inputs
539 `(("binutils" ,propeller-binutils)
540 ("libc" ,proplib)
541 ("gcc" ,propeller-gcc)))
542 (synopsis "Complete GCC tool chain for Propeller micro-controllers")
543 (description "This package provides a complete GCC tool chain for
544 Propeller micro-controller development.")
545 (home-page (package-home-page propeller-gcc))
546 (license (package-license propeller-gcc))))
547
548 (define-public openspin
549 (package
550 (name "openspin")
551 (version "1.00.78")
552 (source (origin
553 (method url-fetch)
554 (uri (string-append "https://github.com/parallaxinc/"
555 "OpenSpin/archive/" version ".tar.gz"))
556 (file-name (string-append name "-" version ".tar.gz"))
557 (sha256
558 (base32
559 "1k2dbz1v604g4r2d9qhckg2m8dnhiya760mbsqfsg4waxal87yb7"))))
560 (build-system gnu-build-system)
561 (arguments
562 `(#:tests? #f ; no tests
563 #:phases
564 (modify-phases %standard-phases
565 (delete 'configure)
566 (add-after 'unpack 'remove-timestamp
567 (lambda _
568 (substitute* "SpinSource/openspin.cpp"
569 ((" Compiled on.*$") "\\n\");"))
570 #t))
571 ;; Makefile does not include "install" target
572 (replace 'install
573 (lambda* (#:key outputs #:allow-other-keys)
574 (let ((bin (string-append (assoc-ref outputs "out")
575 "/bin")))
576 (mkdir-p bin)
577 (install-file "build/openspin" bin)
578 #t))))))
579 (home-page "https://github.com/parallaxinc/OpenSpin")
580 (synopsis "Spin/PASM compiler for the Parallax Propeller")
581 (description "OpenSpin is a compiler for the Spin/PASM language of the
582 Parallax Propeller. It was ported from Chip Gracey's original x86 assembler
583 code.")
584 (license license:expat)))
585
586 (define-public propeller-load
587 (let ((commit "ba9c0a7251cf751d8d292ae19ffa03132097c0c0")
588 (revision "1"))
589 (package
590 (name "propeller-load")
591 (version "3.4.0")
592 (source (origin
593 (method git-fetch)
594 (uri (git-reference
595 (url "https://github.com/dbetz/propeller-load.git")
596 (commit commit)))
597 (file-name (string-append name "-" commit "-checkout"))
598 (sha256
599 (base32
600 "1qv3xaapl9fmj3zn58b60sprp4rnvnlpci8ci0pdrzkw6fhvx3pg"))))
601 (build-system gnu-build-system)
602 (arguments
603 `(#:tests? #f ; no tests
604 #:make-flags
605 (list "OS=linux"
606 (string-append "TARGET=" (assoc-ref %outputs "out")))
607 #:phases
608 (modify-phases %standard-phases
609 (delete 'configure))))
610 (native-inputs
611 `(("openspin" ,openspin)
612 ("propeller-toolchain" ,propeller-toolchain)))
613 (home-page "https://github.com/dbetz/propeller-load")
614 (synopsis "Loader for Parallax Propeller micro-controllers")
615 (description "This package provides the tool @code{propeller-load} to
616 upload binaries to a Parallax Propeller micro-controller.")
617 (license license:expat))))
618
619 (define-public spin2cpp
620 (package
621 (name "spin2cpp")
622 (version "3.4.0")
623 (source (origin
624 (method url-fetch)
625 (uri (string-append "https://github.com/totalspectrum/spin2cpp/"
626 "archive/v" version ".tar.gz"))
627 (file-name (string-append name "-" version ".tar.gz"))
628 (sha256
629 (base32
630 "00i8i0dspd5115ggkv5vx2xqb21l6y38wz0bakgby8n3b4k9xnk0"))))
631 (build-system gnu-build-system)
632 (arguments
633 `(#:tests? #f ;; The tests assume that a micro-controller is connected.
634 #:phases
635 (modify-phases %standard-phases
636 (delete 'configure)
637 (add-before 'build 'set-cross-environment-variables
638 (lambda* (#:key inputs #:allow-other-keys)
639 (setenv "CROSS_LIBRARY_PATH"
640 (string-append (assoc-ref inputs "propeller-toolchain")
641 "/propeller-elf/lib"))
642 (setenv "CROSS_C_INCLUDE_PATH"
643 (string-append (assoc-ref inputs "propeller-toolchain")
644 "/propeller-elf/include"))
645 #t))
646 (replace 'install
647 (lambda* (#:key outputs #:allow-other-keys)
648 (let ((bin (string-append (assoc-ref outputs "out")
649 "/bin")))
650 (for-each (lambda (file)
651 (install-file (string-append "build/" file)
652 bin))
653 '("testlex" "spin2cpp" "fastspin")))
654 #t)))))
655 (native-inputs
656 `(("bison" ,bison)
657 ("propeller-load" ,propeller-load)
658 ("propeller-toolchain" ,propeller-toolchain)))
659 (home-page "https://github.com/totalspectrum/spin2cpp")
660 (synopsis "Convert Spin code to C, C++, or PASM code")
661 (description "This is a set of tools for converting the Spin language for
662 the Parallax Propeller micro-controller into C or C++ code, into PASM, or even
663 directly into an executable binary. The binaries produced use LMM PASM, so
664 they are much faster than regular Spin bytecodes (but also quite a bit
665 larger).")
666 (license license:expat)))
667
668 (define-public spinsim
669 (let ((commit "66915a7ad1a3a2cf990a725bb341fab8d11eb620")
670 (revision "1"))
671 (package
672 (name "spinsim")
673 (version (string-append "0.75-" revision "." (string-take commit 9)))
674 (source (origin
675 (method git-fetch)
676 (uri (git-reference
677 (url "https://github.com/parallaxinc/spinsim.git")
678 (commit commit)))
679 (file-name (string-append name "-" commit "-checkout"))
680 (sha256
681 (base32
682 "1n9kdhlxsdx7bz6c80w8dhi96zp633gd6qs0x9i4ii8qv4i7sj5k"))))
683 (build-system gnu-build-system)
684 (arguments
685 `(#:tests? #f ; no tests
686 #:phases
687 (modify-phases %standard-phases
688 (delete 'configure)
689 (replace 'install
690 (lambda* (#:key outputs #:allow-other-keys)
691 (let ((bin (string-append (assoc-ref outputs "out")
692 "/bin")))
693 (install-file "build/spinsim" bin))
694 #t)))))
695 (home-page "https://github.com/parallaxinc/spinsim")
696 (synopsis "Spin simulator")
697 (description "This package provides the tool @code{spinsim}, a simulator
698 and simple debugger for Spin programs written for a Parallax Propeller
699 micro-controller. Spinsim supports execution from cog memory and hub
700 execution, but it does not support multi-tasking. It supports about
701 two-thirds of the opcodes in the P2 instruction set.")
702 (license license:expat))))
703
704 (define-public propeller-development-suite
705 (package
706 (name "propeller-development-suite")
707 (version (package-version propeller-gcc))
708 (source #f)
709 (build-system trivial-build-system)
710 (arguments '(#:builder (mkdir %output)))
711 (propagated-inputs
712 `(("toolchain" ,propeller-toolchain)
713 ("openspin" ,openspin)
714 ("propeller-load" ,propeller-load)
715 ("spin2cpp" ,spin2cpp)
716 ("spinsim" ,spinsim)))
717 (synopsis "Complete development suite for Propeller micro-controllers")
718 (description "This meta-package provides a complete environment for the
719 development with Parallax Propeller micro-controllers. It includes the GCC
720 toolchain, the loader, the Openspin compiler, the Spin2cpp tool, and the Spin
721 simulator.")
722 (home-page (package-home-page propeller-gcc))
723 (license (package-license propeller-gcc))))
724
725 (define-public binutils-vc4
726 (let ((commit "708acc851880dbeda1dd18aca4fd0a95b2573b36"))
727 (package
728 (name "binutils-vc4")
729 (version (string-append "2.23.51-0." (string-take commit 7)))
730 (source (origin
731 (method git-fetch)
732 (uri (git-reference
733 (url "https://github.com/puppeh/binutils-vc4.git")
734 (commit commit)))
735 (sha256
736 (base32
737 "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63"))))
738 (build-system gnu-build-system)
739 (arguments
740 `(#:configure-flags '("--target=vc4-elf"
741 "--disable-werror"
742 "--enable-cgen-maint")
743 #:phases
744 (modify-phases %standard-phases
745 (add-after 'unpack 'unpack-cgen
746 (lambda* (#:key inputs #:allow-other-keys)
747 (copy-recursively (string-append (assoc-ref inputs "cgen")
748 "/cgen") "cgen")
749 #t))
750 (add-after 'unpack-cgen 'fix-cgen-guile
751 (lambda _
752 (substitute* "opcodes/Makefile.in"
753 (("guile\\{,-\\}1.8") "guile"))
754 (zero? (system* "which" "guile")))))))
755 (native-inputs
756 `(("cgen"
757 ,(origin
758 (method git-fetch)
759 (uri (git-reference
760 (url "https://github.com/puppeh/cgen.git")
761 (commit "d8e2a9eb70425f180fdd5bfd032884b0855f2032")))
762 (sha256
763 (base32
764 "14b3h2ji740s8zq5vwm4qdcxs4aa4wxi6wb9di3bv1h39x14nyr9"))))
765 ("texinfo" ,texinfo)
766 ("flex" ,flex)
767 ("bison" ,bison)
768 ("guile-1.8" ,guile-1.8)
769 ("which" ,base:which)))
770 (synopsis "Binutils for VC4")
771 (description "This package provides @code{binutils} for VideoCore IV,
772 the Raspberry Pi chip.")
773 (license license:gpl3+)
774 (home-page "https://github.com/puppeh/vc4-toolchain/"))))