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