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