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