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