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