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