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