Merge branch 'staging' into core-updates
[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 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 "http://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 "http://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.77")
463 (source (origin
464 (method url-fetch)
465 (uri (string-append
466 "https://github.com/msteveb/jimtcl"
467 "/archive/" version ".tar.gz"))
468 (file-name (string-append name "-" version ".tar.gz"))
469 (sha256
470 (base32
471 "1cmk3qscqckg70chjyimzxa2qcka4qac0j4wq908kiijp45cax08"))))
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")
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 url-fetch)
757 (uri (string-append "https://github.com/parallaxinc/"
758 "OpenSpin/archive/" version ".tar.gz"))
759 (file-name (string-append name "-" version ".tar.gz"))
760 (sha256
761 (base32
762 "1k2dbz1v604g4r2d9qhckg2m8dnhiya760mbsqfsg4waxal87yb7"))))
763 (build-system gnu-build-system)
764 (arguments
765 `(#:tests? #f ; no tests
766 #:phases
767 (modify-phases %standard-phases
768 (delete 'configure)
769 (add-after 'unpack 'remove-timestamp
770 (lambda _
771 (substitute* "SpinSource/openspin.cpp"
772 ((" Compiled on.*$") "\\n\");"))
773 #t))
774 ;; Makefile does not include "install" target
775 (replace 'install
776 (lambda* (#:key outputs #:allow-other-keys)
777 (let ((bin (string-append (assoc-ref outputs "out")
778 "/bin")))
779 (mkdir-p bin)
780 (install-file "build/openspin" bin)
781 #t))))))
782 (home-page "https://github.com/parallaxinc/OpenSpin")
783 (synopsis "Spin/PASM compiler for the Parallax Propeller")
784 (description "OpenSpin is a compiler for the Spin/PASM language of the
785 Parallax Propeller. It was ported from Chip Gracey's original x86 assembler
786 code.")
787 (license license:expat)))
788
789 (define-public propeller-load
790 (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
791 (revision "2"))
792 (package
793 (name "propeller-load")
794 (version "3.4.0")
795 (source (origin
796 (method git-fetch)
797 (uri (git-reference
798 (url "https://github.com/parallaxinc/propgcc.git")
799 (commit commit)))
800 (file-name (string-append name "-" commit "-checkout"))
801 (sha256
802 (base32
803 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
804 (build-system gnu-build-system)
805 (arguments
806 `(#:tests? #f ; no tests
807 #:make-flags
808 (list "OS=linux"
809 (string-append "TARGET=" (assoc-ref %outputs "out")))
810 #:phases
811 (modify-phases %standard-phases
812 (add-after 'unpack 'chdir
813 (lambda _ (chdir "loader") #t))
814 (delete 'configure))))
815 (native-inputs
816 `(("openspin" ,openspin)
817 ("propeller-toolchain" ,propeller-toolchain)))
818 (home-page "https://github.com/parallaxinc/propgcc")
819 (synopsis "Loader for Parallax Propeller micro-controllers")
820 (description "This package provides the tool @code{propeller-load} to
821 upload binaries to a Parallax Propeller micro-controller.")
822 (license license:expat))))
823
824 (define-public spin2cpp
825 (package
826 (name "spin2cpp")
827 (version "3.6.4")
828 (source (origin
829 (method url-fetch)
830 (uri (string-append "https://github.com/totalspectrum/spin2cpp/"
831 "archive/v" version ".tar.gz"))
832 (file-name (string-append name "-" version ".tar.gz"))
833 (sha256
834 (base32
835 "05qak187sn0xg7vhrxw27b19xhmid1b8ab8kax3gv0faavzablfw"))))
836 (build-system gnu-build-system)
837 (arguments
838 `(#:tests? #f ;; The tests assume that a micro-controller is connected.
839 #:phases
840 (modify-phases %standard-phases
841 (delete 'configure)
842 (add-before 'build 'set-cross-environment-variables
843 (lambda* (#:key inputs #:allow-other-keys)
844 (setenv "CROSS_LIBRARY_PATH"
845 (string-append (assoc-ref inputs "propeller-toolchain")
846 "/propeller-elf/lib"))
847 (setenv "CROSS_C_INCLUDE_PATH"
848 (string-append (assoc-ref inputs "propeller-toolchain")
849 "/propeller-elf/include"))
850 #t))
851 (replace 'install
852 (lambda* (#:key outputs #:allow-other-keys)
853 (let ((bin (string-append (assoc-ref outputs "out")
854 "/bin")))
855 (for-each (lambda (file)
856 (install-file (string-append "build/" file)
857 bin))
858 '("testlex" "spin2cpp" "fastspin")))
859 #t)))))
860 (native-inputs
861 `(("bison" ,bison)
862 ("propeller-load" ,propeller-load)
863 ("propeller-toolchain" ,propeller-toolchain)))
864 (home-page "https://github.com/totalspectrum/spin2cpp")
865 (synopsis "Convert Spin code to C, C++, or PASM code")
866 (description "This is a set of tools for converting the Spin language for
867 the Parallax Propeller micro-controller into C or C++ code, into PASM, or even
868 directly into an executable binary. The binaries produced use LMM PASM, so
869 they are much faster than regular Spin bytecodes (but also quite a bit
870 larger).")
871 (license license:expat)))
872
873 (define-public spinsim
874 (let ((commit "66915a7ad1a3a2cf990a725bb341fab8d11eb620")
875 (revision "1"))
876 (package
877 (name "spinsim")
878 (version (string-append "0.75-" revision "." (string-take commit 9)))
879 (source (origin
880 (method git-fetch)
881 (uri (git-reference
882 (url "https://github.com/parallaxinc/spinsim.git")
883 (commit commit)))
884 (file-name (string-append name "-" commit "-checkout"))
885 (sha256
886 (base32
887 "1n9kdhlxsdx7bz6c80w8dhi96zp633gd6qs0x9i4ii8qv4i7sj5k"))))
888 (build-system gnu-build-system)
889 (arguments
890 `(#:tests? #f ; no tests
891 #:phases
892 (modify-phases %standard-phases
893 (delete 'configure)
894 (replace 'install
895 (lambda* (#:key outputs #:allow-other-keys)
896 (let ((bin (string-append (assoc-ref outputs "out")
897 "/bin")))
898 (install-file "build/spinsim" bin))
899 #t)))))
900 (home-page "https://github.com/parallaxinc/spinsim")
901 (synopsis "Spin simulator")
902 (description "This package provides the tool @code{spinsim}, a simulator
903 and simple debugger for Spin programs written for a Parallax Propeller
904 micro-controller. Spinsim supports execution from cog memory and hub
905 execution, but it does not support multi-tasking. It supports about
906 two-thirds of the opcodes in the P2 instruction set.")
907 (license license:expat))))
908
909 (define-public propeller-development-suite
910 (package
911 (name "propeller-development-suite")
912 (version (package-version propeller-gcc))
913 (source #f)
914 (build-system trivial-build-system)
915 (arguments '(#:builder (begin (mkdir %output) #t)))
916 (propagated-inputs
917 `(("toolchain" ,propeller-toolchain)
918 ("openspin" ,openspin)
919 ("propeller-load" ,propeller-load)
920 ("spin2cpp" ,spin2cpp)
921 ("spinsim" ,spinsim)))
922 (synopsis "Complete development suite for Propeller micro-controllers")
923 (description "This meta-package provides a complete environment for the
924 development with Parallax Propeller micro-controllers. It includes the GCC
925 toolchain, the loader, the Openspin compiler, the Spin2cpp tool, and the Spin
926 simulator.")
927 (home-page (package-home-page propeller-gcc))
928 (license (package-license propeller-gcc))))
929
930 (define-public binutils-vc4
931 (let ((commit "708acc851880dbeda1dd18aca4fd0a95b2573b36"))
932 (package
933 (name "binutils-vc4")
934 (version (string-append "2.23.51-0." (string-take commit 7)))
935 (source (origin
936 (method git-fetch)
937 (uri (git-reference
938 (url "https://github.com/puppeh/binutils-vc4.git")
939 (commit commit)))
940 (file-name (string-append name "-" version "-checkout"))
941 (sha256
942 (base32
943 "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63"))))
944 (build-system gnu-build-system)
945 (arguments
946 `(#:configure-flags '("--target=vc4-elf"
947 "--disable-werror"
948 "--enable-cgen-maint")
949 #:phases
950 (modify-phases %standard-phases
951 (add-after 'unpack 'unpack-cgen
952 (lambda* (#:key inputs #:allow-other-keys)
953 (copy-recursively (string-append (assoc-ref inputs "cgen")
954 "/cgen") "cgen")
955 #t))
956 (add-after 'unpack-cgen 'fix-cgen-guile
957 (lambda _
958 (substitute* "opcodes/Makefile.in"
959 (("guile\\{,-\\}1.8") "guile"))
960 (invoke "which" "guile"))))))
961 (native-inputs
962 `(("cgen"
963 ,(origin
964 (method git-fetch)
965 (uri (git-reference
966 (url "https://github.com/puppeh/cgen.git")
967 (commit "d8e2a9eb70425f180fdd5bfd032884b0855f2032")))
968 (sha256
969 (base32
970 "14b3h2ji740s8zq5vwm4qdcxs4aa4wxi6wb9di3bv1h39x14nyr9"))))
971 ("texinfo" ,texinfo)
972 ("flex" ,flex)
973 ("bison" ,bison)
974 ("guile-1.8" ,guile-1.8)
975 ("which" ,base:which)))
976 (synopsis "Binutils for VC4")
977 (description "This package provides @code{binutils} for VideoCore IV,
978 the Raspberry Pi chip.")
979 (license license:gpl3+)
980 (home-page "https://github.com/puppeh/vc4-toolchain/"))))
981
982 (define-public gcc-vc4
983 (let ((commit "165f6d0e11d2e76ee799533bb45bd5c92bf60dc2")
984 (xgcc (cross-gcc "vc4-elf" #:xbinutils binutils-vc4)))
985 (package (inherit xgcc)
986 (name "gcc-vc4")
987 (source (origin
988 (method git-fetch)
989 (uri (git-reference
990 (url "https://github.com/puppeh/gcc-vc4.git")
991 (commit commit)))
992 (file-name (string-append name
993 "-"
994 (package-version xgcc)
995 "-checkout"))
996 (sha256
997 (base32
998 "13h30qjcwnlz6lfma1d82nnvfmjnhh7abkagip4vly6vm5fpnvf2"))))
999 (native-inputs
1000 `(("flex" ,flex)
1001 ,@(package-native-inputs xgcc)))
1002 (synopsis "GCC for VC4")
1003 (description "This package provides @code{gcc} for VideoCore IV,
1004 the Raspberry Pi chip."))))
1005
1006 (define-public python-libmpsse
1007 (package
1008 (name "python-libmpsse")
1009 (version "1.4")
1010 (source
1011 (origin
1012 (method git-fetch)
1013 (uri (git-reference
1014 (url "https://github.com/daym/libmpsse.git")
1015 (commit (string-append "v" version))))
1016 (file-name "libmpsse-checkout")
1017 (sha256
1018 (base32
1019 "14f1kiiia4kfd9mzwx4h63aa8bpz9aknbrrr7mychnsp3arw0z25"))))
1020 (build-system gnu-build-system)
1021 (inputs
1022 `(("libftdi" ,libftdi)
1023 ("python" ,python)))
1024 (native-inputs
1025 `(("pkg-config" ,pkg-config)
1026 ("swig" ,swig)
1027 ("which" ,base:which)))
1028 (arguments
1029 `(#:tests? #f ; No tests exist.
1030 #:parallel-build? #f ; Would be buggy.
1031 #:make-flags
1032 (list (string-append "CFLAGS=-Wall -fPIC -fno-strict-aliasing -g -O2 "
1033 "$(shell pkg-config --cflags libftdi1)"))
1034 #:phases
1035 (modify-phases %standard-phases
1036 (add-after 'unpack 'set-environment-up
1037 (lambda* (#:key inputs outputs #:allow-other-keys)
1038 (let ((python (assoc-ref inputs "python")))
1039 (chdir "src")
1040 (setenv "PYDEV" (string-append python
1041 "/include/python"
1042 ,(version-major+minor (package-version python))
1043 "m"))
1044 #t)))
1045 (replace 'install
1046 (lambda* (#:key inputs outputs make-flags #:allow-other-keys #:rest args)
1047 (let* ((out (assoc-ref outputs "out"))
1048 (out-python (string-append out
1049 "/lib/python"
1050 ,(version-major+minor (package-version python))
1051 "/site-packages"))
1052 (install (assoc-ref %standard-phases 'install)))
1053 (install #:make-flags (cons (string-append "PYLIB=" out-python)
1054 make-flags))))))))
1055 (home-page "https://code.google.com/archive/p/libmpsse/")
1056 (synopsis "Python library for MPSSE SPI I2C JTAG adapter by FTDI")
1057 (description "This package provides a library in order to support the
1058 MPSSE (Multi-Protocol Synchronous Serial Engine) adapter by FTDI that can do
1059 SPI, I2C, JTAG.")
1060 (license license:gpl2+)))
1061
1062 (define-public python2-libmpsse
1063 (package
1064 (inherit python-libmpsse)
1065 (name "python2-libmpsse")
1066 (arguments
1067 (substitute-keyword-arguments (package-arguments python-libmpsse)
1068 ((#:phases phases)
1069 `(modify-phases ,phases
1070 (replace '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-2))))
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-2))
1084 "/site-packages"))
1085 (install (assoc-ref %standard-phases 'install)))
1086 (install #:make-flags (cons (string-append "PYLIB=" out-python)
1087 make-flags)))))))))
1088 (inputs
1089 (alist-replace "python" (list python-2)
1090 (package-inputs python-libmpsse)))))
1091
1092 (define-public picprog
1093 (package
1094 (name "picprog")
1095 (version "1.9.1")
1096 (source (origin
1097 (method url-fetch)
1098 (uri (string-append "http://www.iki.fi/hyvatti/pic/picprog-"
1099 version ".tar.gz"))
1100 (file-name (string-append name "-" version ".tar.gz"))
1101 (sha256
1102 (base32
1103 "1r04hg1n3v2jf915qr05la3q9cxy7a5jnh9cc98j04lh6c9p4x85"))
1104 (patches (search-patches "picprog-non-intel-support.patch"))))
1105 (build-system gnu-build-system)
1106 (arguments
1107 `(#:tests? #f ; No tests exist.
1108 #:phases
1109 (modify-phases %standard-phases
1110 (add-after 'unpack 'patch-paths
1111 (lambda* (#:key outputs #:allow-other-keys)
1112 (substitute* "Makefile"
1113 (("/usr/local") (assoc-ref outputs "out"))
1114 ((" -o 0 -g 0 ") " ")
1115 (("testport") ""))
1116 #t))
1117 (add-before 'install 'mkdir
1118 (lambda* (#:key outputs #:allow-other-keys)
1119 (let ((out (assoc-ref outputs "out")))
1120 (mkdir-p (string-append out "/bin"))
1121 (mkdir-p (string-append out "/man/man1"))
1122 #t)))
1123 (delete 'configure))))
1124 (synopsis "Programs Microchip's PIC microcontrollers")
1125 (description "This program programs Microchip's PIC microcontrollers.")
1126 (home-page "http://hyvatti.iki.fi/~jaakko/pic/picprog.html")
1127 (license license:gpl3+)))
1128
1129 (define-public fc-host-tools
1130 (package
1131 (name "fc-host-tools")
1132 (version "11")
1133 (source (origin
1134 (method url-fetch)
1135 (uri (string-append "ftp://ftp.freecalypso.org/pub/GSM/"
1136 "FreeCalypso/fc-host-tools-r" version ".tar.bz2"))
1137 (sha256
1138 (base32
1139 "0s87lp6gd8i8ivrdd7mnnalysr65035nambcm992rgla7sk76sj1"))))
1140 (build-system gnu-build-system)
1141 (arguments
1142 `(#:tests? #f ; No tests exist.
1143 #:make-flags
1144 (list (string-append "INSTALL_PREFIX=" %output)
1145 (string-append "INCLUDE_INSTALL_DIR=" %output "include/rvinterf"))
1146 #:phases
1147 (modify-phases %standard-phases
1148 (add-after 'unpack 'patch-installation-paths
1149 (lambda* (#:key outputs #:allow-other-keys)
1150 (substitute* '("Makefile"
1151 "rvinterf/etmsync/fsiomain.c"
1152 "rvinterf/etmsync/fsnew.c"
1153 "rvinterf/asyncshell/help.c"
1154 "rvinterf/libinterf/launchrvif.c"
1155 "loadtools/defpath.c"
1156 "loadtools/Makefile"
1157 "miscutil/c139explore"
1158 "miscutil/pirexplore"
1159 "ffstools/tiffs-wrappers/installpath.c"
1160 "uptools/atcmd/atinterf.c")
1161 (("/opt/freecalypso/loadtools")
1162 (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
1163 (("\\$\\{INSTALL_PREFIX\\}/loadtools")
1164 (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
1165 (("\\$\\{INSTALL_PREFIX\\}/target-bin")
1166 (string-append (assoc-ref outputs "out") "/lib/freecalypso/target-bin"))
1167 (("/opt/freecalypso")
1168 (assoc-ref outputs "out")))
1169 #t))
1170 (delete 'configure))))
1171 (inputs
1172 `(("libx11" ,libx11)))
1173 (synopsis "Freecalypso host tools")
1174 (description "This package provides some tools for debugging FreeCalypso phones and the FreeCalypso FCDEV3B dev board.
1175
1176 @enumerate
1177 @item fc-e1decode: Decodes a binary Melody E1 file into an ASCII source file.
1178 @item fc-e1gen: Encodes an ASCII Melody E1 file into a binary Melody E1 file.
1179 @item fc-fr2tch: Converts a GSM 06.10 speech recording from libgsm to hex
1180 strings of TCH bits to be fed to the GSM 05.03 channel encoder of a TI
1181 Calypso GSM device.
1182 @item fc-tch2fr: Converts hex strings of TCH bits to libgsm.
1183 @item fc-gsm2vm: utility converts a GSM 06.10 speech sample from the libgsm
1184 source format into a voice memo file that can be uploaded into the FFS of a
1185 FreeCalypso device and played with the audio_vm_play_start() API or the
1186 AT@@VMP command that invokes the latter.
1187 @item fc-rgbconv: Convers RGB 5:6:5 to RGB 8:8:8 and vice versa.
1188 @item rvinterf: Communicates with a TI Calypso GSM device via RVTMUX.
1189 @item rvtdump: produces a human-readable dump of all output emitted by a
1190 TI-based GSM fw on the RVTMUX binary packet interface.
1191 @item fc-shell: FreeCalypso firmwares have a feature of our own invention
1192 (not present in any pre-existing ones) to accept AT commands over the RVTMUX
1193 interface. It is useful when no second UART is available for a dedicated
1194 standard AT command interface. fc-shell is the tool that allows you to send
1195 AT commands to the firmware in this manner.
1196 @item fc-memdump: Captures a memory dump from a GSM device.
1197 @item fc-serterm: Trivial serial terminal. Escapes binary chars.
1198 @item fc-fsio: Going through rvinterf, this tool connects to GSM devices and
1199 allows you to manipulate the device's flash file system.
1200 @item tiaud-compile: Compiles an audio mode configuration table for TI's
1201 Audio Service from our own ASCII source format into the binary format for
1202 uploading into FreeCalypso GSM device FFS with fc-fsio.
1203 @item tiaud-decomp: Decodes TI's audio mode configuration files read out of
1204 FFS into our own ASCII format.
1205 @item tiaud-mkvol: Generates the *.vol binary files which need to accompany
1206 the main *.cfg ones.
1207 @item fc-compalram: Allows running programs on the device without writing
1208 them to flash storage.
1209 @item fc-xram: Allows running programs on the device without writing them
1210 to flash storage.
1211 @item fc-iram: Allows running programs on the device without writing them
1212 to flash storage.
1213 @item fc-loadtool: Writes programs to the device's flash storage.
1214 @item pirffs: Allows listing and extracting FFS content captured as a raw
1215 flash image from Pirelli phones.
1216 @item mokoffs: Allows listing and extracting FFS content captured as a raw
1217 flash image from OpenMoko phones.
1218 @item tiffs: Allows listing and extracting FFS content captured as a raw
1219 flash image from TI phones.
1220 @item c139explore: Run-from-RAM program for C139 phones that
1221 exercises their peripheral hardware: LCD, keypad backlight, buzzer, vibrator.
1222 @item pirexplore: Run-from-RAM program for Pirelli DP-L10 phones that
1223 exercises their peripheral hardware, primarily their LCD.
1224 @item tfc139: Breaks into Mot C1xx phones via shellcode injection, allowing
1225 you to reflash locked phones with new firmware with fc-loadtool.
1226 @item ctracedec: GSM firmwares built in TI's Windows environment have a
1227 compressed trace misfeature whereby many of the ASCII strings
1228 in debug trace messages get replaced with numeric indices at
1229 build time, and these numeric indices are all that gets emitted
1230 on the RVTMUX serial channel. This tools decodes these numeric indices
1231 back to strings in trace output.
1232 @item fc-cal2text: This utility takes a dump of TI's /gsm/rf flash file system
1233 directory subtree as input (either extracted in vitro with tiffs
1234 or read out in vivo with fc-fsio) and converts all RF tables
1235 found therein into a readable ASCII format.
1236 @item imei-luhn: Computes or verifies the Luhn check digit of an IMEI number.
1237 @item fc-dspapidump: Reads and dumps the contents of the DSP API RAM in a
1238 target Calypso GSM device.
1239 @item fc-vm2hex: Converts the old-fashioned (non-AMR) voice memo files read
1240 out of FFS into hex strings.
1241 @item fc-buzplay: Plays piezoelectic buzzer melodies on an actual
1242 Calypso device equipped with such a buzzer (Mot C1xx, TI's D-Sample board,
1243 our planned future HSMBP) by loading a buzplayer agent onto the target and
1244 feeding melodies to be played to it.
1245 @item fc-tmsh: TI-based GSM firmwares provide a rich set of Test Mode commands
1246 that can be issued through the RVTMUX (debug trace) serial channel.
1247 This program is our test mode shell for sending Test Mode commands to targets
1248 and displaying decoded target responses.
1249 @item fcup-smsend: Send a short message via SMS
1250 @item fcup-smsendmult: Send multiple short messages via SMS in one go
1251 @item fcup-smsendpdu: Send multiple short messages given in PDU format via SMS
1252 @item sms-pdu-decode: Decode PDU format messages
1253 @end enumerate")
1254 (home-page "https://www.freecalypso.org/")
1255 (license license:public-domain)))
1256
1257 (define-public stlink
1258 (package
1259 (name "stlink")
1260 (version "1.5.1")
1261 (source
1262 (origin
1263 (method url-fetch)
1264 (uri (string-append "https://github.com/texane/stlink/archive/v"
1265 version ".tar.gz"))
1266 (file-name (string-append name "-" version ".tar.gz"))
1267 (sha256
1268 (base32
1269 "01z1cz1a5xbbhd163qrqcgp4bi1k145pb80jmwdz50g7sfzmy570"))))
1270 (build-system cmake-build-system)
1271 (arguments
1272 `(#:tests? #f ;no tests
1273 #:configure-flags
1274 (let* ((out (assoc-ref %outputs "out"))
1275 (etc (in-vicinity out "etc"))
1276 (modprobe (in-vicinity etc "modprobe.d"))
1277 (udev-rules (in-vicinity etc "udev/rules.d")))
1278 (list (string-append "-DSTLINK_UDEV_RULES_DIR=" udev-rules)
1279 (string-append "-DSTLINK_MODPROBED_DIR=" modprobe)))))
1280 (inputs
1281 `(("libusb" ,libusb)))
1282 (synopsis "Programmer for STM32 Discovery boards")
1283 (description "This package provides a firmware programmer for the STM32
1284 Discovery boards. It supports two versions of the chip: ST-LINK/V1 (on
1285 STM32VL discovery kits) and ST-LINK/V2 (on STM32L discovery and later kits).
1286 Two different transport layers are used: ST-LINK/V1 uses SCSI passthru
1287 commands over USB, and ST-LINK/V2 and ST-LINK/V2-1 (seen on Nucleo boards) use
1288 raw USB commands.")
1289 (home-page "https://github.com/texane/stlink")
1290 ;; The flashloaders/stm32l0x.s and flashloaders/stm32lx.s source files are
1291 ;; licensed under the GPLv2+.
1292 (license (list license:bsd-3 license:gpl2+))))
1293
1294 (define-public west
1295 (package
1296 (name "west")
1297 (version "0.6.3")
1298 (source
1299 (origin
1300 (method url-fetch)
1301 (uri (pypi-uri "west" version))
1302 (sha256
1303 (base32
1304 "0ql6ij1hrj2ir5wkxm96zgig5qwvfwa75w77wh2y13w6b9cqcr4b"))))
1305 (propagated-inputs
1306 `(("python-colorama" ,python-colorama)
1307 ("python-configobj" ,python-configobj)
1308 ("python-pykwalify" ,python-pykwalify)
1309 ("python-pyyaml" ,python-pyyaml)))
1310 (build-system python-build-system)
1311 (home-page "https://github.com/zephyrproject-rtos/west")
1312 (synopsis "Zephyr RTOS Project meta-tool")
1313 (description "West is the swiss-army knife command line tool of the Zephyr
1314 project. Its built-in commands provide a multiple repository management
1315 system with features inspired by Google’s Repo tool and Git submodules. West
1316 simplifies configuration and is also pluggable: you can write your own west
1317 \"extension commands\" which add additional features to west. Zephyr uses
1318 this feature to provide conveniences for building applications, flashing and
1319 debugging them, and more.")
1320 (license license:expat)))