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