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