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