gnu: avr-gcc: Fix conflicting GCC headers.
[jackhill/guix/guix.git] / gnu / packages / embedded.scm
CommitLineData
35a37efb 1;;; GNU Guix --- Functional package management for GNU
316fa45e 2;;; Copyright © 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
2da8865a 3;;; Copyright © 2016, 2017 Theodoros Foradis <theodoros@foradis.org>
e5e45c06 4;;; Copyright © 2016 David Craven <david@craven.ch>
9be1f2b7 5;;; Copyright © 2017, 2020 Efraim Flashner <efraim@flashner.co.il>
4886d5b2 6;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
2c2fc24b 7;;; Copyright © 2018, 2019 Clément Lassieur <clement@lassieur.org>
35a37efb
RW
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:)
615a7eec 31 #:use-module (guix build-system cmake)
35a37efb 32 #:use-module (guix build-system gnu)
2c2fc24b 33 #:use-module (guix build-system python)
569f6016 34 #:use-module (guix build-system trivial)
5a2639f9 35 #:use-module ((guix build utils) #:select (alist-replace))
35a37efb 36 #:use-module (gnu packages)
e5e45c06 37 #:use-module (gnu packages autotools)
8ea42482 38 #:use-module ((gnu packages base) #:prefix base:)
2d7c9213 39 #:use-module (gnu packages bison)
35a37efb 40 #:use-module (gnu packages cross-base)
2d7c9213 41 #:use-module (gnu packages dejagnu)
35a37efb 42 #:use-module (gnu packages flex)
dbc3c34e 43 #:use-module (gnu packages gcc)
94f36a4f 44 #:use-module (gnu packages gdb)
8ea42482 45 #:use-module (gnu packages guile)
5b83b7b8 46 #:use-module (gnu packages libftdi)
e5e45c06 47 #:use-module (gnu packages libusb)
35a37efb 48 #:use-module (gnu packages perl)
e5e45c06 49 #:use-module (gnu packages pkg-config)
1a6497de 50 #:use-module (gnu packages python)
2c2fc24b 51 #:use-module (gnu packages python-xyz)
1a6497de 52 #:use-module (gnu packages swig)
7894ea61 53 #:use-module (gnu packages texinfo)
cc8d346b 54 #:use-module (gnu packages xorg)
7894ea61 55 #:use-module (srfi srfi-1))
35a37efb
RW
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"
7b3318e3
RW
64 #:xgcc gcc-4.9
65 #:xbinutils (cross-binutils "arm-none-eabi")))
35a37efb
RW
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"))
7894ea61
LC
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))))))
35a37efb
RW
88 (native-inputs
89 `(("flex" ,flex)
316fa45e 90 ("gcc" ,gcc-5)
35a37efb
RW
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"))))))))
6c39886a 131
dbc3c34e
TF
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
6c39886a
RW
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)))
2196e3cc 178 (home-page "https://www.sourceware.org/newlib/")
6c39886a
RW
179 (synopsis "C library for use on embedded systems")
180 (description "Newlib is a C library intended for use on embedded
181systems. It is a conglomeration of several library parts that are easily
182usable on embedded products.")
183 (license (license:non-copyleft
184 "https://www.sourceware.org/newlib/COPYING.NEWLIB"))))
a299a899
RW
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")))
569f6016 209
04c4ef35
RW
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
5c792737
RW
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
f08eed3d
RW
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
1a1e8336
RW
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
569f6016
TF
352(define (arm-none-eabi-toolchain xgcc newlib)
353 "Produce a cross-compiler toolchain package with the compiler XGCC and the C
354library 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)
9cdf4872
RW
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")
e3cfef22
MW
377 directories)
378 #t)))))
569f6016
TF
379 (propagated-inputs
380 `(("binutils" ,(cross-binutils "arm-none-eabi"))
8ea169d0 381 ("libstdc++" ,(make-libstdc++-arm-none-eabi xgcc newlib-with-xgcc))
569f6016
TF
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
386bare metal development. This includes the GCC arm-none-eabi cross compiler
387and newlib (or newlib-nano) as the C library. The supported programming
388languages 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))
94f36a4f 407
893960ee
RW
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
ee9e108a
RW
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
94f36a4f
TF
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)))))
e5e45c06
DC
427
428(define-public libjaylink
429 ;; No release tarballs available.
2da8865a
TF
430 (let ((commit "699b7001d34a79c8e7064503dde1bede786fd7f0")
431 (revision "2"))
e5e45c06
DC
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
5f13bf09 439 (url "https://git.zapb.de/libjaylink.git")
e5e45c06
DC
440 (commit commit)))
441 (file-name (string-append name "-" version "-checkout"))
442 (sha256
443 (base32
2da8865a 444 "034872d44myycnzn67v5b8ixrgmg8sk32aqalvm5x7108w2byww1"))))
e5e45c06
DC
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)))
f4766a18 453 (home-page "https://repo.or.cz/w/libjaylink.git")
e5e45c06
DC
454 (synopsis "Library to interface Segger J-Link devices")
455 (description "libjaylink is a shared library written in C to access
456SEGGER J-Link and compatible devices.")
457 (license license:gpl2+))))
91ba6935
DC
458
459(define-public jimtcl
460 (package
461 (name "jimtcl")
fd7ad899 462 (version "0.79")
91ba6935 463 (source (origin
cc17b07a
EF
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))
91ba6935
DC
469 (sha256
470 (base32
fd7ad899 471 "1k88hz0v3bi19xdvlp0i9nsx38imzwpjh632w7326zwbv2wldf0h"))))
91ba6935
DC
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")))
78854b38
RW
480 (invoke "./configure"
481 (string-append "--prefix=" out))))))))
fd7ad899 482 (home-page "http://jim.tcl.tk/index.html")
91ba6935
DC
483 (synopsis "Small footprint Tcl implementation")
484 (description "Jim is a small footprint implementation of the Tcl programming
485language.")
486 (license license:bsd-2)))
5b83b7b8
TF
487
488(define-public openocd
ea1aa452
TF
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
867d9de6 530 ;; Required because of patched sources.
ea1aa452 531 (add-before 'configure 'autoreconf
867d9de6 532 (lambda _ (invoke "autoreconf" "-vfi") #t))
ea1aa452
TF
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")
867d9de6
RW
543 "/lib/udev/rules.d/"))
544 #t)))))
ea1aa452
TF
545 (home-page "http://openocd.org")
546 (synopsis "On-Chip Debugger")
547 (description "OpenOCD provides on-chip programming and debugging support
5b83b7b8 548with a layered architecture of JTAG interface and TAP support.")
ea1aa452 549 (license license:gpl2+)))
2d7c9213 550
791cfa67
RW
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".
2d7c9213
RW
555
556(define propeller-binutils
557 (let ((xbinutils (cross-binutils "propeller-elf"))
791cfa67
RW
558 (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
559 (revision "2"))
2d7c9213
RW
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
791cfa67 567 (url "https://github.com/parallaxinc/propgcc.git")
2d7c9213
RW
568 (commit commit)))
569 (file-name (string-append name "-" commit "-checkout"))
570 (sha256
571 (base32
791cfa67
RW
572 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
573 (patch-flags (list "-p1" "--directory=binutils"))))
2d7c9213 574 (arguments
791cfa67 575 `(;; FIXME: For some reason there are many test failures. It's not
2d7c9213
RW
576 ;; obvious how to fix the failures.
577 #:tests? #f
578 #:phases
579 (modify-phases %standard-phases
791cfa67
RW
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)))))
2d7c9213
RW
585 (native-inputs
586 `(("bison" ,bison)
5e54f4ad 587 ("flex" ,flex)
2d7c9213
RW
588 ("texinfo" ,texinfo)
589 ("dejagnu" ,dejagnu)
590 ,@(package-native-inputs xbinutils))))))
591
bb19b2eb 592(define-public propeller-gcc-6
68cb2784 593 (let ((xgcc (cross-gcc "propeller-elf"
7b3318e3 594 #:xbinutils propeller-binutils))
68cb2784
RW
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
db90eb8c 628(define-public propeller-gcc-4
bb19b2eb 629 (let ((xgcc propeller-gcc-6)
791cfa67
RW
630 (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
631 (revision "2"))
db90eb8c
RW
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
791cfa67 638 (url "https://github.com/parallaxinc/propgcc.git")
db90eb8c
RW
639 (commit commit)))
640 (file-name (string-append name "-" commit "-checkout"))
641 (sha256
642 (base32
791cfa67
RW
643 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
644 (patch-flags (list "-p1" "--directory=gcc"))
db90eb8c
RW
645 (patches
646 (append
647 (origin-patches (package-source gcc-4.7))
1d3be5d9
RW
648 (search-patches "gcc-4.6-gnu-inline.patch"
649 "gcc-cross-environment-variables.patch")))))
791cfa67
RW
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))))))
8226304b
RW
656 (native-inputs
657 `(("gcc-4" ,gcc-4.9)
658 ,@(package-native-inputs propeller-gcc-6)))
791cfa67 659 (home-page "https://github.com/parallaxinc/propgcc")
57e96e48 660 (supported-systems (delete "aarch64-linux" %supported-systems)))))
db90eb8c 661
bb19b2eb
RW
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
791cfa67
RW
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.
0d0079b2 671(define-public proplib
791cfa67
RW
672 (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
673 (revision "2"))
0d0079b2
RW
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
791cfa67 680 (url "https://github.com/parallaxinc/propgcc.git")
0d0079b2
RW
681 (commit commit)))
682 (file-name (string-append name "-" commit "-checkout"))
683 (sha256
684 (base32
791cfa67 685 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
0d0079b2
RW
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)
791cfa67
RW
695 (add-after 'unpack 'chdir
696 (lambda _ (chdir "lib") #t))
697 (add-after 'chdir 'fix-Makefile
0d0079b2
RW
698 (lambda _
699 (substitute* "Makefile"
0d0079b2
RW
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)
5cb9754c 707 (apply invoke "make" "install-dirs" make-flags)))
0d0079b2
RW
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))
791cfa67 719 (add-before 'install 'install-includes
0d0079b2 720 (lambda* (#:key make-flags #:allow-other-keys)
5cb9754c 721 (apply invoke "make" "install-includes" make-flags))))))
0d0079b2
RW
722 (native-inputs
723 `(("propeller-gcc" ,propeller-gcc)
724 ("propeller-binutils" ,propeller-binutils)
725 ("perl" ,perl)))
791cfa67 726 (home-page "https://github.com/parallaxinc/propgcc")
0d0079b2
RW
727 (synopsis "C library for the Parallax Propeller")
728 (description "This is a C library for the Parallax Propeller
729micro-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
eb88fbaf
RW
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)
e3cfef22 740 (arguments '(#:builder (begin (mkdir %output) #t)))
eb88fbaf
RW
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
747Propeller micro-controller development.")
748 (home-page (package-home-page propeller-gcc))
749 (license (package-license propeller-gcc))))
750
150e0a1e
RW
751(define-public openspin
752 (package
753 (name "openspin")
754 (version "1.00.78")
755 (source (origin
9be1f2b7
EF
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))
150e0a1e
RW
761 (sha256
762 (base32
9be1f2b7 763 "0ghk8hj4717ydhqzx2pfs6737s1cxng6sgg2xgbkwvcfclxdbrd0"))))
150e0a1e
RW
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
786Parallax Propeller. It was ported from Chip Gracey's original x86 assembler
787code.")
788 (license license:expat)))
789
c6b96af7 790(define-public propeller-load
791cfa67
RW
791 (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
792 (revision "2"))
c6b96af7
RW
793 (package
794 (name "propeller-load")
795 (version "3.4.0")
796 (source (origin
797 (method git-fetch)
798 (uri (git-reference
791cfa67 799 (url "https://github.com/parallaxinc/propgcc.git")
c6b96af7
RW
800 (commit commit)))
801 (file-name (string-append name "-" commit "-checkout"))
802 (sha256
803 (base32
791cfa67 804 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
c6b96af7
RW
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
791cfa67
RW
813 (add-after 'unpack 'chdir
814 (lambda _ (chdir "loader") #t))
c6b96af7
RW
815 (delete 'configure))))
816 (native-inputs
817 `(("openspin" ,openspin)
818 ("propeller-toolchain" ,propeller-toolchain)))
791cfa67 819 (home-page "https://github.com/parallaxinc/propgcc")
c6b96af7
RW
820 (synopsis "Loader for Parallax Propeller micro-controllers")
821 (description "This package provides the tool @code{propeller-load} to
822upload binaries to a Parallax Propeller micro-controller.")
823 (license license:expat))))
824
0a7860c4
RW
825(define-public spin2cpp
826 (package
827 (name "spin2cpp")
4886d5b2 828 (version "3.6.4")
0a7860c4 829 (source (origin
02aab3df
EF
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))
0a7860c4
RW
835 (sha256
836 (base32
02aab3df 837 "0wznqvsckzzz4hdy2rpvj6jqpxw4yn7i0c7zxfm6i46k8gg9327b"))))
0a7860c4
RW
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
869the Parallax Propeller micro-controller into C or C++ code, into PASM, or even
870directly into an executable binary. The binaries produced use LMM PASM, so
871they are much faster than regular Spin bytecodes (but also quite a bit
872larger).")
873 (license license:expat)))
874
3ebc86d9
RW
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
905and simple debugger for Spin programs written for a Parallax Propeller
906micro-controller. Spinsim supports execution from cog memory and hub
907execution, but it does not support multi-tasking. It supports about
908two-thirds of the opcodes in the P2 instruction set.")
909 (license license:expat))))
910
395bbfdb
RW
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)
e3cfef22 917 (arguments '(#:builder (begin (mkdir %output) #t)))
395bbfdb
RW
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
926development with Parallax Propeller micro-controllers. It includes the GCC
927toolchain, the loader, the Openspin compiler, the Spin2cpp tool, and the Spin
928simulator.")
929 (home-page (package-home-page propeller-gcc))
930 (license (package-license propeller-gcc))))
8ea42482
DM
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)))
493ae57e 942 (file-name (string-append name "-" version "-checkout"))
8ea42482
DM
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"))
25e25d8f 962 (invoke "which" "guile"))))))
8ea42482
DM
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)
5e54f4ad 974 ("flex" ,flex)
8ea42482
DM
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,
980the Raspberry Pi chip.")
981 (license license:gpl3+)
982 (home-page "https://github.com/puppeh/vc4-toolchain/"))))
7cf06d62
DM
983
984(define-public gcc-vc4
985 (let ((commit "165f6d0e11d2e76ee799533bb45bd5c92bf60dc2")
7b3318e3 986 (xgcc (cross-gcc "vc4-elf" #:xbinutils binutils-vc4)))
7cf06d62
DM
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,
1006the Raspberry Pi chip."))))
1a6497de 1007
2ea4587d 1008(define-public python-libmpsse
1a6497de 1009 (package
2ea4587d
DM
1010 (name "python-libmpsse")
1011 (version "1.4")
1a6497de
DM
1012 (source
1013 (origin
2ea4587d
DM
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")
1a6497de
DM
1019 (sha256
1020 (base32
2ea4587d 1021 "14f1kiiia4kfd9mzwx4h63aa8bpz9aknbrrr7mychnsp3arw0z25"))))
1a6497de
DM
1022 (build-system gnu-build-system)
1023 (inputs
1024 `(("libftdi" ,libftdi)
2ea4587d 1025 ("python" ,python)))
1a6497de
DM
1026 (native-inputs
1027 `(("pkg-config" ,pkg-config)
1028 ("swig" ,swig)
1029 ("which" ,base:which)))
1030 (arguments
1031 `(#:tests? #f ; No tests exist.
2ea4587d 1032 #:parallel-build? #f ; Would be buggy.
1a6497de
DM
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)
2ea4587d
DM
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)))
1a6497de 1047 (replace 'install
2ea4587d 1048 (lambda* (#:key inputs outputs make-flags #:allow-other-keys #:rest args)
1a6497de
DM
1049 (let* ((out (assoc-ref outputs "out"))
1050 (out-python (string-append out
2ea4587d
DM
1051 "/lib/python"
1052 ,(version-major+minor (package-version python))
1053 "/site-packages"))
1a6497de
DM
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
1060MPSSE (Multi-Protocol Synchronous Serial Engine) adapter by FTDI that can do
1061SPI, I2C, JTAG.")
1062 (license license:gpl2+)))
981bccf1 1063
2ea4587d
DM
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
981bccf1
DM
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
316fd29f
EF
1105 "1r04hg1n3v2jf915qr05la3q9cxy7a5jnh9cc98j04lh6c9p4x85"))
1106 (patches (search-patches "picprog-non-intel-support.patch"))))
981bccf1
DM
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"))
316fd29f
EF
1116 ((" -o 0 -g 0 ") " ")
1117 (("testport") ""))
981bccf1
DM
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.")
dd8cf009 1128 (home-page "https://hyvatti.iki.fi/~jaakko/pic/picprog.html")
981bccf1 1129 (license license:gpl3+)))
cc8d346b
DM
1130
1131(define-public fc-host-tools
1132 (package
1133 (name "fc-host-tools")
1333eb58 1134 (version "11")
cc8d346b
DM
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
1333eb58 1141 "0s87lp6gd8i8ivrdd7mnnalysr65035nambcm992rgla7sk76sj1"))))
cc8d346b
DM
1142 (build-system gnu-build-system)
1143 (arguments
1144 `(#:tests? #f ; No tests exist.
1145 #:make-flags
eb6ef893 1146 (list (string-append "INSTALL_PREFIX=" %output)
cc8d346b
DM
1147 (string-append "INCLUDE_INSTALL_DIR=" %output "include/rvinterf"))
1148 #:phases
1149 (modify-phases %standard-phases
1333eb58 1150 (add-after 'unpack 'patch-installation-paths
cc8d346b
DM
1151 (lambda* (#:key outputs #:allow-other-keys)
1152 (substitute* '("Makefile"
6adfcbea
DM
1153 "rvinterf/etmsync/fsiomain.c"
1154 "rvinterf/etmsync/fsnew.c"
1155 "rvinterf/asyncshell/help.c"
1156 "rvinterf/libinterf/launchrvif.c"
cc8d346b
DM
1157 "loadtools/defpath.c"
1158 "loadtools/Makefile"
1159 "miscutil/c139explore"
1dec2691
DM
1160 "miscutil/pirexplore"
1161 "ffstools/tiffs-wrappers/installpath.c"
1dec2691 1162 "uptools/atcmd/atinterf.c")
cc8d346b
DM
1163 (("/opt/freecalypso/loadtools")
1164 (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
16cb1c51
DM
1165 (("\\$\\{INSTALL_PREFIX\\}/loadtools")
1166 (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
1333eb58
DM
1167 (("\\$\\{INSTALL_PREFIX\\}/target-bin")
1168 (string-append (assoc-ref outputs "out") "/lib/freecalypso/target-bin"))
cc8d346b
DM
1169 (("/opt/freecalypso")
1170 (assoc-ref outputs "out")))
1333eb58
DM
1171 #t))
1172 (delete 'configure))))
cc8d346b
DM
1173 (inputs
1174 `(("libx11" ,libx11)))
1175 (synopsis "Freecalypso host tools")
2eefe1d8 1176 (description "This package provides some tools for debugging FreeCalypso phones and the FreeCalypso FCDEV3B dev board.
cc8d346b
DM
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
1182strings of TCH bits to be fed to the GSM 05.03 channel encoder of a TI
1183Calypso 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
1186source format into a voice memo file that can be uploaded into the FFS of a
1187FreeCalypso device and played with the audio_vm_play_start() API or the
1188AT@@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
1192TI-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
1195interface. It is useful when no second UART is available for a dedicated
1196standard AT command interface. fc-shell is the tool that allows you to send
1197AT 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
1201allows you to manipulate the device's flash file system.
1202@item tiaud-compile: Compiles an audio mode configuration table for TI's
1203Audio Service from our own ASCII source format into the binary format for
1204uploading into FreeCalypso GSM device FFS with fc-fsio.
1205@item tiaud-decomp: Decodes TI's audio mode configuration files read out of
1206FFS into our own ASCII format.
1207@item tiaud-mkvol: Generates the *.vol binary files which need to accompany
1208the main *.cfg ones.
1209@item fc-compalram: Allows running programs on the device without writing
1210them to flash storage.
1211@item fc-xram: Allows running programs on the device without writing them
1212to flash storage.
1213@item fc-iram: Allows running programs on the device without writing them
1214to 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
1217flash image from Pirelli phones.
1218@item mokoffs: Allows listing and extracting FFS content captured as a raw
1219flash image from OpenMoko phones.
1220@item tiffs: Allows listing and extracting FFS content captured as a raw
1221flash image from TI phones.
1222@item c139explore: Run-from-RAM program for C139 phones that
1223exercises their peripheral hardware: LCD, keypad backlight, buzzer, vibrator.
1224@item pirexplore: Run-from-RAM program for Pirelli DP-L10 phones that
1225exercises their peripheral hardware, primarily their LCD.
1226@item tfc139: Breaks into Mot C1xx phones via shellcode injection, allowing
1227you to reflash locked phones with new firmware with fc-loadtool.
1228@item ctracedec: GSM firmwares built in TI's Windows environment have a
1229compressed trace misfeature whereby many of the ASCII strings
1230in debug trace messages get replaced with numeric indices at
1231build time, and these numeric indices are all that gets emitted
1232on the RVTMUX serial channel. This tools decodes these numeric indices
1233back to strings in trace output.
1234@item fc-cal2text: This utility takes a dump of TI's /gsm/rf flash file system
1235directory subtree as input (either extracted in vitro with tiffs
1236or read out in vivo with fc-fsio) and converts all RF tables
1237found 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
1240target Calypso GSM device.
1241@item fc-vm2hex: Converts the old-fashioned (non-AMR) voice memo files read
1242out of FFS into hex strings.
1243@item fc-buzplay: Plays piezoelectic buzzer melodies on an actual
1244Calypso device equipped with such a buzzer (Mot C1xx, TI's D-Sample board,
1245our planned future HSMBP) by loading a buzplayer agent onto the target and
1246feeding melodies to be played to it.
1247@item fc-tmsh: TI-based GSM firmwares provide a rich set of Test Mode commands
1248that can be issued through the RVTMUX (debug trace) serial channel.
1249This program is our test mode shell for sending Test Mode commands to targets
1250and displaying decoded target responses.
2eefe1d8
DM
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
cc8d346b
DM
1255@end enumerate")
1256 (home-page "https://www.freecalypso.org/")
1257 (license license:public-domain)))
615a7eec
CL
1258
1259(define-public stlink
1260 (package
1261 (name "stlink")
1262 (version "1.5.1")
1263 (source
1264 (origin
fe1506a0
EF
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))
615a7eec
CL
1270 (sha256
1271 (base32
fe1506a0 1272 "1d5gxiqpsm8fc105cxlp27af9fk339fap5h6nay21x5a7n61jgyc"))))
615a7eec
CL
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
1287Discovery boards. It supports two versions of the chip: ST-LINK/V1 (on
1288STM32VL discovery kits) and ST-LINK/V2 (on STM32L discovery and later kits).
1289Two different transport layers are used: ST-LINK/V1 uses SCSI passthru
1290commands over USB, and ST-LINK/V2 and ST-LINK/V2-1 (seen on Nucleo boards) use
1291raw 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+))))
2c2fc24b
CL
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
1317project. Its built-in commands provide a multiple repository management
1318system with features inspired by Google’s Repo tool and Git submodules. West
1319simplifies configuration and is also pluggable: you can write your own west
1320\"extension commands\" which add additional features to west. Zephyr uses
1321this feature to provide conveniences for building applications, flashing and
1322debugging them, and more.")
1323 (license license:expat)))