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