gnu: emacs-svg-icon: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / embedded.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2016, 2017 Theodoros Foradis <theodoros@foradis.org>
4 ;;; Copyright © 2016 David Craven <david@craven.ch>
5 ;;; Copyright © 2017, 2020 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2018, 2019, 2021 Clément Lassieur <clement@lassieur.org>
8 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
9 ;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
10 ;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
11 ;;; Copyright © 2021 Morgan Smith <Morgan.J.Smith@outlook.com>
12 ;;;
13 ;;; This file is part of GNU Guix.
14 ;;;
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
19 ;;;
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
24 ;;;
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
28 (define-module (gnu packages embedded)
29 #:use-module (guix utils)
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix svn-download)
33 #:use-module (guix git-download)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (guix build-system cmake)
36 #:use-module (guix build-system gnu)
37 #:use-module (guix build-system python)
38 #:use-module (guix build-system trivial)
39 #:use-module ((guix build utils) #:select (alist-replace delete-file-recursively))
40 #:use-module (gnu packages)
41 #:use-module (gnu packages admin)
42 #:use-module (gnu packages autotools)
43 #:use-module ((gnu packages base) #:prefix base:)
44 #:use-module (gnu packages bison)
45 #:use-module (gnu packages boost)
46 #:use-module (gnu packages compression)
47 #:use-module (gnu packages cross-base)
48 #:use-module (gnu packages dejagnu)
49 #:use-module (gnu packages flex)
50 #:use-module (gnu packages gcc)
51 #:use-module (gnu packages gdb)
52 #:use-module (gnu packages guile)
53 #:use-module (gnu packages libftdi)
54 #:use-module (gnu packages libusb)
55 #:use-module (gnu packages messaging)
56 #:use-module (gnu packages perl)
57 #:use-module (gnu packages pkg-config)
58 #:use-module (gnu packages python)
59 #:use-module (gnu packages python-crypto)
60 #:use-module (gnu packages python-xyz)
61 #:use-module (gnu packages swig)
62 #:use-module (gnu packages texinfo)
63 #:use-module (gnu packages xorg)
64 #:use-module (srfi srfi-1))
65
66 ;; We must not use the released GCC sources here, because the cross-compiler
67 ;; does not produce working binaries. Instead we take the very same SVN
68 ;; revision from the branch that is used for a release of the "GCC ARM
69 ;; embedded" project on launchpad.
70 ;; See https://launchpadlibrarian.net/218827644/release.txt
71 (define-public gcc-arm-none-eabi-4.9
72 (let ((xgcc (cross-gcc "arm-none-eabi"
73 #:xgcc gcc-4.9
74 #:xbinutils (cross-binutils "arm-none-eabi")))
75 (revision "1")
76 (svn-revision 227977))
77 (package (inherit xgcc)
78 (version (string-append (package-version xgcc) "-"
79 revision "." (number->string svn-revision)))
80 (source
81 (origin
82 (method svn-fetch)
83 (uri (svn-reference
84 (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-4_9-branch/")
85 (revision svn-revision)))
86 (file-name (string-append "gcc-arm-embedded-" version "-checkout"))
87 (sha256
88 (base32
89 "113r98kygy8rrjfv2pd3z6zlfzbj543pq7xyq8bgh72c608mmsbr"))
90
91 ;; Remove the one patch that doesn't apply to this 4.9 snapshot (the
92 ;; patch is for 4.9.4 and later but this svn snapshot is older).
93 (patches (remove (lambda (patch)
94 (string=? (basename patch)
95 "gcc-arm-bug-71399.patch"))
96 (origin-patches (package-source xgcc))))))
97 (native-inputs
98 `(("flex" ,flex)
99 ("gcc@5" ,gcc-5)
100 ,@(package-native-inputs xgcc)))
101 (arguments
102 (substitute-keyword-arguments (package-arguments xgcc)
103 ((#:phases phases)
104 `(modify-phases ,phases
105 (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
106 (lambda* (#:key inputs #:allow-other-keys)
107 (let ((gcc (assoc-ref inputs "gcc")))
108 ;; Remove the default compiler from CPLUS_INCLUDE_PATH to
109 ;; prevent header conflict with the GCC from native-inputs.
110 (setenv "CPLUS_INCLUDE_PATH"
111 (string-join
112 (delete (string-append gcc "/include/c++")
113 (string-split (getenv "CPLUS_INCLUDE_PATH")
114 #\:))
115 ":"))
116 (format #t
117 "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
118 (getenv "CPLUS_INCLUDE_PATH"))
119 #t)))
120 (add-after 'unpack 'fix-genmultilib
121 (lambda _
122 (substitute* "gcc/genmultilib"
123 (("#!/bin/sh") (string-append "#!" (which "sh"))))
124 #t))))
125 ((#:configure-flags flags)
126 ;; The configure flags are largely identical to the flags used by the
127 ;; "GCC ARM embedded" project.
128 `(append (list "--enable-multilib"
129 "--with-newlib"
130 "--with-multilib-list=armv6-m,armv7-m,armv7e-m"
131 "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
132 "--enable-plugins"
133 "--disable-decimal-float"
134 "--disable-libffi"
135 "--disable-libgomp"
136 "--disable-libmudflap"
137 "--disable-libquadmath"
138 "--disable-libssp"
139 "--disable-libstdcxx-pch"
140 "--disable-nls"
141 "--disable-shared"
142 "--disable-threads"
143 "--disable-tls")
144 (delete "--disable-multilib" ,flags)))))
145 (native-search-paths
146 (list (search-path-specification
147 (variable "CROSS_C_INCLUDE_PATH")
148 (files '("arm-none-eabi/include")))
149 (search-path-specification
150 (variable "CROSS_CPLUS_INCLUDE_PATH")
151 (files '("arm-none-eabi/include"
152 "arm-none-eabi/include/c++"
153 "arm-none-eabi/include/c++/arm-none-eabi")))
154 (search-path-specification
155 (variable "CROSS_LIBRARY_PATH")
156 (files '("arm-none-eabi/lib"))))))))
157
158 (define-public gcc-arm-none-eabi-6
159 (package
160 (inherit gcc-arm-none-eabi-4.9)
161 (version (package-version gcc-6))
162 (source (origin (inherit (package-source gcc-6))
163 (patches
164 (append
165 (origin-patches (package-source gcc-6))
166 (search-patches "gcc-6-cross-environment-variables.patch"
167 "gcc-6-arm-none-eabi-multilib.patch")))))))
168
169 (define-public newlib-arm-none-eabi
170 (package
171 (name "newlib")
172 (version "2.4.0")
173 (source (origin
174 (method url-fetch)
175 (uri (string-append "ftp://sourceware.org/pub/newlib/newlib-"
176 version ".tar.gz"))
177 (sha256
178 (base32
179 "01i7qllwicf05vsvh39qj7qp5fdifpvvky0x95hjq39mbqiksnsl"))))
180 (build-system gnu-build-system)
181 (arguments
182 `(#:out-of-source? #t
183 ;; The configure flags are identical to the flags used by the "GCC ARM
184 ;; embedded" project.
185 #:configure-flags '("--target=arm-none-eabi"
186 "--enable-newlib-io-long-long"
187 "--enable-newlib-register-fini"
188 "--disable-newlib-supplied-syscalls"
189 "--disable-nls")
190 #:phases
191 (modify-phases %standard-phases
192 (add-after 'unpack 'fix-references-to-/bin/sh
193 (lambda _
194 (substitute* '("libgloss/arm/cpu-init/Makefile.in"
195 "libgloss/arm/Makefile.in"
196 "libgloss/libnosys/Makefile.in"
197 "libgloss/Makefile.in")
198 (("/bin/sh") (which "sh")))
199 #t)))))
200 (native-inputs
201 `(("xbinutils" ,(cross-binutils "arm-none-eabi"))
202 ("xgcc" ,gcc-arm-none-eabi-4.9)
203 ("texinfo" ,texinfo)))
204 (home-page "https://www.sourceware.org/newlib/")
205 (synopsis "C library for use on embedded systems")
206 (description "Newlib is a C library intended for use on embedded
207 systems. It is a conglomeration of several library parts that are easily
208 usable on embedded products.")
209 (license (license:non-copyleft
210 "https://www.sourceware.org/newlib/COPYING.NEWLIB"))))
211
212 (define-public newlib-nano-arm-none-eabi
213 (package (inherit newlib-arm-none-eabi)
214 (name "newlib-nano")
215 (arguments
216 (substitute-keyword-arguments (package-arguments newlib-arm-none-eabi)
217 ;; The configure flags are identical to the flags used by the "GCC ARM
218 ;; embedded" project. They optimize newlib for use on small embedded
219 ;; systems with limited memory.
220 ((#:configure-flags flags)
221 ''("--target=arm-none-eabi"
222 "--enable-multilib"
223 "--disable-newlib-supplied-syscalls"
224 "--enable-newlib-reent-small"
225 "--disable-newlib-fvwrite-in-streamio"
226 "--disable-newlib-fseek-optimization"
227 "--disable-newlib-wide-orient"
228 "--enable-newlib-nano-malloc"
229 "--disable-newlib-unbuf-stream-opt"
230 "--enable-lite-exit"
231 "--enable-newlib-global-atexit"
232 "--enable-newlib-nano-formatted-io"
233 "--disable-nls"))
234 ((#:phases phases)
235 `(modify-phases ,phases
236 ;; XXX: Most arm toolchains offer both *.a and *_nano.a as newlib
237 ;; and newlib-nano respectively. The headers are usually
238 ;; arm-none-eabi/include/newlib.h for newlib and
239 ;; arm-none-eabi/include/newlib-nano/newlib.h for newlib-nano. We
240 ;; have two different toolchain packages for each which works but
241 ;; is a little strange.
242 (add-after 'install 'hardlink-newlib
243 (lambda* (#:key outputs #:allow-other-keys)
244 (let ((out (assoc-ref outputs "out")))
245 ;; The nano.specs file says that newlib-nano files should end
246 ;; in "_nano.a" instead of just ".a". Note that this applies
247 ;; to all the multilib folders too.
248 (for-each
249 (lambda (file)
250 (link file
251 (string-append
252 ;; Strip ".a" off the end
253 (substring file 0 (- (string-length file) 2))
254 ;; Add "_nano.a" onto the end
255 "_nano.a")))
256 (find-files
257 out
258 "^(libc.a|libg.a|librdimon.a|libstdc\\+\\+.a|libsupc\\+\\+.a)$"))
259
260 ;; newlib.h is usually in this location instead so both
261 ;; newlib and newlib-nano can be in the toolchain at the same
262 ;; time
263 (mkdir (string-append out "/arm-none-eabi/include/newlib-nano"))
264 (symlink
265 "../newlib.h"
266 (string-append out "/arm-none-eabi/include/newlib-nano/newlib.h"))
267 #t)))))))
268 (synopsis "Newlib variant for small systems with limited memory")))
269
270 \f
271 ;;; The following definitions are for the "7-2018-q2-update" variant of the
272 ;;; ARM cross toolchain as offered on https://developer.arm.com
273 (define-public gcc-arm-none-eabi-7-2018-q2-update
274 (let ((xgcc (cross-gcc "arm-none-eabi"
275 #:xgcc gcc-7
276 #:xbinutils (cross-binutils "arm-none-eabi")))
277 (revision "1")
278 (svn-revision 261907))
279 (package (inherit xgcc)
280 (version (string-append "7-2018-q2-update-"
281 revision "." (number->string svn-revision)))
282 (source
283 (origin
284 (method svn-fetch)
285 (uri (svn-reference
286 (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-7-branch/")
287 (revision svn-revision)))
288 (file-name (string-append "gcc-arm-embedded-" version "-checkout"))
289 (sha256
290 (base32
291 "192ggs63bixf3irpijgfkjks73yx1r3a4i6grk1y0i0iny76pmx5"))
292 (patches
293 (append
294 (origin-patches (package-source gcc-7))
295 (search-patches "gcc-7-cross-environment-variables.patch")))))
296 (native-inputs
297 `(("flex" ,flex)
298 ("isl" ,isl-0.18)
299 ,@(alist-delete "isl" (package-native-inputs xgcc))))
300 (arguments
301 (substitute-keyword-arguments (package-arguments xgcc)
302 ((#:phases phases)
303 `(modify-phases ,phases
304 (add-after 'unpack 'expand-version-string
305 (lambda _
306 (make-file-writable "gcc/DEV-PHASE")
307 (with-output-to-file "gcc/DEV-PHASE"
308 (lambda ()
309 (display "7-2018-q2-update")))
310 #t))
311 (add-after 'unpack 'fix-genmultilib
312 (lambda _
313 (substitute* "gcc/genmultilib"
314 (("#!/bin/sh") (string-append "#!" (which "sh"))))
315 #t))
316 (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
317 (lambda* (#:key inputs #:allow-other-keys)
318 (let ((gcc (assoc-ref inputs "gcc")))
319 ;; Remove the default compiler from CPLUS_INCLUDE_PATH to
320 ;; prevent header conflict with the GCC from native-inputs.
321 (setenv "CPLUS_INCLUDE_PATH"
322 (string-join
323 (delete (string-append gcc "/include/c++")
324 (string-split (getenv "CPLUS_INCLUDE_PATH")
325 #\:))
326 ":"))
327 (format #t
328 "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
329 (getenv "CPLUS_INCLUDE_PATH"))
330 #t)))))
331 ((#:configure-flags flags)
332 ;; The configure flags are largely identical to the flags used by the
333 ;; "GCC ARM embedded" project.
334 `(append (list "--enable-multilib"
335 "--with-newlib"
336 "--with-multilib-list=rmprofile"
337 "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
338 "--enable-plugins"
339 "--disable-decimal-float"
340 "--disable-libffi"
341 "--disable-libgomp"
342 "--disable-libmudflap"
343 "--disable-libquadmath"
344 "--disable-libssp"
345 "--disable-libstdcxx-pch"
346 "--disable-nls"
347 "--disable-shared"
348 "--disable-threads"
349 "--disable-tls")
350 (delete "--disable-multilib" ,flags)))))
351 (native-search-paths
352 (list (search-path-specification
353 (variable "CROSS_C_INCLUDE_PATH")
354 (files '("arm-none-eabi/include")))
355 (search-path-specification
356 (variable "CROSS_CPLUS_INCLUDE_PATH")
357 (files '("arm-none-eabi/include"
358 "arm-none-eabi/include/c++"
359 "arm-none-eabi/include/c++/arm-none-eabi")))
360 (search-path-specification
361 (variable "CROSS_LIBRARY_PATH")
362 (files '("arm-none-eabi/lib"))))))))
363
364 (define-public newlib-arm-none-eabi-7-2018-q2-update
365 ;; This is the same commit as used for the 7-2018-q2-update release
366 ;; according to the release.txt.
367 (let ((commit "3ccfb407af410ba7e54ea0da11ae1e40b554a6f4")
368 (revision "0"))
369 (package
370 (inherit newlib-arm-none-eabi)
371 (version (git-version "3.0.0" revision commit))
372 (source
373 (origin
374 (method git-fetch)
375 (uri (git-reference
376 (url "http://sourceware.org/git/newlib-cygwin.git")
377 (commit commit)))
378 (file-name (git-file-name "newlib" commit))
379 (sha256
380 (base32
381 "1dq23fqrk75g1a4v7569fvnnw5q440zawbxi3w0g05n8jlqsmvcy"))))
382 (arguments
383 (substitute-keyword-arguments (package-arguments newlib-arm-none-eabi)
384 ;; The configure flags are identical to the flags used by the "GCC ARM
385 ;; embedded" project.
386 ((#:configure-flags flags)
387 `(cons* "--enable-newlib-io-c99-formats"
388 "--enable-newlib-retargetable-locking"
389 "--with-headers=yes"
390 ,flags))))
391 (native-inputs
392 `(("xbinutils" ,(cross-binutils "arm-none-eabi"))
393 ("xgcc" ,gcc-arm-none-eabi-7-2018-q2-update)
394 ("texinfo" ,texinfo))))))
395
396 (define-public newlib-nano-arm-none-eabi-7-2018-q2-update
397 (package (inherit newlib-arm-none-eabi-7-2018-q2-update)
398 (name "newlib-nano")
399 (arguments
400 (package-arguments newlib-nano-arm-none-eabi))
401 (synopsis "Newlib variant for small systems with limited memory")))
402
403 \f
404 (define (make-libstdc++-arm-none-eabi xgcc newlib)
405 (let ((libstdc++ (make-libstdc++ xgcc)))
406 (package (inherit libstdc++)
407 (name "libstdc++-arm-none-eabi")
408 (arguments
409 (substitute-keyword-arguments (package-arguments libstdc++)
410 ((#:configure-flags flags)
411 ``("--target=arm-none-eabi"
412 "--host=arm-none-eabi"
413 "--disable-libstdcxx-pch"
414 "--enable-multilib"
415 "--with-multilib-list=armv6-m,armv7-m,armv7e-m"
416 "--disable-shared"
417 "--disable-tls"
418 "--disable-plugin"
419 "--with-newlib"
420 ,(string-append "--with-gxx-include-dir="
421 (assoc-ref %outputs "out")
422 "/arm-none-eabi/include/c++")))))
423 (native-inputs
424 `(("newlib" ,newlib)
425 ("xgcc" ,xgcc)
426 ,@(package-native-inputs libstdc++))))))
427
428 (define (arm-none-eabi-toolchain xgcc newlib)
429 "Produce a cross-compiler toolchain package with the compiler XGCC and the C
430 library variant NEWLIB."
431 (let ((newlib-with-xgcc (package (inherit newlib)
432 (native-inputs
433 (alist-replace "xgcc" (list xgcc)
434 (package-native-inputs newlib))))))
435 (package
436 (name (string-append "arm-none-eabi"
437 (if (string=? (package-name newlib-with-xgcc)
438 "newlib-nano")
439 "-nano" "")
440 "-toolchain"))
441 (version (package-version xgcc))
442 (source #f)
443 (build-system trivial-build-system)
444 (arguments
445 '(#:modules ((guix build union))
446 #:builder
447 (begin
448 (use-modules (ice-9 match)
449 (guix build union))
450 (match %build-inputs
451 (((names . directories) ...)
452 (union-build (assoc-ref %outputs "out")
453 directories)
454 #t)))))
455 (propagated-inputs
456 `(("binutils" ,(cross-binutils "arm-none-eabi"))
457 ("libstdc++" ,(make-libstdc++-arm-none-eabi xgcc newlib-with-xgcc))
458 ("gcc" ,xgcc)
459 ("newlib" ,newlib-with-xgcc)))
460 (synopsis "Complete GCC tool chain for ARM bare metal development")
461 (description "This package provides a complete GCC tool chain for ARM
462 bare metal development. This includes the GCC arm-none-eabi cross compiler
463 and newlib (or newlib-nano) as the C library. The supported programming
464 languages are C and C++.")
465 (home-page (package-home-page xgcc))
466 (license (package-license xgcc)))))
467
468 (define-public arm-none-eabi-toolchain-4.9
469 (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9
470 newlib-arm-none-eabi))
471
472 (define-public arm-none-eabi-nano-toolchain-4.9
473 (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9
474 newlib-nano-arm-none-eabi))
475
476 (define-public arm-none-eabi-toolchain-6
477 (arm-none-eabi-toolchain gcc-arm-none-eabi-6
478 newlib-arm-none-eabi))
479
480 (define-public arm-none-eabi-nano-toolchain-6
481 (arm-none-eabi-toolchain gcc-arm-none-eabi-6
482 newlib-nano-arm-none-eabi))
483
484 (define-public arm-none-eabi-toolchain-7-2018-q2-update
485 (arm-none-eabi-toolchain gcc-arm-none-eabi-7-2018-q2-update
486 newlib-arm-none-eabi-7-2018-q2-update))
487
488 (define-public arm-none-eabi-nano-toolchain-7-2018-q2-update
489 (arm-none-eabi-toolchain gcc-arm-none-eabi-7-2018-q2-update
490 newlib-nano-arm-none-eabi-7-2018-q2-update))
491
492 (define-public gdb-arm-none-eabi
493 (package
494 (inherit gdb)
495 (name "gdb-arm-none-eabi")
496 (arguments
497 `(#:configure-flags '("--target=arm-none-eabi"
498 "--enable-multilib"
499 "--enable-interwork"
500 "--enable-languages=c,c++"
501 "--disable-nls")
502 ,@(package-arguments gdb)))))
503
504 (define-public libjaylink
505 (package
506 (name "libjaylink")
507 (version "0.2.0")
508 (source (origin
509 (method git-fetch)
510 (uri (git-reference
511 (url "https://repo.or.cz/libjaylink.git")
512 (commit version)))
513 (file-name (git-file-name name version))
514 (sha256
515 (base32
516 "0ndyfh51hiqyv2yscpj6qd091w7myxxjid3a6rx8f6k233vy826q"))))
517 (build-system gnu-build-system)
518 (native-inputs
519 `(("autoconf" ,autoconf)
520 ("automake" ,automake)
521 ("libtool" ,libtool)
522 ("pkg-config" ,pkg-config)))
523 (inputs
524 `(("libusb" ,libusb)))
525 (home-page "https://repo.or.cz/w/libjaylink.git")
526 (synopsis "Library to interface Segger J-Link devices")
527 (description "libjaylink is a shared library written in C to access
528 SEGGER J-Link and compatible devices.")
529 (license license:gpl2+)))
530
531 (define-public jimtcl
532 (package
533 (name "jimtcl")
534 (version "0.80")
535 (source (origin
536 (method git-fetch)
537 (uri (git-reference
538 (url "https://github.com/msteveb/jimtcl")
539 (commit version)))
540 (file-name (git-file-name name version))
541 (sha256
542 (base32
543 "06rn60cx9sapc175vxvan87b8j5rkhh5gvvz7343xznzwlr0wcgk"))))
544 (build-system gnu-build-system)
545 (arguments
546 `(#:phases
547 (modify-phases %standard-phases
548 (replace 'configure
549 ;; This package doesn't use autoconf.
550 (lambda* (#:key outputs #:allow-other-keys)
551 (let ((out (assoc-ref outputs "out")))
552 (invoke "./configure"
553 (string-append "--prefix=" out)))))
554 (add-before 'check 'delete-failing-tests
555 (lambda _
556 ;; XXX All but 1 TTY tests fail (Inappropriate ioctl for device).
557 (delete-file "tests/tty.test")
558 #t))
559 )))
560 (native-inputs
561 ;; For tests.
562 `(("inetutils" ,inetutils))) ; for hostname
563 (home-page "http://jim.tcl.tk/index.html")
564 (synopsis "Small footprint Tcl implementation")
565 (description "Jim is a small footprint implementation of the Tcl programming
566 language.")
567 (license license:bsd-2)))
568
569 (define-public openocd
570 (let ((commit "9a877a83a1c8b1f105cdc0de46c5cbc4d9e8799e")
571 (revision "0"))
572 (package
573 (name "openocd")
574 (version (string-append "0.10.0-" revision "."
575 (string-take commit 7)))
576 (source (origin
577 (method git-fetch)
578 (uri (git-reference
579 (url "https://git.code.sf.net/p/openocd/code")
580 (commit commit)))
581 (file-name (string-append name "-" version "-checkout"))
582 (sha256
583 (base32
584 "1q536cp80v2bcy6xwk08f1r2ljyw13jchx3a1z7d3ni3vqql7rc6"))))
585 (build-system gnu-build-system)
586 (native-inputs
587 `(("autoconf" ,autoconf)
588 ("automake" ,automake)
589 ("libtool" ,libtool)
590 ("which" ,base:which)
591 ("pkg-config" ,pkg-config)))
592 (inputs
593 `(("hidapi" ,hidapi)
594 ("jimtcl" ,jimtcl)
595 ("libftdi" ,libftdi)
596 ("libjaylink" ,libjaylink)
597 ("libusb-compat" ,libusb-compat)))
598 (arguments
599 '(#:configure-flags
600 (append (list "LIBS=-lutil"
601 "--disable-werror"
602 "--enable-sysfsgpio"
603 "--disable-internal-jimtcl"
604 "--disable-internal-libjaylink")
605 (map (lambda (programmer)
606 (string-append "--enable-" programmer))
607 '("amtjtagaccel" "armjtagew" "buspirate" "ftdi"
608 "gw16012" "jlink" "opendous" "osbdm"
609 "parport" "aice" "cmsis-dap" "dummy" "jtag_vpi"
610 "remote-bitbang" "rlink" "stlink" "ti-icdi" "ulink"
611 "usbprog" "vsllink" "usb-blaster-2" "usb_blaster"
612 "presto" "openjtag")))
613 #:phases
614 (modify-phases %standard-phases
615 (replace 'bootstrap
616 (lambda _
617 (patch-shebang "bootstrap")
618 (invoke "./bootstrap" "nosubmodule")))
619 (add-after 'autoreconf 'change-udev-group
620 (lambda _
621 (substitute* "contrib/60-openocd.rules"
622 (("plugdev") "dialout"))
623 #t))
624 (add-after 'install 'install-udev-rules
625 (lambda* (#:key outputs #:allow-other-keys)
626 (install-file "contrib/60-openocd.rules"
627 (string-append
628 (assoc-ref outputs "out")
629 "/lib/udev/rules.d/"))
630 #t)))))
631 (home-page "http://openocd.org")
632 (synopsis "On-Chip Debugger")
633 (description "OpenOCD provides on-chip programming and debugging support
634 with a layered architecture of JTAG interface and TAP support.")
635 (license license:gpl2+))))
636
637 ;; The commits for all propeller tools are the stable versions published at
638 ;; https://github.com/propellerinc/propgcc in the release_1_0. According to
639 ;; personal correspondence with the developers in July 2017, more recent
640 ;; versions are currently incompatible with the "Simple Libraries".
641
642 (define propeller-binutils
643 (let ((xbinutils (cross-binutils "propeller-elf"))
644 (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
645 (revision "2"))
646 (package
647 (inherit xbinutils)
648 (name "propeller-binutils")
649 (version (string-append "0.0.0-" revision "." (string-take commit 9)))
650 (source (origin (inherit (package-source xbinutils))
651 (method git-fetch)
652 (uri (git-reference
653 (url "https://github.com/parallaxinc/propgcc")
654 (commit commit)))
655 (file-name (string-append name "-" commit "-checkout"))
656 (sha256
657 (base32
658 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
659 (patch-flags (list "-p1" "--directory=binutils"))))
660 (arguments
661 `(;; FIXME: For some reason there are many test failures. It's not
662 ;; obvious how to fix the failures.
663 #:tests? #f
664 #:phases
665 (modify-phases %standard-phases
666 (add-after 'unpack 'chdir
667 (lambda _ (chdir "binutils") #t)))
668 ,@(substitute-keyword-arguments (package-arguments xbinutils)
669 ((#:configure-flags flags)
670 `(cons "--disable-werror" ,flags)))))
671 (native-inputs
672 `(("bison" ,bison)
673 ("flex" ,flex)
674 ("texinfo" ,texinfo)
675 ("dejagnu" ,dejagnu)
676 ,@(package-native-inputs xbinutils))))))
677
678 (define-public propeller-gcc-6
679 (let ((xgcc (cross-gcc "propeller-elf"
680 #:xbinutils propeller-binutils))
681 (commit "b4f45a4725e0b6d0af59e594c4e3e35ca4105867")
682 (revision "1"))
683 (package (inherit xgcc)
684 (name "propeller-gcc")
685 (version (string-append "6.0.0-" revision "." (string-take commit 9)))
686 (source (origin
687 (method git-fetch)
688 (uri (git-reference
689 (url "https://github.com/totalspectrum/gcc-propeller")
690 (commit commit)))
691 (file-name (string-append name "-" commit "-checkout"))
692 (sha256
693 (base32
694 "0d9kdxm2fzanjqa7q5850kzbsfl0fqyaahxn74h6nkxxacwa11zb"))
695 (patches
696 (append
697 (origin-patches (package-source gcc-6))
698 (search-patches "gcc-cross-environment-variables.patch")))))
699 (native-inputs
700 `(("flex" ,flex)
701 ,@(package-native-inputs xgcc)))
702 ;; All headers and cross libraries of the propeller toolchain are
703 ;; installed under the "propeller-elf" prefix.
704 (native-search-paths
705 (list (search-path-specification
706 (variable "CROSS_C_INCLUDE_PATH")
707 (files '("propeller-elf/include")))
708 (search-path-specification
709 (variable "CROSS_LIBRARY_PATH")
710 (files '("propeller-elf/lib")))))
711 (home-page "https://github.com/totalspectrum/gcc-propeller")
712 (synopsis "GCC for the Parallax Propeller"))))
713
714 (define-public propeller-gcc-4
715 (let ((xgcc propeller-gcc-6)
716 (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
717 (revision "2"))
718 (package (inherit xgcc)
719 (name "propeller-gcc")
720 (version (string-append "4.6.1-" revision "." (string-take commit 9)))
721 (source (origin
722 (method git-fetch)
723 (uri (git-reference
724 (url "https://github.com/parallaxinc/propgcc")
725 (commit commit)))
726 (file-name (string-append name "-" commit "-checkout"))
727 (sha256
728 (base32
729 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
730 (patch-flags (list "-p1" "--directory=gcc"))
731 (patches
732 (append
733 (origin-patches (package-source gcc-4.7))
734 (search-patches "gcc-4.6-gnu-inline.patch"
735 "gcc-cross-environment-variables.patch")))))
736 (arguments
737 (substitute-keyword-arguments (package-arguments propeller-gcc-6)
738 ((#:phases phases)
739 `(modify-phases ,phases
740 (add-after 'unpack 'chdir
741 (lambda _ (chdir "gcc") #t))))))
742 (native-inputs
743 `(("gcc-4" ,gcc-4.9)
744 ,@(package-native-inputs propeller-gcc-6)))
745 (home-page "https://github.com/parallaxinc/propgcc")
746 (supported-systems (delete "aarch64-linux" %supported-systems)))))
747
748 ;; Version 6 is experimental and may not work correctly. This is why we
749 ;; default to version 4, which is also used in the binary toolchain bundle
750 ;; provided by Parallax Inc.
751 (define-public propeller-gcc propeller-gcc-4)
752
753
754 ;; FIXME: We do not build the tiny library because that would require C++
755 ;; headers, which are not available. This may require adding a propeller-elf
756 ;; variant of the libstdc++ package.
757 (define-public proplib
758 (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
759 (revision "2"))
760 (package
761 (name "proplib")
762 (version (string-append "0.0.0-" revision "." (string-take commit 9)))
763 (source (origin
764 (method git-fetch)
765 (uri (git-reference
766 (url "https://github.com/parallaxinc/propgcc")
767 (commit commit)))
768 (file-name (string-append name "-" commit "-checkout"))
769 (sha256
770 (base32
771 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
772 (build-system gnu-build-system)
773 (arguments
774 `(#:tests? #f ; no tests
775 #:make-flags
776 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
777 (string-append "BUILD=" (getcwd) "/build"))
778 #:phases
779 (modify-phases %standard-phases
780 (delete 'configure)
781 (add-after 'unpack 'chdir
782 (lambda _ (chdir "lib") #t))
783 (add-after 'chdir 'fix-Makefile
784 (lambda _
785 (substitute* "Makefile"
786 ;; Control the installation time of the headers.
787 ((" install-includes") ""))
788 #t))
789 ;; The Makefile does not separate building from installation, so we
790 ;; have to create the target directories at build time.
791 (add-before 'build 'create-target-directories
792 (lambda* (#:key make-flags #:allow-other-keys)
793 (apply invoke "make" "install-dirs" make-flags)))
794 (add-before 'build 'set-cross-environment-variables
795 (lambda* (#:key outputs #:allow-other-keys)
796 (setenv "CROSS_LIBRARY_PATH"
797 (string-append (assoc-ref outputs "out")
798 "/propeller-elf/lib:"
799 (or (getenv "CROSS_LIBRARY_PATH") "")))
800 (setenv "CROSS_C_INCLUDE_PATH"
801 (string-append (assoc-ref outputs "out")
802 "/propeller-elf/include:"
803 (or (getenv "CROSS_C_INCLUDE_PATH") "")))
804 #t))
805 (add-before 'install 'install-includes
806 (lambda* (#:key make-flags #:allow-other-keys)
807 (apply invoke "make" "install-includes" make-flags))))))
808 (native-inputs
809 `(("propeller-gcc" ,propeller-gcc)
810 ("propeller-binutils" ,propeller-binutils)
811 ("perl" ,perl)))
812 (home-page "https://github.com/parallaxinc/propgcc")
813 (synopsis "C library for the Parallax Propeller")
814 (description "This is a C library for the Parallax Propeller
815 micro-controller.")
816 ;; Most of the code is released under the Expat license. Some of the
817 ;; included code is public domain and some changes are BSD licensed.
818 (license license:expat))))
819
820 (define-public propeller-toolchain
821 (package
822 (name "propeller-toolchain")
823 (version (package-version propeller-gcc))
824 (source #f)
825 (build-system trivial-build-system)
826 (arguments '(#:builder (begin (mkdir %output) #t)))
827 (propagated-inputs
828 `(("binutils" ,propeller-binutils)
829 ("libc" ,proplib)
830 ("gcc" ,propeller-gcc)))
831 (synopsis "Complete GCC tool chain for Propeller micro-controllers")
832 (description "This package provides a complete GCC tool chain for
833 Propeller micro-controller development.")
834 (home-page (package-home-page propeller-gcc))
835 (license (package-license propeller-gcc))))
836
837 (define-public openspin
838 (package
839 (name "openspin")
840 (version "1.00.78")
841 (source (origin
842 (method git-fetch)
843 (uri (git-reference
844 (url "https://github.com/parallaxinc/OpenSpin")
845 (commit version)))
846 (file-name (git-file-name name version))
847 (sha256
848 (base32
849 "0ghk8hj4717ydhqzx2pfs6737s1cxng6sgg2xgbkwvcfclxdbrd0"))))
850 (build-system gnu-build-system)
851 (arguments
852 `(#:tests? #f ; no tests
853 #:phases
854 (modify-phases %standard-phases
855 (delete 'configure)
856 (add-after 'unpack 'remove-timestamp
857 (lambda _
858 (substitute* "SpinSource/openspin.cpp"
859 ((" Compiled on.*$") "\\n\");"))
860 #t))
861 ;; Makefile does not include "install" target
862 (replace 'install
863 (lambda* (#:key outputs #:allow-other-keys)
864 (let ((bin (string-append (assoc-ref outputs "out")
865 "/bin")))
866 (mkdir-p bin)
867 (install-file "build/openspin" bin)
868 #t))))))
869 (home-page "https://github.com/parallaxinc/OpenSpin")
870 (synopsis "Spin/PASM compiler for the Parallax Propeller")
871 (description "OpenSpin is a compiler for the Spin/PASM language of the
872 Parallax Propeller. It was ported from Chip Gracey's original x86 assembler
873 code.")
874 (license license:expat)))
875
876 (define-public propeller-load
877 (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
878 (revision "2"))
879 (package
880 (name "propeller-load")
881 (version "3.4.0")
882 (source (origin
883 (method git-fetch)
884 (uri (git-reference
885 (url "https://github.com/parallaxinc/propgcc")
886 (commit commit)))
887 (file-name (string-append name "-" commit "-checkout"))
888 (sha256
889 (base32
890 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
891 (build-system gnu-build-system)
892 (arguments
893 `(#:tests? #f ; no tests
894 #:make-flags
895 (list "OS=linux"
896 (string-append "TARGET=" (assoc-ref %outputs "out")))
897 #:phases
898 (modify-phases %standard-phases
899 (add-after 'unpack 'chdir
900 (lambda _ (chdir "loader") #t))
901 (delete 'configure))))
902 (native-inputs
903 `(("openspin" ,openspin)
904 ("propeller-toolchain" ,propeller-toolchain)))
905 (home-page "https://github.com/parallaxinc/propgcc")
906 (synopsis "Loader for Parallax Propeller micro-controllers")
907 (description "This package provides the tool @code{propeller-load} to
908 upload binaries to a Parallax Propeller micro-controller.")
909 (license license:expat))))
910
911 (define-public spin2cpp
912 (package
913 (name "spin2cpp")
914 (version "3.6.4")
915 (source (origin
916 (method git-fetch)
917 (uri (git-reference
918 (url "https://github.com/totalspectrum/spin2cpp")
919 (commit (string-append "v" version))))
920 (file-name (git-file-name name version))
921 (sha256
922 (base32
923 "0wznqvsckzzz4hdy2rpvj6jqpxw4yn7i0c7zxfm6i46k8gg9327b"))))
924 (build-system gnu-build-system)
925 (arguments
926 `(#:tests? #f ;; The tests assume that a micro-controller is connected.
927 #:phases
928 (modify-phases %standard-phases
929 (delete 'configure)
930 (add-before 'build 'set-cross-environment-variables
931 (lambda* (#:key inputs #:allow-other-keys)
932 (setenv "CROSS_LIBRARY_PATH"
933 (string-append (assoc-ref inputs "propeller-toolchain")
934 "/propeller-elf/lib"))
935 (setenv "CROSS_C_INCLUDE_PATH"
936 (string-append (assoc-ref inputs "propeller-toolchain")
937 "/propeller-elf/include"))
938 #t))
939 (replace 'install
940 (lambda* (#:key outputs #:allow-other-keys)
941 (let ((bin (string-append (assoc-ref outputs "out")
942 "/bin")))
943 (for-each (lambda (file)
944 (install-file (string-append "build/" file)
945 bin))
946 '("testlex" "spin2cpp" "fastspin")))
947 #t)))))
948 (native-inputs
949 `(("bison" ,bison)
950 ("propeller-load" ,propeller-load)
951 ("propeller-toolchain" ,propeller-toolchain)))
952 (home-page "https://github.com/totalspectrum/spin2cpp")
953 (synopsis "Convert Spin code to C, C++, or PASM code")
954 (description "This is a set of tools for converting the Spin language for
955 the Parallax Propeller micro-controller into C or C++ code, into PASM, or even
956 directly into an executable binary. The binaries produced use LMM PASM, so
957 they are much faster than regular Spin bytecodes (but also quite a bit
958 larger).")
959 (license license:expat)))
960
961 (define-public spinsim
962 (let ((commit "66915a7ad1a3a2cf990a725bb341fab8d11eb620")
963 (revision "1"))
964 (package
965 (name "spinsim")
966 (version (string-append "0.75-" revision "." (string-take commit 9)))
967 (source (origin
968 (method git-fetch)
969 (uri (git-reference
970 (url "https://github.com/parallaxinc/spinsim")
971 (commit commit)))
972 (file-name (string-append name "-" commit "-checkout"))
973 (sha256
974 (base32
975 "1n9kdhlxsdx7bz6c80w8dhi96zp633gd6qs0x9i4ii8qv4i7sj5k"))))
976 (build-system gnu-build-system)
977 (arguments
978 `(#:tests? #f ; no tests
979 #:phases
980 (modify-phases %standard-phases
981 (delete 'configure)
982 (replace 'install
983 (lambda* (#:key outputs #:allow-other-keys)
984 (let ((bin (string-append (assoc-ref outputs "out")
985 "/bin")))
986 (install-file "build/spinsim" bin))
987 #t)))))
988 (home-page "https://github.com/parallaxinc/spinsim")
989 (synopsis "Spin simulator")
990 (description "This package provides the tool @code{spinsim}, a simulator
991 and simple debugger for Spin programs written for a Parallax Propeller
992 micro-controller. Spinsim supports execution from cog memory and hub
993 execution, but it does not support multi-tasking. It supports about
994 two-thirds of the opcodes in the P2 instruction set.")
995 (license license:expat))))
996
997 (define-public propeller-development-suite
998 (package
999 (name "propeller-development-suite")
1000 (version (package-version propeller-gcc))
1001 (source #f)
1002 (build-system trivial-build-system)
1003 (arguments '(#:builder (begin (mkdir %output) #t)))
1004 (propagated-inputs
1005 `(("toolchain" ,propeller-toolchain)
1006 ("openspin" ,openspin)
1007 ("propeller-load" ,propeller-load)
1008 ("spin2cpp" ,spin2cpp)
1009 ("spinsim" ,spinsim)))
1010 (synopsis "Complete development suite for Propeller micro-controllers")
1011 (description "This meta-package provides a complete environment for the
1012 development with Parallax Propeller micro-controllers. It includes the GCC
1013 toolchain, the loader, the Openspin compiler, the Spin2cpp tool, and the Spin
1014 simulator.")
1015 (home-page (package-home-page propeller-gcc))
1016 (license (package-license propeller-gcc))))
1017
1018 (define-public binutils-vc4
1019 (let ((commit "708acc851880dbeda1dd18aca4fd0a95b2573b36"))
1020 (package
1021 (name "binutils-vc4")
1022 (version (string-append "2.23.51-0." (string-take commit 7)))
1023 (source (origin
1024 (method git-fetch)
1025 (uri (git-reference
1026 (url "https://github.com/puppeh/binutils-vc4")
1027 (commit commit)))
1028 (file-name (string-append name "-" version "-checkout"))
1029 (sha256
1030 (base32
1031 "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63"))))
1032 (build-system gnu-build-system)
1033 (arguments
1034 `(#:configure-flags '("--target=vc4-elf"
1035 "--disable-werror"
1036 "--enable-cgen-maint")
1037 #:phases
1038 (modify-phases %standard-phases
1039 (add-after 'unpack 'unpack-cgen
1040 (lambda* (#:key inputs #:allow-other-keys)
1041 (copy-recursively (string-append (assoc-ref inputs "cgen")
1042 "/cgen") "cgen")
1043 #t))
1044 (add-after 'unpack-cgen 'fix-cgen-guile
1045 (lambda _
1046 (substitute* "opcodes/Makefile.in"
1047 (("guile\\{,-\\}1.8") "guile"))
1048 (invoke "which" "guile"))))))
1049 (native-inputs
1050 `(("cgen"
1051 ,(origin
1052 (method git-fetch)
1053 (uri (git-reference
1054 (url "https://github.com/puppeh/cgen")
1055 (commit "d8e2a9eb70425f180fdd5bfd032884b0855f2032")))
1056 (sha256
1057 (base32
1058 "14b3h2ji740s8zq5vwm4qdcxs4aa4wxi6wb9di3bv1h39x14nyr9"))))
1059 ("texinfo" ,texinfo)
1060 ("flex" ,flex)
1061 ("bison" ,bison)
1062 ("guile-1.8" ,guile-1.8)
1063 ("which" ,base:which)))
1064 (synopsis "Binutils for VC4")
1065 (description "This package provides @code{binutils} for VideoCore IV,
1066 the Raspberry Pi chip.")
1067 (license license:gpl3+)
1068 (home-page "https://github.com/puppeh/vc4-toolchain/"))))
1069
1070 (define-public gcc-vc4
1071 (let ((commit "0fe4b83897341742f9df65797474cb0feab4b377")
1072 (xgcc (cross-gcc "vc4-elf" #:xgcc gcc-6 #:xbinutils binutils-vc4)))
1073 (package (inherit xgcc)
1074 (name "gcc-vc4")
1075 (source (origin
1076 (method git-fetch)
1077 (uri (git-reference
1078 (url "https://github.com/puppeh/gcc-vc4")
1079 (commit commit)))
1080 (file-name (string-append name
1081 "-"
1082 (package-version xgcc)
1083 "-checkout"))
1084 (sha256
1085 (base32
1086 "0kvaq4s0assvinmmicwqp07d0wwldcw0fv6f4k13whp3q5909jnr"))
1087 (patches
1088 (search-patches "gcc-6-fix-buffer-size.patch"
1089 "gcc-6-fix-isl-includes.patch"))))
1090 (native-inputs
1091 `(("flex" ,flex)
1092 ,@(package-native-inputs xgcc)))
1093 (synopsis "GCC for VC4")
1094 (description "This package provides @code{gcc} for VideoCore IV,
1095 the Raspberry Pi chip."))))
1096
1097 (define-public python-libmpsse
1098 (package
1099 (name "python-libmpsse")
1100 (version "1.4.1")
1101 (source
1102 (origin
1103 (method git-fetch)
1104 (uri (git-reference
1105 (url "https://github.com/daym/libmpsse")
1106 (commit (string-append "v" version))))
1107 (file-name "libmpsse-checkout")
1108 (sha256
1109 (base32
1110 "1rypfb96k2szqgygp3jnwg2zq9kwmfz0460dsahn3r2vkzml8wn7"))))
1111 (build-system gnu-build-system)
1112 (inputs
1113 `(("libftdi" ,libftdi)
1114 ("python" ,python)))
1115 (native-inputs
1116 `(("pkg-config" ,pkg-config)
1117 ("swig" ,swig)
1118 ("which" ,base:which)))
1119 (arguments
1120 `(#:tests? #f ; No tests exist.
1121 #:parallel-build? #f ; Would be buggy.
1122 #:make-flags
1123 (list (string-append "CFLAGS=-Wall -fPIC -fno-strict-aliasing -g -O2 "
1124 "$(shell pkg-config --cflags libftdi1)"))
1125 #:phases
1126 (modify-phases %standard-phases
1127 (add-after 'unpack 'set-environment-up
1128 (lambda* (#:key inputs outputs #:allow-other-keys)
1129 (let ((python (assoc-ref inputs "python")))
1130 (chdir "src")
1131 (setenv "PYDEV" (string-append python
1132 "/include/python"
1133 ,(version-major+minor (package-version python))))
1134 #t)))
1135 (replace 'install
1136 (lambda* (#:key inputs outputs make-flags #:allow-other-keys #:rest args)
1137 (let* ((out (assoc-ref outputs "out"))
1138 (out-python (string-append out
1139 "/lib/python"
1140 ,(version-major+minor (package-version python))
1141 "/site-packages"))
1142 (install (assoc-ref %standard-phases 'install)))
1143 (install #:make-flags (cons (string-append "PYLIB=" out-python)
1144 make-flags))))))))
1145 (home-page "https://code.google.com/archive/p/libmpsse/")
1146 (synopsis "Python library for MPSSE SPI I2C JTAG adapter by FTDI")
1147 (description "This package provides a library in order to support the
1148 MPSSE (Multi-Protocol Synchronous Serial Engine) adapter by FTDI that can do
1149 SPI, I2C, JTAG.")
1150 (license license:gpl2+)))
1151
1152 (define-public python2-libmpsse
1153 (package
1154 (inherit python-libmpsse)
1155 (name "python2-libmpsse")
1156 (arguments
1157 (substitute-keyword-arguments (package-arguments python-libmpsse)
1158 ((#:phases phases)
1159 `(modify-phases ,phases
1160 (replace 'set-environment-up
1161 (lambda* (#:key inputs outputs #:allow-other-keys)
1162 (let ((python (assoc-ref inputs "python")))
1163 (chdir "src")
1164 (setenv "PYDEV" (string-append python
1165 "/include/python"
1166 ,(version-major+minor (package-version python-2))))
1167 #t)))
1168 (replace 'install
1169 (lambda* (#:key inputs outputs make-flags #:allow-other-keys #:rest args)
1170 (let* ((out (assoc-ref outputs "out"))
1171 (out-python (string-append out
1172 "/lib/python"
1173 ,(version-major+minor (package-version python-2))
1174 "/site-packages"))
1175 (install (assoc-ref %standard-phases 'install)))
1176 (install #:make-flags (cons (string-append "PYLIB=" out-python)
1177 make-flags)))))))))
1178 (inputs
1179 (alist-replace "python" (list python-2)
1180 (package-inputs python-libmpsse)))))
1181
1182 (define-public picprog
1183 (package
1184 (name "picprog")
1185 (version "1.9.1")
1186 (source (origin
1187 (method url-fetch)
1188 (uri (string-append "http://www.iki.fi/hyvatti/pic/picprog-"
1189 version ".tar.gz"))
1190 (file-name (string-append name "-" version ".tar.gz"))
1191 (sha256
1192 (base32
1193 "1r04hg1n3v2jf915qr05la3q9cxy7a5jnh9cc98j04lh6c9p4x85"))
1194 (patches (search-patches "picprog-non-intel-support.patch"))))
1195 (build-system gnu-build-system)
1196 (arguments
1197 `(#:tests? #f ; No tests exist.
1198 #:phases
1199 (modify-phases %standard-phases
1200 (add-after 'unpack 'patch-paths
1201 (lambda* (#:key outputs #:allow-other-keys)
1202 (substitute* "Makefile"
1203 (("/usr/local") (assoc-ref outputs "out"))
1204 ((" -o 0 -g 0 ") " ")
1205 (("testport") ""))
1206 #t))
1207 (add-before 'install 'mkdir
1208 (lambda* (#:key outputs #:allow-other-keys)
1209 (let ((out (assoc-ref outputs "out")))
1210 (mkdir-p (string-append out "/bin"))
1211 (mkdir-p (string-append out "/man/man1"))
1212 #t)))
1213 (delete 'configure))))
1214 (synopsis "Programs Microchip's PIC microcontrollers")
1215 (description "This program programs Microchip's PIC microcontrollers.")
1216 (home-page "https://hyvatti.iki.fi/~jaakko/pic/picprog.html")
1217 (license license:gpl3+)))
1218
1219 (define-public fc-host-tools
1220 (package
1221 (name "fc-host-tools")
1222 (version "14")
1223 (source (origin
1224 (method url-fetch)
1225 (uri (string-append "ftp://ftp.freecalypso.org/pub/GSM/"
1226 "FreeCalypso/fc-host-tools-r" version ".tar.bz2"))
1227 (sha256
1228 (base32
1229 "09ccd76khfvlx4dwi9dhrzl5mm68402mlych0g7f9ncfr5jzyf26"))))
1230 (build-system gnu-build-system)
1231 (arguments
1232 `(#:tests? #f ; No tests exist.
1233 #:make-flags
1234 (list (string-append "INSTALL_PREFIX=" %output)
1235 (string-append "INCLUDE_INSTALL_DIR=" %output "include/rvinterf"))
1236 #:phases
1237 (modify-phases %standard-phases
1238 (add-after 'unpack 'patch-installation-paths
1239 (lambda* (#:key outputs #:allow-other-keys)
1240 (substitute* '("Makefile"
1241 "rvinterf/etmsync/fsiomain.c"
1242 "rvinterf/etmsync/fsnew.c"
1243 "rvinterf/asyncshell/help.c"
1244 "rvinterf/libinterf/launchrvif.c"
1245 "loadtools/defpath.c"
1246 "loadtools/Makefile"
1247 "miscutil/c139explore"
1248 "miscutil/pirexplore"
1249 "ffstools/tiffs-wrappers/installpath.c"
1250 "uptools/atcmd/atinterf.c")
1251 (("/opt/freecalypso/loadtools")
1252 (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
1253 (("\\$\\{INSTALL_PREFIX\\}/loadtools")
1254 (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
1255 (("\\$\\{INSTALL_PREFIX\\}/target-bin")
1256 (string-append (assoc-ref outputs "out") "/lib/freecalypso/target-bin"))
1257 (("/opt/freecalypso")
1258 (assoc-ref outputs "out")))
1259 #t))
1260 (delete 'configure))))
1261 (inputs
1262 `(("libx11" ,libx11)))
1263 (synopsis "Freecalypso host tools")
1264 (description "This package provides some tools for debugging FreeCalypso phones and the FreeCalypso FCDEV3B dev board.
1265
1266 @enumerate
1267 @item fc-e1decode: Decodes a binary Melody E1 file into an ASCII source file.
1268 @item fc-e1gen: Encodes an ASCII Melody E1 file into a binary Melody E1 file.
1269 @item fc-fr2tch: Converts a GSM 06.10 speech recording from libgsm to hex
1270 strings of TCH bits to be fed to the GSM 05.03 channel encoder of a TI
1271 Calypso GSM device.
1272 @item fc-tch2fr: Converts hex strings of TCH bits to libgsm.
1273 @item fc-gsm2vm: utility converts a GSM 06.10 speech sample from the libgsm
1274 source format into a voice memo file that can be uploaded into the FFS of a
1275 FreeCalypso device and played with the audio_vm_play_start() API or the
1276 AT@@VMP command that invokes the latter.
1277 @item fc-rgbconv: Convers RGB 5:6:5 to RGB 8:8:8 and vice versa.
1278 @item rvinterf: Communicates with a TI Calypso GSM device via RVTMUX.
1279 @item rvtdump: produces a human-readable dump of all output emitted by a
1280 TI-based GSM fw on the RVTMUX binary packet interface.
1281 @item fc-shell: FreeCalypso firmwares have a feature of our own invention
1282 (not present in any pre-existing ones) to accept AT commands over the RVTMUX
1283 interface. It is useful when no second UART is available for a dedicated
1284 standard AT command interface. fc-shell is the tool that allows you to send
1285 AT commands to the firmware in this manner.
1286 @item fc-memdump: Captures a memory dump from a GSM device.
1287 @item fc-serterm: Trivial serial terminal. Escapes binary chars.
1288 @item fc-fsio: Going through rvinterf, this tool connects to GSM devices and
1289 allows you to manipulate the device's flash file system.
1290 @item tiaud-compile: Compiles an audio mode configuration table for TI's
1291 Audio Service from our own ASCII source format into the binary format for
1292 uploading into FreeCalypso GSM device FFS with fc-fsio.
1293 @item tiaud-decomp: Decodes TI's audio mode configuration files read out of
1294 FFS into our own ASCII format.
1295 @item tiaud-mkvol: Generates the *.vol binary files which need to accompany
1296 the main *.cfg ones.
1297 @item fc-compalram: Allows running programs on the device without writing
1298 them to flash storage.
1299 @item fc-xram: Allows running programs on the device without writing them
1300 to flash storage.
1301 @item fc-iram: Allows running programs on the device without writing them
1302 to flash storage.
1303 @item fc-loadtool: Writes programs to the device's flash storage.
1304 @item pirffs: Allows listing and extracting FFS content captured as a raw
1305 flash image from Pirelli phones.
1306 @item mokoffs: Allows listing and extracting FFS content captured as a raw
1307 flash image from OpenMoko phones.
1308 @item tiffs: Allows listing and extracting FFS content captured as a raw
1309 flash image from TI phones.
1310 @item c139explore: Run-from-RAM program for C139 phones that
1311 exercises their peripheral hardware: LCD, keypad backlight, buzzer, vibrator.
1312 @item pirexplore: Run-from-RAM program for Pirelli DP-L10 phones that
1313 exercises their peripheral hardware, primarily their LCD.
1314 @item tfc139: Breaks into Mot C1xx phones via shellcode injection, allowing
1315 you to reflash locked phones with new firmware with fc-loadtool.
1316 @item ctracedec: GSM firmwares built in TI's Windows environment have a
1317 compressed trace misfeature whereby many of the ASCII strings
1318 in debug trace messages get replaced with numeric indices at
1319 build time, and these numeric indices are all that gets emitted
1320 on the RVTMUX serial channel. This tools decodes these numeric indices
1321 back to strings in trace output.
1322 @item fc-cal2text: This utility takes a dump of TI's /gsm/rf flash file system
1323 directory subtree as input (either extracted in vitro with tiffs
1324 or read out in vivo with fc-fsio) and converts all RF tables
1325 found therein into a readable ASCII format.
1326 @item imei-luhn: Computes or verifies the Luhn check digit of an IMEI number.
1327 @item fc-dspapidump: Reads and dumps the contents of the DSP API RAM in a
1328 target Calypso GSM device.
1329 @item fc-vm2hex: Converts the old-fashioned (non-AMR) voice memo files read
1330 out of FFS into hex strings.
1331 @item fc-buzplay: Plays piezoelectic buzzer melodies on an actual
1332 Calypso device equipped with such a buzzer (Mot C1xx, TI's D-Sample board,
1333 our planned future HSMBP) by loading a buzplayer agent onto the target and
1334 feeding melodies to be played to it.
1335 @item fc-tmsh: TI-based GSM firmwares provide a rich set of Test Mode commands
1336 that can be issued through the RVTMUX (debug trace) serial channel.
1337 This program is our test mode shell for sending Test Mode commands to targets
1338 and displaying decoded target responses.
1339 @item fcup-smsend: Send a short message via SMS
1340 @item fcup-smsendmult: Send multiple short messages via SMS in one go
1341 @item fcup-smsendpdu: Send multiple short messages given in PDU format via SMS
1342 @item sms-pdu-decode: Decode PDU format messages
1343 @item fc-dspromdump: Dump DSP ROM.
1344 @item pcm-sms-decode: Decode /pcm/SMS binary files read out of FFS maintained
1345 by Pirelli DP-L10. Display the SMS in human-readable form.
1346 @item srec-regions: Parse S-record (TI's *.m0), identify the set of
1347 discontiguous regions into which this SREC image deposits bits, and list
1348 these identified regions.
1349 @end enumerate")
1350 (home-page "https://www.freecalypso.org/")
1351 (license license:public-domain)))
1352
1353 (define-public stlink
1354 (package
1355 (name "stlink")
1356 (version "1.5.1")
1357 (source
1358 (origin
1359 (method git-fetch)
1360 (uri (git-reference
1361 (url "https://github.com/texane/stlink")
1362 (commit (string-append "v" version))))
1363 (file-name (git-file-name name version))
1364 (sha256
1365 (base32
1366 "1d5gxiqpsm8fc105cxlp27af9fk339fap5h6nay21x5a7n61jgyc"))))
1367 (build-system cmake-build-system)
1368 (arguments
1369 `(#:tests? #f ;no tests
1370 #:configure-flags
1371 (let* ((out (assoc-ref %outputs "out"))
1372 (etc (in-vicinity out "etc"))
1373 (modprobe (in-vicinity etc "modprobe.d"))
1374 (udev-rules (in-vicinity etc "udev/rules.d")))
1375 (list (string-append "-DSTLINK_UDEV_RULES_DIR=" udev-rules)
1376 (string-append "-DSTLINK_MODPROBED_DIR=" modprobe)))))
1377 (inputs
1378 `(("libusb" ,libusb)))
1379 (synopsis "Programmer for STM32 Discovery boards")
1380 (description "This package provides a firmware programmer for the STM32
1381 Discovery boards. It supports two versions of the chip: ST-LINK/V1 (on
1382 STM32VL discovery kits) and ST-LINK/V2 (on STM32L discovery and later kits).
1383 Two different transport layers are used: ST-LINK/V1 uses SCSI passthru
1384 commands over USB, and ST-LINK/V2 and ST-LINK/V2-1 (seen on Nucleo boards) use
1385 raw USB commands.")
1386 (home-page "https://github.com/texane/stlink")
1387 ;; The flashloaders/stm32l0x.s and flashloaders/stm32lx.s source files are
1388 ;; licensed under the GPLv2+.
1389 (license (list license:bsd-3 license:gpl2+))))
1390
1391 (define-public west
1392 (package
1393 (name "west")
1394 (version "0.6.3")
1395 (source
1396 (origin
1397 (method url-fetch)
1398 (uri (pypi-uri "west" version))
1399 (sha256
1400 (base32
1401 "0ql6ij1hrj2ir5wkxm96zgig5qwvfwa75w77wh2y13w6b9cqcr4b"))))
1402 (propagated-inputs
1403 `(("python-colorama" ,python-colorama)
1404 ("python-configobj" ,python-configobj)
1405 ("python-pykwalify" ,python-pykwalify)
1406 ("python-pyyaml" ,python-pyyaml)))
1407 (build-system python-build-system)
1408 (home-page "https://github.com/zephyrproject-rtos/west")
1409 (synopsis "Zephyr RTOS Project meta-tool")
1410 (description "West is the swiss-army knife command line tool of the Zephyr
1411 project. Its built-in commands provide a multiple repository management
1412 system with features inspired by Google’s Repo tool and Git submodules. West
1413 simplifies configuration and is also pluggable: you can write your own west
1414 \"extension commands\" which add additional features to west. Zephyr uses
1415 this feature to provide conveniences for building applications, flashing and
1416 debugging them, and more.")
1417 (license license:expat)))
1418
1419 (define-public ebusd
1420 (package
1421 (name "ebusd")
1422 (version "3.4")
1423 (source (origin
1424 (method git-fetch)
1425 (uri (git-reference
1426 (url "https://github.com/john30/ebusd")
1427 (commit (string-append "v" version))))
1428 (file-name (string-append name "-" version "-checkout"))
1429 (sha256
1430 (base32
1431 "0iva70bam7wdx60bpd3an9kxr28zxlvp3vprivgqshwwdhqa0hzp"))))
1432 (build-system gnu-build-system)
1433 (arguments
1434 `(#:phases
1435 (modify-phases %standard-phases
1436 (add-after 'install 'install-config
1437 (lambda* (#:key inputs outputs #:allow-other-keys)
1438 (let ((config-destination
1439 (string-append (assoc-ref outputs "out")
1440 "/share/ebusd")))
1441 (copy-recursively (string-append (assoc-ref inputs "config")
1442 "/ebusd-2.1.x")
1443 config-destination)
1444 #t))))))
1445 (inputs
1446 `(("mosquitto" ,mosquitto)))
1447 (native-inputs
1448 `(("automake" ,automake)
1449 ("autoconf" ,autoconf)
1450 ("config"
1451 ,(origin
1452 (method git-fetch)
1453 (uri (git-reference
1454 (url "https://github.com/john30/ebusd-configuration")
1455 (commit "666c0f6b9c4d7545eff7f43ab28a1c7baeab7913")))
1456 (file-name "config-checkout")
1457 (sha256
1458 (base32
1459 "0yxnx8p4lbk614l16854r9s9d8s9c7ixgczfs8mph94xz0wkda7x"))))))
1460 (synopsis "Daemon for communicating with eBUS devices")
1461 (description "This package provides @command{ebusd}, a daemon for
1462 handling communication with eBUS devices connected to a 2-wire bus system
1463 (\"energy bus\" used by numerous heating systems).")
1464 (home-page "https://ebusd.eu/")
1465 (license license:gpl3+)))
1466
1467 (define-public ucsim
1468 (package
1469 (name "ucsim")
1470 (version "0.6-pre67")
1471 (source (origin
1472 (method url-fetch)
1473 (uri (string-append
1474 "http://mazsola.iit.uni-miskolc.hu/ucsim/download/unix/"
1475 "devel/ucsim-" version ".tar.gz"))
1476 (sha256
1477 (base32
1478 "0aahj9pbfjphjrm4hgs9pfmp6d5aikaq4yvxlrvhywjinnnf0qp1"))))
1479 (build-system gnu-build-system)
1480 (arguments
1481 `(#:configure-flags '("--enable-avr-port"
1482 "--enable-m6809-port"
1483 "--enable-p1516-port"
1484 "--enable-st7-port")
1485 #:phases
1486 (modify-phases %standard-phases
1487 (add-after 'unpack 'patch-makefiles
1488 (lambda _
1489 (substitute* (find-files "." "(\\.mk$|\\.in$)")
1490 (("/bin/sh") (which "sh")))
1491 #t))
1492 (add-after 'install 'remove-empty-directory
1493 (lambda* (#:key outputs #:allow-other-keys)
1494 (delete-file-recursively
1495 (string-append (assoc-ref outputs "out") "/share/man"))
1496 #t)))))
1497 (native-inputs
1498 `(("bison" ,bison)
1499 ("flex" ,flex)))
1500 (home-page "http://mazsola.iit.uni-miskolc.hu/ucsim/")
1501 (synopsis "Simulators for various microcontroller families")
1502 (description "μCsim is a collection of software simulators for
1503 microcontrollers in the Atmel AVR; Intel MCS-51 (8051); Motorola 68HC08 and
1504 6809; P1516; Padauk PDK13, PDK14 and PDK15; STMicroelectronics ST7 and STM8;
1505 and Zilog Z80 families, plus many of their variants.")
1506 (license license:gpl2+)))
1507
1508 (define-public sdcc
1509 (package
1510 (name "sdcc")
1511 (version "4.1.0")
1512 (source (origin
1513 (method url-fetch)
1514 (uri (string-append
1515 "mirror://sourceforge/sdcc/sdcc"
1516 "/" version "/sdcc-src-" version ".tar.bz2"))
1517 (sha256
1518 (base32
1519 "0gskzli17ghnn5qllvn4d56qf9bvvclqjh63nnj63p52smvggvc1"))
1520 (modules '((guix build utils)))
1521 (snippet
1522 '(begin
1523 ;; Remove non-free source files
1524 (delete-file-recursively "device/non-free")
1525 ;; Remove bundled μCsim source
1526 (delete-file-recursively "sim")
1527 #t))
1528 (patches (search-patches "sdcc-disable-non-free-code.patch"))))
1529 (build-system gnu-build-system)
1530 (native-inputs
1531 `(("bison" ,bison)
1532 ("boost" ,boost)
1533 ("flex" ,flex)
1534 ("python-2" ,python-2)
1535 ("texinfo" ,texinfo)
1536 ("zlib" ,zlib)))
1537 (arguments
1538 `(;; GPUTILS is required for the PIC ports, but the licensing status of
1539 ;; some of the files contained in its distribution is unclear (see
1540 ;; https://issues.guix.gnu.org/44557). For this reason it is not yet
1541 ;; available as a package in Guix.
1542 #:configure-flags
1543 '("--disable-pic14-port" "--disable-pic16-port" "--disable-ucsim")
1544 #:phases
1545 (modify-phases %standard-phases
1546 (add-after 'unpack 'patch-makefiles
1547 (lambda _
1548 (substitute* (find-files "." "(\\.mk$|\\.in$)")
1549 (("/bin/sh") (which "sh")))
1550 #t)))))
1551 (home-page "http://sdcc.sourceforge.net")
1552 (synopsis "C compiler suite for 8-bit microcontrollers")
1553 (description "SDCC is a retargetable, optimizing Standard C compiler suite
1554 that targets 8-bit microcontrollers in the Intel MCS-51 (8051); Motorola
1555 68HC08; Padauk PDK13, PDK14 and PDK15; STMicroelectronics STM8; and Zilog Z80
1556 families, plus many of their variants.")
1557 (license (list license:gpl2+
1558 license:gpl3+
1559 license:lgpl2.0+
1560 license:lgpl2.1+
1561 license:lgpl3+
1562 license:public-domain
1563 license:zlib))))
1564
1565 (define-public python-psptool
1566 (package
1567 (name "python-psptool")
1568 (version "2.2")
1569 (source (origin
1570 (method url-fetch)
1571 (uri (pypi-uri "psptool" version))
1572 (sha256
1573 (base32
1574 "1kx0xpfx67m4zclk4gs97wiwjms8i7z4f6b6m68y8sfgpshy4rf3"))
1575 (modules '((guix build utils)))
1576 (snippet
1577 '(begin
1578 ;; IPython is not used by the package at all
1579 (substitute* '("psptool/directory.py" "psptool/entry.py")
1580 (("from IPython.*") ""))))))
1581 (build-system python-build-system)
1582 (propagated-inputs
1583 `(("python-cryptography" ,python-cryptography)
1584 ("python-prettytable" ,python-prettytable)))
1585 (home-page "https://github.com/PSPReverse/psptool")
1586 (synopsis "Tool for dealing with AMD binary blobs")
1587 (description "PSPTool is a tool for dealing with AMD binary blobs")
1588 (license license:gpl3+)))
1589
1590 (define-public agent-proxy
1591 (let ((commit "8927798a71d246871ea8fc22b4512296a3fa1765")
1592 (revision "0"))
1593 (package
1594 (name "agent-proxy")
1595 (version (git-version "1.98" revision commit))
1596 (home-page
1597 "https://git.kernel.org/pub/scm/utils/kernel/kgdb/agent-proxy.git")
1598 (source (origin
1599 (method git-fetch)
1600 (uri (git-reference (url home-page) (commit commit)))
1601 (file-name (git-file-name name version))
1602 (sha256
1603 (base32
1604 "1bxkzwsqfld4pknmiq8j3k55pv90n8s6kzh0xh42bhy2jv1wxz2z"))))
1605 (build-system gnu-build-system)
1606 (arguments
1607 `(#:tests? #f
1608 #:phases
1609 (modify-phases %standard-phases
1610 (delete 'configure)
1611 (add-after 'build 'build-kdmx
1612 (lambda _
1613 (invoke "make" "-C" "kdmx")
1614 #t))
1615 (replace 'install
1616 (lambda* (#:key outputs #:allow-other-keys)
1617 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
1618 (install-file "agent-proxy" bin)
1619 (install-file "kdmx/kdmx" bin)
1620 #t))))))
1621 (synopsis "Proxies to run kgdb/gdbserver and console on a serial port")
1622 (description "These programs are proxies allowing to run kgdb/gdbserver
1623 and console on a single serial port. agent-proxy creates network sockets,
1624 whereas kdmx creates pseudo-ttys.")
1625 (license license:gpl2))))