projects/guix·blob javascript-team · refs

2094 lines · 86.5 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016-2019, 2023-2026 Ricardo Wurmus <[email protected]>
3;;; Copyright © 2016, 2017 Theodoros Foradis <[email protected]>
4;;; Copyright © 2016 David Craven <[email protected]>
5;;; Copyright © 2017, 2020 Efraim Flashner <[email protected]>
6;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <[email protected]>
7;;; Copyright © 2018, 2019, 2021 Clément Lassieur <[email protected]>
8;;; Copyright © 2020, 2022 Marius Bakke <[email protected]>
9;;; Copyright © 2020 Björn Höfling <[email protected]>
10;;; Copyright © 2021 Julien Lepiller <[email protected]>
11;;; Copyright © 2020, 2021, 2022 Simon South <[email protected]>
12;;; Copyright © 2021 Morgan Smith <[email protected]>
13;;; Copyright © 2022 Mathieu Othacehe <[email protected]>
14;;; Copyright © 2022, 2023 Maxim Cournoyer <[email protected]>
15;;; Copyright © 2023 Janneke Nieuwenhuizen <[email protected]>
16;;; Copyright © 2024, 2026 Artyom V. Poptsov <[email protected]>
17;;; Copyright © 2025 Junker [email protected]
18;;; Copyright © 2025 Reza Housseini <[email protected]>
19;;;
20;;; This file is part of GNU Guix.
21;;;
22;;; GNU Guix is free software; you can redistribute it and/or modify it
23;;; under the terms of the GNU General Public License as published by
24;;; the Free Software Foundation; either version 3 of the License, or (at
25;;; your option) any later version.
26;;;
27;;; GNU Guix is distributed in the hope that it will be useful, but
28;;; WITHOUT ANY WARRANTY; without even the implied warranty of
29;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30;;; GNU General Public License for more details.
31;;;
32;;; You should have received a copy of the GNU General Public License
33;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
34
35;;; Commentary:
36;;;
37;;; This modules contains toolchain generators as well as packages for use in
38;;; embedded contexts. Note: the toolchain and specialized packages are
39;;; procedures, so as to delay their references to top level bindings such as
40;;; 'gcc' or 'cross-gcc', etc.
41;;;
42;;; Code:
43
44(define-module (gnu packages embedded)
45 #:use-module (guix utils)
46 #:use-module (guix packages)
47 #:use-module (guix deprecation)
48 #:use-module (guix download)
49 #:use-module (guix gexp)
50 #:use-module (guix memoization)
51 #:use-module (guix svn-download)
52 #:use-module (guix git-download)
53 #:use-module ((guix licenses) #:prefix license:)
54 #:use-module (guix build-system cargo)
55 #:use-module (guix build-system cmake)
56 #:use-module (guix build-system gnu)
57 #:use-module (guix build-system pyproject)
58 #:use-module (guix build-system trivial)
59 #:use-module ((guix build utils) #:select (alist-replace delete-file-recursively))
60 #:use-module (gnu packages)
61 #:use-module (gnu packages admin)
62 #:use-module (gnu packages autotools)
63 #:use-module (gnu packages base)
64 #:use-module (gnu packages bison)
65 #:use-module (gnu packages boost)
66 #:use-module (gnu packages build-tools)
67 #:use-module (gnu packages check)
68 #:use-module (gnu packages compression)
69 #:use-module (gnu packages cross-base)
70 #:use-module (gnu packages dejagnu)
71 #:use-module (gnu packages compiler-tools)
72 #:use-module (gnu packages gcc)
73 #:use-module (gnu packages gdb)
74 #:use-module (gnu packages guile)
75 #:use-module (gnu packages libffi)
76 #:use-module (gnu packages libftdi)
77 #:use-module (gnu packages libusb)
78 #:use-module (gnu packages linux)
79 #:use-module (gnu packages messaging)
80 #:use-module (gnu packages ncurses)
81 #:use-module (gnu packages perl)
82 #:use-module (gnu packages pkg-config)
83 #:use-module (gnu packages protobuf)
84 #:use-module (gnu packages python)
85 #:use-module (gnu packages python-build)
86 #:use-module (gnu packages python-crypto)
87 #:use-module (gnu packages python-web)
88 #:use-module (gnu packages python-xyz)
89 #:use-module (gnu packages qt)
90 #:use-module (gnu packages readline)
91 #:use-module (gnu packages rust)
92 #:use-module (gnu packages swig)
93 #:use-module (gnu packages texinfo)
94 #:use-module (gnu packages tls)
95 #:use-module (gnu packages version-control)
96 #:use-module (gnu packages xorg)
97 #:use-module (srfi srfi-1)
98 #:export (make-gcc-arm-none-eabi-4.9
99 make-gcc-arm-none-eabi-6
100 make-gcc-arm-none-eabi-7-2018-q2-update
101 make-gcc-arm-none-eabi-9-2020-q2-update
102 make-gcc-arm-none-eabi-12.3.rel1
103
104 make-newlib-arm-none-eabi
105 make-newlib-arm-none-eabi-7-2018-q2-update
106 make-newlib-arm-none-eabi-9-2020-q2-update
107 make-newlib-arm-none-eabi-12.3.rel1
108
109 make-newlib-nano-arm-none-eabi
110 make-newlib-nano-arm-none-eabi-7-2018-q2-update
111 make-newlib-nano-arm-none-eabi-9-2020-q2-update
112 make-newlib-nano-arm-none-eabi-12.3.rel1
113
114 make-arm-none-eabi-toolchain-4.9
115 make-arm-none-eabi-toolchain-6
116 make-arm-none-eabi-toolchain-7-2018-q2-update
117 make-arm-none-eabi-toolchain-9-2020-q2-update
118 make-arm-none-eabi-toolchain-12.3.rel1
119
120 make-arm-none-eabi-nano-toolchain-4.9
121 make-arm-none-eabi-nano-toolchain-6
122 make-arm-none-eabi-nano-toolchain-7-2018-q2-update
123 make-arm-none-eabi-nano-toolchain-9-2020-q2-update
124 make-arm-none-eabi-nano-toolchain-12.3.rel1
125
126 make-gdb-arm-none-eabi
127
128 make-propeller-gcc
129 make-propeller-gcc-4
130 make-propeller-gcc-6
131 make-propeller-toolchain))
132
133;; We must not use the released GCC sources here, because the cross-compiler
134;; does not produce working binaries. Instead we take the very same SVN
135;; revision from the branch that is used for a release of the "GCC ARM
136;; embedded" project on launchpad.
137;; See https://launchpadlibrarian.net/218827644/release.txt
138(define make-gcc-arm-none-eabi-4.9
139 (mlambda ()
140 (let ((xgcc (cross-gcc "arm-none-eabi"
141 #:xgcc gcc-4.9
142 #:xbinutils (cross-binutils "arm-none-eabi")))
143 (revision "1")
144 (svn-revision 227977))
145 (package
146 (inherit xgcc)
147 (version (string-append (package-version xgcc) "-"
148 revision "." (number->string svn-revision)))
149 (source
150 (origin
151 (method svn-fetch)
152 (uri (svn-reference
153 (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/\
154embedded-4_9-branch/")
155 (revision svn-revision)))
156 (file-name (string-append "gcc-arm-embedded-" version "-checkout"))
157 (sha256
158 (base32
159 "113r98kygy8rrjfv2pd3z6zlfzbj543pq7xyq8bgh72c608mmsbr"))
160
161 (patches (cons (search-patch "gcc-4.9-inline.patch")
162 ;; Remove the one patch that doesn't apply to this
163 ;; 4.9 snapshot (the patch is for 4.9.4 and later
164 ;; but this svn snapshot is older).
165 (remove (lambda (patch)
166 (string=? (basename patch)
167 "gcc-arm-bug-71399.patch"))
168 (origin-patches (package-source xgcc)))))))
169 (native-inputs
170 `(("flex" ,flex)
171 ("gcc@5" ,gcc-5)
172 ,@(package-native-inputs xgcc)))
173 (arguments
174 (substitute-keyword-arguments arguments
175 ((#:phases phases)
176 #~(modify-phases #$phases
177 (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
178 (lambda* (#:key inputs #:allow-other-keys)
179 (let ((gcc (assoc-ref inputs "gcc")))
180 ;; Remove the default compiler from CPLUS_INCLUDE_PATH
181 ;; to prevent header conflict with the GCC from
182 ;; native-inputs.
183 (setenv "CPLUS_INCLUDE_PATH"
184 (string-join
185 (delete (string-append gcc "/include/c++")
186 (string-split (getenv "CPLUS_INCLUDE_PATH")
187 #\:))
188 ":"))
189 (format #t
190 "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
191 (getenv "CPLUS_INCLUDE_PATH")))))
192 (add-after 'unpack 'fix-genmultilib
193 (lambda _
194 (substitute* "gcc/genmultilib"
195 (("#!/bin/sh") (string-append "#!" (which "sh"))))))))
196 ((#:configure-flags flags)
197 ;; The configure flags are largely identical to the flags used by the
198 ;; "GCC ARM embedded" project.
199 #~(append (list "--enable-multilib"
200 "--with-newlib"
201 "--with-multilib-list=armv6-m,armv7-m,armv7e-m"
202 "--with-host-libstdcxx=-static-libgcc \
203-Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
204 "--enable-plugins"
205 "--disable-decimal-float"
206 "--disable-libffi"
207 "--disable-libgomp"
208 "--disable-libmudflap"
209 "--disable-libquadmath"
210 "--disable-libssp"
211 "--disable-libstdcxx-pch"
212 "--disable-nls"
213 "--disable-shared"
214 "--disable-threads"
215 "--disable-tls")
216 (delete "--disable-multilib" #$flags)))))
217 (native-search-paths
218 (list (search-path-specification
219 (variable "CROSS_C_INCLUDE_PATH")
220 (files '("arm-none-eabi/include")))
221 (search-path-specification
222 (variable "CROSS_CPLUS_INCLUDE_PATH")
223 (files '("arm-none-eabi/include/c++"
224 "arm-none-eabi/include/c++/arm-none-eabi"
225 "arm-none-eabi/include")))
226 (search-path-specification
227 (variable "CROSS_LIBRARY_PATH")
228 (files '("arm-none-eabi/lib")))))))))
229
230(define make-gcc-arm-none-eabi-6
231 (mlambda ()
232 (package
233 (inherit (make-gcc-arm-none-eabi-4.9))
234 (version (package-version gcc-6))
235 (source (origin
236 (inherit (package-source gcc-6))
237 (patches
238 (append
239 (origin-patches (package-source gcc-6))
240 (search-patches "gcc-6-cross-environment-variables.patch"
241 "gcc-6-arm-none-eabi-multilib.patch"))))))))
242
243(define make-newlib-arm-none-eabi
244 (mlambda ()
245 (package
246 (name "newlib")
247 (version "2.4.0")
248 (source (origin
249 (method url-fetch)
250 (uri (string-append "ftp://sourceware.org/pub/newlib/newlib-"
251 version ".tar.gz"))
252 (sha256
253 (base32
254 "01i7qllwicf05vsvh39qj7qp5fdifpvvky0x95hjq39mbqiksnsl"))))
255 (build-system gnu-build-system)
256 (arguments
257 `(#:out-of-source? #t
258 ;; The configure flags are identical to the flags used by the "GCC ARM
259 ;; embedded" project.
260 #:configure-flags '("--target=arm-none-eabi"
261 "--enable-newlib-io-long-long"
262 "--enable-newlib-register-fini"
263 "--disable-newlib-supplied-syscalls"
264 "--disable-nls")
265 #:phases
266 (modify-phases %standard-phases
267 (add-after 'unpack 'fix-references-to-/bin/sh
268 (lambda _
269 (substitute* (find-files "libgloss" "^Makefile\\.in$")
270 (("/bin/sh") (which "sh")))
271 #t)))))
272 (native-inputs
273 `(("xbinutils" ,(cross-binutils "arm-none-eabi"))
274 ("xgcc" ,(make-gcc-arm-none-eabi-4.9))
275 ("texinfo" ,texinfo)))
276 (home-page "https://www.sourceware.org/newlib/")
277 (synopsis "C library for use on embedded systems")
278 (description "Newlib is a C library intended for use on embedded
279systems. It is a conglomeration of several library parts that are easily
280usable on embedded products.")
281 (license (license:non-copyleft
282 "https://www.sourceware.org/newlib/COPYING.NEWLIB")))))
283
284(define make-newlib-nano-arm-none-eabi
285 (mlambda ()
286 (let ((base (make-newlib-arm-none-eabi)))
287 (package
288 (inherit base)
289 (name "newlib-nano")
290 (arguments
291 (substitute-keyword-arguments arguments
292 ;; The configure flags are identical to the flags used by the "GCC
293 ;; ARM embedded" project. They optimize newlib for use on small
294 ;; embedded systems with limited memory.
295 ((#:configure-flags _)
296 ''("--target=arm-none-eabi"
297 "--enable-multilib"
298 "--disable-newlib-supplied-syscalls"
299 "--enable-newlib-reent-small"
300 "--disable-newlib-fvwrite-in-streamio"
301 "--disable-newlib-fseek-optimization"
302 "--disable-newlib-wide-orient"
303 "--enable-newlib-nano-malloc"
304 "--disable-newlib-unbuf-stream-opt"
305 "--enable-lite-exit"
306 "--enable-newlib-global-atexit"
307 "--enable-newlib-nano-formatted-io"
308 "--disable-nls"))
309 ((#:phases phases)
310 `(modify-phases ,phases
311 ;; XXX: Most arm toolchains offer both *.a and *_nano.a as
312 ;; newlib and newlib-nano respectively. The headers are
313 ;; usually arm-none-eabi/include/newlib.h for newlib and
314 ;; arm-none-eabi/include/newlib-nano/newlib.h for newlib-nano.
315 ;; We have two different toolchain packages for each which
316 ;; works but is a little strange.
317 (add-after 'install 'hardlink-newlib
318 (lambda* (#:key outputs #:allow-other-keys)
319 (let ((out (assoc-ref outputs "out")))
320 ;; The nano.specs file says that newlib-nano files should
321 ;; end in "_nano.a" instead of just ".a". Note that this
322 ;; applies to all the multilib folders too.
323 (for-each
324 (lambda (file)
325 (link file
326 (string-append
327 ;; Strip ".a" off the end
328 (substring file 0 (- (string-length file) 2))
329 ;; Add "_nano.a" onto the end
330 "_nano.a")))
331 (find-files
332 out
333 "^(libc.a|libg.a|librdimon.a|libstdc\\+\\+.a|\
334libsupc\\+\\+.a)$"))
335
336 ;; newlib.h is usually in this location instead so both
337 ;; newlib and newlib-nano can be in the toolchain at the
338 ;; same time
339 (mkdir (string-append
340 out "/arm-none-eabi/include/newlib-nano"))
341 (symlink
342 "../newlib.h"
343 (string-append
344 out
345 "/arm-none-eabi/include/newlib-nano/newlib.h")))))))))
346 (synopsis "Newlib variant for small systems with limited memory")))))
347
348
349;;; The following definitions are for the "7-2018-q2-update" variant of the
350;;; ARM cross toolchain as offered on https://developer.arm.com
351(define make-gcc-arm-none-eabi-7-2018-q2-update
352 (mlambda ()
353 (let ((xgcc (cross-gcc "arm-none-eabi"
354 #:xgcc gcc-7
355 #:xbinutils (cross-binutils "arm-none-eabi")))
356 (revision "1")
357 (svn-revision 261907))
358 (package (inherit xgcc)
359 (version (string-append "7-2018-q2-update-"
360 revision "."
361 (number->string svn-revision)))
362 (source
363 (origin
364 (method svn-fetch)
365 (uri (svn-reference
366 (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/\
367embedded-7-branch/")
368 (revision svn-revision)))
369 (file-name (string-append "gcc-arm-embedded-" version
370 "-checkout"))
371 (sha256
372 (base32
373 "192ggs63bixf3irpijgfkjks73yx1r3a4i6grk1y0i0iny76pmx5"))
374 (patches
375 (append
376 (origin-patches (package-source gcc-7))
377 (search-patches
378 "gcc-7-cross-environment-variables.patch")))))
379 (native-inputs
380 (modify-inputs native-inputs
381 (delete "isl")
382 (prepend flex isl-0.18)))
383 (arguments
384 (substitute-keyword-arguments arguments
385 ((#:phases phases)
386 #~(modify-phases #$phases
387 (add-after 'unpack 'expand-version-string
388 (lambda _
389 (make-file-writable "gcc/DEV-PHASE")
390 (with-output-to-file "gcc/DEV-PHASE"
391 (lambda ()
392 (display "7-2018-q2-update")))))
393 (add-after 'unpack 'fix-genmultilib
394 (lambda _
395 (substitute* "gcc/genmultilib"
396 (("#!/bin/sh")
397 (string-append "#!" (which "sh"))))))
398 (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
399 (lambda* (#:key inputs #:allow-other-keys)
400 (let ((gcc (assoc-ref inputs "gcc")))
401 ;; Remove the default compiler from
402 ;; CPLUS_INCLUDE_PATH to prevent header conflict
403 ;; with the GCC from native-inputs.
404 (setenv "CPLUS_INCLUDE_PATH"
405 (string-join
406 (delete (string-append gcc "/include/c++")
407 (string-split
408 (getenv "CPLUS_INCLUDE_PATH")
409 #\:))
410 ":"))
411 (format #t
412 "environment variable `CPLUS_INCLUDE_PATH'\
413 changed to ~a~%"
414 (getenv "CPLUS_INCLUDE_PATH")))))))
415 ((#:configure-flags flags)
416 ;; The configure flags are largely identical to the flags
417 ;; used by the "GCC ARM embedded" project.
418 #~(append (list "--enable-multilib"
419 "--with-newlib"
420 "--with-multilib-list=rmprofile"
421 "--with-host-libstdcxx=-static-libgcc \
422-Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
423 "--enable-plugins"
424 "--disable-decimal-float"
425 "--disable-libffi"
426 "--disable-libgomp"
427 "--disable-libmudflap"
428 "--disable-libquadmath"
429 "--disable-libssp"
430 "--disable-libstdcxx-pch"
431 "--disable-nls"
432 "--disable-shared"
433 "--disable-threads"
434 "--disable-tls")
435 (delete "--disable-multilib" #$flags)))))
436 (native-search-paths
437 (list (search-path-specification
438 (variable "CROSS_C_INCLUDE_PATH")
439 (files '("arm-none-eabi/include")))
440 (search-path-specification
441 (variable "CROSS_CPLUS_INCLUDE_PATH")
442 (files '("arm-none-eabi/include/c++"
443 "arm-none-eabi/include/c++/arm-none-eabi"
444 "arm-none-eabi/include")))
445 (search-path-specification
446 (variable "CROSS_LIBRARY_PATH")
447 (files '("arm-none-eabi/lib")))))))))
448
449(define make-base-newlib-arm-none-eabi-7-2018-q2-update
450 ;; This is the same commit as used for the 7-2018-q2-update release
451 ;; according to the release.txt.
452 (mlambda (base)
453 (let ((commit "3ccfb407af410ba7e54ea0da11ae1e40b554a6f4")
454 (revision "0"))
455 (package
456 (inherit base)
457 (version (git-version "3.0.0" revision commit))
458 (source
459 (origin
460 (method git-fetch)
461 (uri (git-reference
462 (url "http://sourceware.org/git/newlib-cygwin.git")
463 (commit commit)))
464 (file-name (git-file-name "newlib" commit))
465 (sha256
466 (base32
467 "1dq23fqrk75g1a4v7569fvnnw5q440zawbxi3w0g05n8jlqsmvcy"))))
468 (arguments
469 (substitute-keyword-arguments arguments
470 ;; The configure flags are identical to the flags used by the "GCC
471 ;; ARM embedded" project.
472 ((#:configure-flags flags)
473 `(cons* "--enable-newlib-io-c99-formats"
474 "--enable-newlib-retargetable-locking"
475 "--with-headers=yes"
476 ,flags))))
477 (native-inputs
478 `(("xbinutils" ,(cross-binutils "arm-none-eabi"))
479 ("xgcc" ,(make-gcc-arm-none-eabi-7-2018-q2-update))
480 ("texinfo" ,texinfo)))))))
481
482(define make-newlib-arm-none-eabi-7-2018-q2-update
483 (mlambda ()
484 (make-base-newlib-arm-none-eabi-7-2018-q2-update (make-newlib-arm-none-eabi))))
485
486(define make-newlib-nano-arm-none-eabi-7-2018-q2-update
487 (mlambda ()
488 (make-base-newlib-arm-none-eabi-7-2018-q2-update (make-newlib-nano-arm-none-eabi))))
489
490
491;;; The following definitions are for the "9-2020-q2-update" variant of the
492;;; ARM cross toolchain as offered on https://developer.arm.com
493(define make-gcc-arm-none-eabi-9-2020-q2-update
494 (mlambda ()
495 (let ((xgcc (cross-gcc "arm-none-eabi"
496 #:xgcc gcc-9
497 #:xbinutils (cross-binutils "arm-none-eabi")))
498 (commit "13861a80750d118fbdca6006ab175903bacbb7ec")
499 (revision "1"))
500 (package (inherit xgcc)
501 (version (git-version "9-2020-q2-update" revision commit))
502 (source
503 (origin
504 (inherit (package-source xgcc))
505 (method git-fetch)
506 (uri (git-reference
507 (url "git://gcc.gnu.org/git/gcc.git")
508 (commit commit)))
509 (file-name (git-file-name "gcc-arm-embedded" version))
510 (sha256
511 (base32
512 "1cshb1wbynjac3icbf2na633k4d8r7nqn4nv0d65q6f78w295h97"))
513 (patches
514 (append
515 (origin-patches (package-source gcc-9))
516 (search-patches
517 "gcc-10-cross-environment-variables.patch")))))
518 (native-inputs
519 (modify-inputs native-inputs
520 (delete "isl")
521 (prepend flex isl-0.18)))
522 (arguments
523 (substitute-keyword-arguments arguments
524 ((#:phases phases)
525 #~(modify-phases #$phases
526 (add-after 'unpack 'expand-version-string
527 (lambda _
528 (make-file-writable "gcc/DEV-PHASE")
529 (with-output-to-file "gcc/DEV-PHASE"
530 (lambda ()
531 (display "9-2020-q2-update")))))
532 (add-after 'unpack 'fix-genmultilib
533 (lambda _
534 (substitute* "gcc/genmultilib"
535 (("#!/bin/sh")
536 (string-append "#!" (which "sh"))))))
537 (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
538 (lambda* (#:key inputs #:allow-other-keys)
539 (let ((gcc (assoc-ref inputs "gcc")))
540 ;; Remove the default compiler from
541 ;; CPLUS_INCLUDE_PATH to prevent header conflict
542 ;; with the GCC from native-inputs.
543 (setenv "CPLUS_INCLUDE_PATH"
544 (string-join
545 (delete (string-append gcc "/include/c++")
546 (string-split
547 (getenv "CPLUS_INCLUDE_PATH")
548 #\:))
549 ":"))
550 (format #t
551 "environment variable `CPLUS_INCLUDE_PATH'\
552 changed to ~a~%"
553 (getenv "CPLUS_INCLUDE_PATH")))))))
554 ((#:configure-flags flags)
555 ;; The configure flags are largely identical to the flags
556 ;; used by the "GCC ARM embedded" project.
557 #~(append (list "--enable-multilib"
558 "--with-newlib"
559 "--with-multilib-list=rmprofile"
560 "--with-host-libstdcxx=-static-libgcc \
561-Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
562 "--enable-plugins"
563 "--disable-decimal-float"
564 "--disable-libffi"
565 "--disable-libgomp"
566 "--disable-libmudflap"
567 "--disable-libquadmath"
568 "--disable-libssp"
569 "--disable-libstdcxx-pch"
570 "--disable-nls"
571 "--disable-shared"
572 "--disable-threads"
573 "--disable-tls")
574 (delete "--disable-multilib" #$flags)))))
575 (native-search-paths
576 (list (search-path-specification
577 (variable "CROSS_C_INCLUDE_PATH")
578 (files '("arm-none-eabi/include")))
579 (search-path-specification
580 (variable "CROSS_CPLUS_INCLUDE_PATH")
581 (files '("arm-none-eabi/include/c++"
582 "arm-none-eabi/include/c++/arm-none-eabi"
583 "arm-none-eabi/include")))
584 (search-path-specification
585 (variable "CROSS_LIBRARY_PATH")
586 (files '("arm-none-eabi/lib")))))))))
587
588(define make-base-newlib-arm-none-eabi-9-2020-q2-update
589 ;; This is the same commit as used for the 9-2020-q2-update release
590 ;; according to the release.txt.
591 (mlambda (base)
592 (let ((commit "6d79e0a58866548f435527798fbd4a6849d05bc7")
593 (revision "0"))
594 (package
595 (inherit base)
596 (version (git-version "3.3.0" revision commit))
597 (source
598 (origin
599 (method git-fetch)
600 (uri (git-reference
601 (url "http://sourceware.org/git/newlib-cygwin.git")
602 (commit commit)))
603 (file-name (git-file-name "newlib" version))
604 (sha256
605 (base32
606 "095j23mg928rmf4yqmj39wc0nsd207liqrdw4ygh58nygsm4gpmh"))))
607 (arguments
608 (substitute-keyword-arguments arguments
609 ;; The configure flags are identical to the flags used by the "GCC
610 ;; ARM embedded" project.
611 ((#:configure-flags flags)
612 `(cons* "--enable-newlib-io-c99-formats"
613 "--enable-newlib-retargetable-locking"
614 "--with-headers=yes"
615 ,flags))))
616 (native-inputs
617 `(("xbinutils" ,(cross-binutils "arm-none-eabi"))
618 ("xgcc" ,(make-gcc-arm-none-eabi-9-2020-q2-update))
619 ("texinfo" ,texinfo)))))))
620
621(define make-newlib-arm-none-eabi-9-2020-q2-update
622 (mlambda ()
623 (make-base-newlib-arm-none-eabi-9-2020-q2-update (make-newlib-arm-none-eabi))))
624
625(define make-newlib-nano-arm-none-eabi-9-2020-q2-update
626 (mlambda ()
627 (make-base-newlib-arm-none-eabi-9-2020-q2-update (make-newlib-nano-arm-none-eabi))))
628
629
630;;; The following definitions are for the "12.3.rel1" variant of the
631;;; ARM cross toolchain as offered on https://developer.arm.com
632(define-public make-gcc-arm-none-eabi-12.3.rel1
633 (mlambda ()
634 (let ((base (make-gcc-arm-none-eabi-7-2018-q2-update))
635 (xgcc-base (cross-gcc "arm-none-eabi"
636 #:xgcc gcc-12
637 #:xbinutils (cross-binutils "arm-none-eabi"))))
638 (package
639 (inherit base)
640 (version "12.3.rel1")
641 (source
642 (origin
643 (inherit (package-source xgcc-base))
644 (method git-fetch)
645 (uri (git-reference
646 (url "git://gcc.gnu.org/git/gcc.git")
647 (commit "0f54a73b998b72f7c8452a63730ec3b16fc47854")))
648 (sha256
649 (base32 "0r6q0m3d8g3k3rkmnqjw8aw5fcnsrmywf4ispdkxmk1al3whk1vk"))))
650 (arguments
651 (substitute-keyword-arguments arguments
652 ((#:phases phases)
653 #~(modify-phases #$phases
654 (replace 'expand-version-string
655 (lambda _
656 (make-file-writable "gcc/DEV-PHASE")
657 (with-output-to-file "gcc/DEV-PHASE"
658 (lambda ()
659 (display "12.3.rel1")))))))
660 ((#:configure-flags flags)
661 #~(cons* "--with-multilib-list=aprofile,rmprofile"
662 "--with-headers=yes"
663 "--enable-checking=release"
664 "--with-gnu-as"
665 "--with-gnu-ld"
666 (filter
667 (lambda (flag)
668 (not (member flag
669 '("--with-multilib-list=rmprofile"
670 "--enable-plugins"
671 "--disable-libffi"))))
672 #$flags)))))))))
673
674(define make-base-newlib-arm-none-eabi-12.3.rel1
675 (mlambda (original-base)
676 (let ((base (make-base-newlib-arm-none-eabi-7-2018-q2-update original-base))
677 (commit "4c7d0dfec5793cbf5cf3930b91f930479126d8ce")
678 (revision "0"))
679 (package
680 (inherit base)
681 (version (git-version "4.3.0" revision commit))
682 (source
683 (origin
684 (method git-fetch)
685 (uri (git-reference
686 (url "http://sourceware.org/git/newlib-cygwin.git")
687 (commit commit)))
688 (sha256
689 (base32
690 "0drs9v8avh4y2h5bs0ixjn9x662jzkkikx8z034wgl41dxmn6786"))))
691 (arguments (substitute-keyword-arguments arguments
692 ((#:configure-flags flags)
693 #~(cons* "--enable-newlib-mb"
694 "--enable-newlib-reent-check-verify"
695 "--enable-newlib-register-fini"
696 #$flags))))))))
697
698(define make-newlib-arm-none-eabi-12.3.rel1
699 (mlambda ()
700 (make-base-newlib-arm-none-eabi-12.3.rel1 (make-newlib-arm-none-eabi))))
701
702(define make-newlib-nano-arm-none-eabi-12.3.rel1
703 (mlambda ()
704 (make-base-newlib-arm-none-eabi-12.3.rel1 (make-newlib-nano-arm-none-eabi))))
705
706
707(define make-libstdc++-arm-none-eabi
708 (mlambda (xgcc newlib)
709 (let* ((libstdc++ (make-libstdc++ xgcc))
710 (src (package-source libstdc++)))
711 (package
712 (inherit libstdc++)
713 (source
714 (origin
715 (inherit src)
716 (patches (append
717 ; libstdc++ cannot be linked with since the configure phase
718 ; cannot detect properly the presence of getentropy function.
719 ; The function is inside of a header, but it's not present in the resulting
720 ; newlib. configure will conclude getentropy is present,
721 ; random will use getentropy, and any linking with random will fail.
722 (if (version>=? (package-version xgcc) "12.0")
723 (search-patches "newlib-getentropy.patch")
724 '())
725 (origin-patches src)))))
726 (name "libstdc++-arm-none-eabi")
727 (arguments
728 (substitute-keyword-arguments (package-arguments libstdc++)
729 ((#:make-flags flags #f)
730 #~(cons* "CFLAGS=-g -O2 -fdata-sections -ffunction-sections"
731 "CXXFLAGS=-g -O2 -fdata-sections -ffunction-sections"
732 (or #$flags '())))
733 ((#:configure-flags _)
734 ``(; This is more of a hack. This option doesn't really seem
735 ; to change what subdir is used eventually, but without it there is
736 ; error: Link tests are not allowed after GCC_NO_EXECUTABLES with
737 ; The 12.3 toolchain
738 "--with-target-subdir=\".\""
739 "--target=arm-none-eabi"
740 "--host=arm-none-eabi"
741 "--disable-libstdcxx-pch"
742 "--enable-multilib"
743 "--with-multilib-list=armv6-m,armv7-m,armv7e-m"
744 "--disable-shared"
745 "--disable-tls"
746 "--disable-plugin"
747 "--with-newlib"
748 ,(string-append "--libdir="
749 (assoc-ref %outputs "out")
750 "/arm-none-eabi/lib")
751 ,(string-append "--with-gxx-include-dir="
752 (assoc-ref %outputs "out")
753 "/arm-none-eabi/include/c++")))
754 ((#:strip-directories _ #f)
755 ''("arm-none-eabi/lib"))))
756 (native-inputs
757 `(("newlib" ,newlib)
758 ("xgcc" ,xgcc)
759 ,@(package-native-inputs libstdc++)))))))
760
761(define make-libstdc++-nano-arm-none-eabi
762 (mlambda (xgcc newlib-nano)
763 (let ((base (make-libstdc++-arm-none-eabi xgcc newlib-nano)))
764 (package
765 (inherit base)
766 (name "libstdc++-nano-arm-none-eabi")
767 (arguments (substitute-keyword-arguments arguments
768 ((#:make-flags flags)
769 #~(map (lambda (flag)
770 (if (or (string-prefix? "CFLAGS=" flag)
771 (string-prefix? "CXXFLAGS=" flag))
772 (string-append flag " -fno-exceptions")
773 flag))
774 #$flags))
775 ((#:phases phases)
776 #~(modify-phases #$phases
777 (add-after 'install 'hardlink-libstdc++
778 ;; XXX: Most arm toolchains offer both *.a and *_nano.a as
779 ;; newlib and newlib-nano respectively. The headers are
780 ;; usually arm-none-eabi/include/newlib.h for newlib and
781 ;; arm-none-eabi/include/newlib-nano/newlib.h for newlib-nano.
782 ;; We have two different toolchain packages for each which
783 ;; works but is a little strange.
784 (lambda* (#:key outputs #:allow-other-keys)
785 (let ((out (assoc-ref outputs "out")))
786 ;; The nano.specs file says that newlib-nano files should
787 ;; end in "_nano.a" instead of just ".a". Note that this
788 ;; applies to all the multilib folders too.
789 (for-each
790 (lambda (file)
791 (link file
792 (string-append
793 ;; Strip ".a" off the end
794 (substring file 0 (- (string-length file) 2))
795 ;; Add "_nano.a" onto the end
796 "_nano.a")))
797 (find-files
798 out "^(libstdc\\+\\+.a|libsupc\\+\\+.a)$")))))))))))))
799
800(define make-arm-none-eabi-toolchain
801 (mlambda (xgcc newlib)
802 "Produce a cross-compiler toolchain package with the compiler XGCC and the
803C library variant NEWLIB."
804 (let* ((nano? (string=? (package-name newlib)
805 "newlib-nano"))
806 (newlib-with-xgcc
807 (package
808 (inherit newlib)
809 (native-inputs
810 (alist-replace "xgcc" (list xgcc)
811 (package-native-inputs newlib)))))
812 (libstdc++
813 (if nano?
814 (make-libstdc++-nano-arm-none-eabi xgcc newlib-with-xgcc)
815 (make-libstdc++-arm-none-eabi xgcc newlib-with-xgcc))))
816 (package
817 (name (string-append "arm-none-eabi"
818 (if nano? "-nano" "")
819 "-toolchain"))
820 (version (package-version xgcc))
821 (source #f)
822 (build-system trivial-build-system)
823 (arguments
824 '(#:modules ((guix build union))
825 #:builder
826 (begin
827 (use-modules (ice-9 match)
828 (guix build union))
829 (match %build-inputs
830 (((names . directories) ...)
831 (union-build (assoc-ref %outputs "out")
832 directories))))))
833 (propagated-inputs
834 `(("binutils" ,(cross-binutils "arm-none-eabi"))
835 ("libstdc++" ,libstdc++)
836 ("gcc" ,xgcc)
837 ("newlib" ,newlib-with-xgcc)))
838 (synopsis "Complete GCC tool chain for ARM bare metal development")
839 (description "This package provides a complete GCC tool chain for ARM
840bare metal development. This includes the GCC arm-none-eabi cross compiler
841and newlib (or newlib-nano) as the C library. The supported programming
842languages are C and C++.")
843 (home-page (package-home-page xgcc))
844 (license (package-license xgcc))))))
845
846(define make-arm-none-eabi-toolchain-4.9
847 (mlambda ()
848 (make-arm-none-eabi-toolchain (make-gcc-arm-none-eabi-4.9)
849 (make-newlib-arm-none-eabi))))
850
851(define make-arm-none-eabi-nano-toolchain-4.9
852 (mlambda ()
853 (make-arm-none-eabi-toolchain (make-gcc-arm-none-eabi-4.9)
854 (make-newlib-nano-arm-none-eabi))))
855
856(define make-arm-none-eabi-toolchain-6
857 (mlambda ()
858 (make-arm-none-eabi-toolchain (make-gcc-arm-none-eabi-6)
859 (make-newlib-arm-none-eabi))))
860
861(define make-arm-none-eabi-nano-toolchain-6
862 (mlambda ()
863 (make-arm-none-eabi-toolchain (make-gcc-arm-none-eabi-6)
864 (make-newlib-nano-arm-none-eabi))))
865
866(define make-arm-none-eabi-toolchain-7-2018-q2-update
867 (mlambda ()
868 (make-arm-none-eabi-toolchain
869 (make-gcc-arm-none-eabi-7-2018-q2-update)
870 (make-newlib-arm-none-eabi-7-2018-q2-update))))
871
872(define make-arm-none-eabi-nano-toolchain-7-2018-q2-update
873 (mlambda ()
874 (make-arm-none-eabi-toolchain
875 (make-gcc-arm-none-eabi-7-2018-q2-update)
876 (make-newlib-nano-arm-none-eabi-7-2018-q2-update))))
877
878(define make-arm-none-eabi-toolchain-9-2020-q2-update
879 (mlambda ()
880 (make-arm-none-eabi-toolchain
881 (make-gcc-arm-none-eabi-9-2020-q2-update)
882 (make-newlib-arm-none-eabi-9-2020-q2-update))))
883
884(define make-arm-none-eabi-nano-toolchain-9-2020-q2-update
885 (mlambda ()
886 (make-arm-none-eabi-toolchain
887 (make-gcc-arm-none-eabi-9-2020-q2-update)
888 (make-newlib-nano-arm-none-eabi-9-2020-q2-update))))
889
890(define make-arm-none-eabi-toolchain-12.3.rel1
891 (mlambda ()
892 (make-arm-none-eabi-toolchain
893 (make-gcc-arm-none-eabi-12.3.rel1)
894 (make-newlib-arm-none-eabi-12.3.rel1))))
895
896(define make-arm-none-eabi-nano-toolchain-12.3.rel1
897 (mlambda ()
898 (make-arm-none-eabi-toolchain
899 (make-gcc-arm-none-eabi-12.3.rel1)
900 (make-newlib-nano-arm-none-eabi-12.3.rel1))))
901
902(define make-gdb-arm-none-eabi
903 (mlambda ()
904 (package
905 (inherit gdb)
906 (name "gdb-arm-none-eabi")
907 (arguments
908 (substitute-keyword-arguments arguments
909 ((#:configure-flags flags '())
910 #~(cons* "--target=arm-none-eabi"
911 "--enable-multilib"
912 "--enable-interwork"
913 "--enable-languages=c,c++"
914 "--disable-nls"
915 #$flags)))))))
916
917(define-public libjaylink
918 (package
919 (name "libjaylink")
920 (version "0.3.1")
921 (source (origin
922 (method git-fetch)
923 (uri (git-reference
924 (url "https://repo.or.cz/libjaylink.git")
925 (commit version)))
926 (file-name (git-file-name name version))
927 (sha256
928 (base32
929 "1wps72ir2kwdr7dphx4vp6cy0d46dm3nkwbk0mpryn9la09l7lm1"))))
930 (build-system gnu-build-system)
931 (native-inputs
932 (list autoconf automake libtool pkg-config))
933 (inputs
934 (list libusb))
935 (home-page "https://repo.or.cz/w/libjaylink.git")
936 (synopsis "Library to interface Segger J-Link devices")
937 (description "libjaylink is a shared library written in C to access
938SEGGER J-Link and compatible devices.")
939 (license license:gpl2+)))
940
941;; Deprecated on 2026-06-27.
942(define-deprecated/public-alias jimtcl
943 (@ (gnu packages tcl) jimtcl))
944
945(define-public openocd
946 ;; OpenOCD latest release was in 2023 and incompatible with Jim Tcl 0.84.
947 (let ((commit "2fe5eaefbd887f03ad30c9ba481ad25d9adf0f37")
948 (revision "0"))
949 (package
950 (name "openocd")
951 (version (git-version "0.12.0" revision commit))
952 (source
953 (origin
954 (method git-fetch)
955 (uri (git-reference
956 (url "https://git.code.sf.net/p/openocd/code")
957 (commit commit)))
958 (file-name (git-file-name name version))
959 (sha256
960 (base32 "0rbgkwlwrx3gh1d7q7giqgvg62hki5w03n0ap51mw2avdc6ncbcy"))))
961 (build-system gnu-build-system)
962 (arguments
963 (list
964 #:configure-flags
965 #~(cons* "LIBS=-lutil -lcrypto -lssl"
966 "--disable-werror"
967 "--disable-internal-jimtcl"
968 "--disable-internal-libjaylink"
969 (map (lambda (programmer)
970 (string-append "--enable-" programmer))
971 '("amtjtagaccel" "armjtagew" "buspirate" "ftdi"
972 "gw16012" "jlink" "opendous" "osbdm"
973 "parport" "aice" "cmsis-dap" "dummy" "jtag_vpi"
974 "remote-bitbang" "rlink" "stlink" "ti-icdi" "ulink"
975 "usbprog" "vsllink" "usb-blaster-2" "usb_blaster"
976 "presto" "openjtag" "rshim" "ft232r" "xds110"
977 "cmsis-dap-v2" "nulink" "kitprog" "jtag_dpi"
978 "bcm2835gpio" "imx_gpio" "ep93xx" "at91rm9200"
979 "sysfsgpio" "xlnx-pcie-xvc")))
980 #:phases
981 #~(modify-phases %standard-phases
982 (replace 'bootstrap
983 (lambda _
984 ;; Make build reproducible.
985 (substitute* "src/Makefile.am"
986 (("-DPKGBLDDATE=") "-DDISABLED_PKGBLDDATE="))
987 (patch-shebang "bootstrap")
988 (invoke "./bootstrap" "nosubmodule")))
989 (add-after 'unpack 'change-udev-group
990 (lambda _
991 (substitute* "contrib/60-openocd.rules"
992 (("plugdev") "dialout"))))
993 (add-after 'install 'install-udev-rules
994 (lambda _
995 (install-file "contrib/60-openocd.rules"
996 (string-append
997 #$output "/lib/udev/rules.d/")))))))
998 (native-inputs
999 (list autoconf
1000 automake
1001 libtool
1002 which
1003 pkg-config
1004 texinfo))
1005 (inputs
1006 (list hidapi (@ (gnu packages tcl) jimtcl) libftdi libjaylink openssl))
1007 (home-page "https://openocd.org/")
1008 (synopsis "On-Chip Debugger")
1009 (description "OpenOCD provides on-chip programming and debugging support
1010with a layered architecture of JTAG interface and TAP support.")
1011 (license license:gpl2+))))
1012
1013;; The commits for all propeller tools are the stable versions published at
1014;; https://github.com/propellerinc/propgcc in the release_1_0. According to
1015;; personal correspondence with the developers in July 2017, more recent
1016;; versions are currently incompatible with the "Simple Libraries".
1017
1018(define make-propeller-binutils
1019 (mlambda ()
1020 (let ((xbinutils (cross-binutils "propeller-elf"))
1021 (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
1022 (revision "2"))
1023 (package
1024 (inherit xbinutils)
1025 (name "propeller-binutils")
1026 (version (string-append "0.0.0-" revision "." (string-take commit 9)))
1027 (source (origin
1028 (inherit (package-source xbinutils))
1029 (method git-fetch)
1030 (uri (git-reference
1031 (url "https://github.com/parallaxinc/propgcc")
1032 (commit commit)))
1033 (file-name (string-append name "-" commit "-checkout"))
1034 (sha256
1035 (base32
1036 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
1037 (patches '())))
1038 (arguments
1039 (substitute-keyword-arguments arguments
1040 ((#:configure-flags flags)
1041 #~(cons "--disable-werror" #$flags))
1042 ;; FIXME: For some reason there are many test failures. It's not
1043 ;; obvious how to fix the failures.
1044 ((#:tests? tests? #false) #false)
1045 ((#:phases phases '%standard-phases)
1046 `(modify-phases ,phases
1047 (add-after 'unpack 'chdir
1048 (lambda _ (chdir "binutils")))))))
1049 (native-inputs
1050 `(("bison" ,bison)
1051 ("flex" ,flex)
1052 ("texinfo" ,texinfo)
1053 ("dejagnu" ,dejagnu)
1054 ,@(package-native-inputs xbinutils)))))))
1055
1056(define make-propeller-gcc-6
1057 (mlambda ()
1058 (let ((xgcc (cross-gcc "propeller-elf"
1059 #:xbinutils (make-propeller-binutils)))
1060 (commit "b4f45a4725e0b6d0af59e594c4e3e35ca4105867")
1061 (revision "1"))
1062 (package
1063 (inherit xgcc)
1064 (name "propeller-gcc")
1065 (version (string-append "6.0.0-" revision "." (string-take commit 9)))
1066 (source (origin
1067 (method git-fetch)
1068 (uri (git-reference
1069 (url "https://github.com/totalspectrum/gcc-propeller")
1070 (commit commit)))
1071 (file-name (string-append name "-" commit "-checkout"))
1072 (sha256
1073 (base32
1074 "0d9kdxm2fzanjqa7q5850kzbsfl0fqyaahxn74h6nkxxacwa11zb"))
1075 (patches
1076 (append
1077 (origin-patches (package-source gcc-6))
1078 (search-patches "gcc-cross-environment-variables.patch")))))
1079 (native-inputs
1080 (modify-inputs native-inputs
1081 (prepend flex)))
1082 ;; All headers and cross libraries of the propeller toolchain are
1083 ;; installed under the "propeller-elf" prefix.
1084 (native-search-paths
1085 (list (search-path-specification
1086 (variable "CROSS_C_INCLUDE_PATH")
1087 (files '("propeller-elf/include")))
1088 (search-path-specification
1089 (variable "CROSS_LIBRARY_PATH")
1090 (files '("propeller-elf/lib")))))
1091 (home-page "https://github.com/totalspectrum/gcc-propeller")
1092 (synopsis "GCC for the Parallax Propeller")))))
1093
1094(define make-propeller-gcc-4
1095 (mlambda ()
1096 (let ((xgcc (make-propeller-gcc-6))
1097 (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
1098 (revision "2"))
1099 (package
1100 (inherit xgcc)
1101 (name "propeller-gcc")
1102 (version (string-append "4.6.1-" revision "." (string-take commit 9)))
1103 (source (origin
1104 (method git-fetch)
1105 (uri (git-reference
1106 (url "https://github.com/parallaxinc/propgcc")
1107 (commit commit)))
1108 (file-name (string-append name "-" commit "-checkout"))
1109 (sha256
1110 (base32
1111 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
1112 (patch-flags (list "-p1" "--directory=gcc"))
1113 (patches
1114 (append
1115 (origin-patches (package-source gcc-base))
1116 (search-patches
1117 "gcc-cross-environment-variables.patch")))))
1118 (arguments
1119 (substitute-keyword-arguments arguments
1120 ((#:phases phases)
1121 #~(modify-phases #$phases
1122 (delete 'pre-x86-configure)
1123 (add-after 'unpack 'chdir
1124 (lambda _ (chdir "gcc")))))))
1125 (native-inputs
1126 (modify-inputs native-inputs
1127 (prepend gcc-5)))
1128 (home-page "https://github.com/parallaxinc/propgcc")
1129 (supported-systems (delete "aarch64-linux" %supported-systems))))))
1130
1131;; Version 6 is experimental and may not work correctly. This is why we
1132;; default to version 4, which is also used in the binary toolchain bundle
1133;; provided by Parallax Inc.
1134(define make-propeller-gcc make-propeller-gcc-4)
1135
1136
1137;; FIXME: We do not build the tiny library because that would require C++
1138;; headers, which are not available. This may require adding a propeller-elf
1139;; variant of the libstdc++ package.
1140(define-public proplib
1141 (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
1142 (revision "2"))
1143 (package
1144 (name "proplib")
1145 (version (string-append "0.0.0-" revision "." (string-take commit 9)))
1146 (source (origin
1147 (method git-fetch)
1148 (uri (git-reference
1149 (url "https://github.com/parallaxinc/propgcc")
1150 (commit commit)))
1151 (file-name (string-append name "-" commit "-checkout"))
1152 (sha256
1153 (base32
1154 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
1155 (build-system gnu-build-system)
1156 (arguments
1157 `(#:tests? #f ; no tests
1158 #:make-flags
1159 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1160 (string-append "BUILD=" (getcwd) "/build"))
1161 #:phases
1162 (modify-phases %standard-phases
1163 (delete 'configure)
1164 (add-after 'unpack 'chdir
1165 (lambda _ (chdir "lib") #t))
1166 (add-after 'chdir 'fix-Makefile
1167 (lambda _
1168 (substitute* "Makefile"
1169 ;; Control the installation time of the headers.
1170 ((" install-includes") ""))
1171 #t))
1172 ;; The Makefile does not separate building from installation, so we
1173 ;; have to create the target directories at build time.
1174 (add-before 'build 'create-target-directories
1175 (lambda* (#:key make-flags #:allow-other-keys)
1176 (apply invoke "make" "install-dirs" make-flags)))
1177 (add-before 'build 'set-cross-environment-variables
1178 (lambda* (#:key outputs #:allow-other-keys)
1179 (setenv "CROSS_LIBRARY_PATH"
1180 (string-append (assoc-ref outputs "out")
1181 "/propeller-elf/lib:"
1182 (or (getenv "CROSS_LIBRARY_PATH") "")))
1183 (setenv "CROSS_C_INCLUDE_PATH"
1184 (string-append (assoc-ref outputs "out")
1185 "/propeller-elf/include:"
1186 (or (getenv "CROSS_C_INCLUDE_PATH") "")))
1187 #t))
1188 (add-before 'install 'install-includes
1189 (lambda* (#:key make-flags #:allow-other-keys)
1190 (apply invoke "make" "install-includes" make-flags))))))
1191 (native-inputs
1192 (list (make-propeller-gcc) (make-propeller-binutils) perl))
1193 (home-page "https://github.com/parallaxinc/propgcc")
1194 (synopsis "C library for the Parallax Propeller")
1195 (description "This is a C library for the Parallax Propeller
1196micro-controller.")
1197 ;; Most of the code is released under the Expat license. Some of the
1198 ;; included code is public domain and some changes are BSD licensed.
1199 (license license:expat))))
1200
1201(define make-propeller-toolchain
1202 (mlambda ()
1203 (let ((propeller-gcc (make-propeller-gcc)))
1204 (package
1205 (name "propeller-toolchain")
1206 (version (package-version propeller-gcc))
1207 (source #f)
1208 (build-system trivial-build-system)
1209 (arguments '(#:builder (begin (mkdir %output) #t)))
1210 (propagated-inputs
1211 `(("binutils" ,(make-propeller-binutils))
1212 ("libc" ,proplib)
1213 ("gcc" ,propeller-gcc)))
1214 (synopsis "Complete GCC tool chain for Propeller micro-controllers")
1215 (description "This package provides a complete GCC tool chain for
1216Propeller micro-controller development.")
1217 (home-page (package-home-page propeller-gcc))
1218 (license (package-license propeller-gcc))))))
1219
1220(define-public openspin
1221 (package
1222 (name "openspin")
1223 (version "1.00.78")
1224 (source (origin
1225 (method git-fetch)
1226 (uri (git-reference
1227 (url "https://github.com/parallaxinc/OpenSpin")
1228 (commit version)))
1229 (file-name (git-file-name name version))
1230 (sha256
1231 (base32
1232 "0ghk8hj4717ydhqzx2pfs6737s1cxng6sgg2xgbkwvcfclxdbrd0"))))
1233 (build-system gnu-build-system)
1234 (arguments
1235 `(#:tests? #f ; no tests
1236 #:phases
1237 (modify-phases %standard-phases
1238 (delete 'configure)
1239 (add-after 'unpack 'remove-timestamp
1240 (lambda _
1241 (substitute* "SpinSource/openspin.cpp"
1242 ((" Compiled on.*$") "\\n\");"))
1243 #t))
1244 ;; Makefile does not include "install" target
1245 (replace 'install
1246 (lambda* (#:key outputs #:allow-other-keys)
1247 (let ((bin (string-append (assoc-ref outputs "out")
1248 "/bin")))
1249 (mkdir-p bin)
1250 (install-file "build/openspin" bin)
1251 #t))))))
1252 (home-page "https://github.com/parallaxinc/OpenSpin")
1253 (synopsis "Spin/PASM compiler for the Parallax Propeller")
1254 (description "OpenSpin is a compiler for the Spin/PASM language of the
1255Parallax Propeller. It was ported from Chip Gracey's original x86 assembler
1256code.")
1257 (license license:expat)))
1258
1259(define-public propeller-load
1260 (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
1261 (revision "2"))
1262 (package
1263 (name "propeller-load")
1264 (version "3.4.0")
1265 (source (origin
1266 (method git-fetch)
1267 (uri (git-reference
1268 (url "https://github.com/parallaxinc/propgcc")
1269 (commit commit)))
1270 (file-name (string-append name "-" commit "-checkout"))
1271 (sha256
1272 (base32
1273 "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
1274 (build-system gnu-build-system)
1275 (arguments
1276 (list
1277 #:tests? #false ;no tests
1278 #:parallel-build? #false ;not supported
1279 #:make-flags
1280 #~(list "OS=linux"
1281 (string-append "TARGET=" #$output))
1282 #:phases
1283 '(modify-phases %standard-phases
1284 (add-after 'unpack 'chdir
1285 (lambda _ (chdir "loader")))
1286 (add-after 'chdir 'patch-for-readlink
1287 (lambda _
1288 (substitute* "src/system.c"
1289 (("#include <stdio.h>")
1290 "\
1291#include <stdio.h>
1292#include <unistd.h>"))))
1293 (delete 'configure))))
1294 (native-inputs
1295 (list openspin (make-propeller-toolchain)))
1296 (home-page "https://github.com/parallaxinc/propgcc")
1297 (synopsis "Loader for Parallax Propeller micro-controllers")
1298 (description "This package provides the tool @code{propeller-load} to
1299upload binaries to a Parallax Propeller micro-controller.")
1300 (license license:expat))))
1301
1302(define-public spinsim
1303 (let ((commit "66915a7ad1a3a2cf990a725bb341fab8d11eb620")
1304 (revision "1"))
1305 (package
1306 (name "spinsim")
1307 (version (string-append "0.75-" revision "." (string-take commit 9)))
1308 (source (origin
1309 (method git-fetch)
1310 (uri (git-reference
1311 (url "https://github.com/parallaxinc/spinsim")
1312 (commit commit)))
1313 (file-name (string-append name "-" commit "-checkout"))
1314 (sha256
1315 (base32
1316 "1n9kdhlxsdx7bz6c80w8dhi96zp633gd6qs0x9i4ii8qv4i7sj5k"))))
1317 (build-system gnu-build-system)
1318 (arguments
1319 `(#:tests? #f ; no tests
1320 #:phases
1321 (modify-phases %standard-phases
1322 (delete 'configure)
1323 (replace 'install
1324 (lambda* (#:key outputs #:allow-other-keys)
1325 (let ((bin (string-append (assoc-ref outputs "out")
1326 "/bin")))
1327 (install-file "build/spinsim" bin))
1328 #t)))))
1329 (home-page "https://github.com/parallaxinc/spinsim")
1330 (synopsis "Spin simulator")
1331 (description "This package provides the tool @code{spinsim}, a simulator
1332and simple debugger for Spin programs written for a Parallax Propeller
1333micro-controller. Spinsim supports execution from cog memory and hub
1334execution, but it does not support multi-tasking. It supports about
1335two-thirds of the opcodes in the P2 instruction set.")
1336 (license license:expat))))
1337
1338(define-public imx-usb-loader
1339 ;; There are no proper releases.
1340 (let ((commit "30b43d69770cd69e84c045dc9dcabb1f3e9d975a")
1341 (revision "0"))
1342 (package
1343 (name "imx-usb-loader")
1344 ;; For the version string, see IMX_LOADER_VERSION in imx_loader.h.
1345 (version (git-version "0.2pre" revision commit))
1346 (source (origin
1347 (method git-fetch)
1348 (uri (git-reference
1349 (url "https://github.com/boundarydevices/imx_usb_loader")
1350 (commit commit)))
1351 (file-name (git-file-name name version))
1352 (sha256
1353 (base32
1354 "1jdxbg63qascyl8x32njs9k9gzy86g209q7hc0jp74qyh0i6fwwc"))))
1355 (build-system gnu-build-system)
1356 (arguments
1357 (list #:test-target "tests"
1358 #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
1359 (string-append "prefix=" #$output))
1360 #:phases #~(modify-phases %standard-phases
1361 (delete 'configure))))
1362 (native-inputs (list pkg-config))
1363 (inputs (list libusb))
1364 (home-page "https://github.com/boundarydevices/imx_usb_loader")
1365 (synopsis "USB and UART loader for i.MX5/6/7/8 series")
1366 (description "This utility downloads and executes code on Freescale
1367i.MX5/i.MX6/i.MX7 and Vybrid SoCs through the Serial Download Protocol (SDP).
1368Depending on the board, there is usually some kind of recovery button to bring
1369the SoC into serial download boot mode; check the documentation of your
1370hardware. The utility support USB and UART as serial link.")
1371 (license license:lgpl2.1+))))
1372
1373(define-public python-cmsis-pack-manager
1374 (package
1375 (name "python-cmsis-pack-manager")
1376 (version "0.6.0")
1377 (source
1378 (origin
1379 (method git-fetch)
1380 (uri (git-reference
1381 (url "https://github.com/pyocd/cmsis-pack-manager")
1382 (commit (string-append "v" version))))
1383 (file-name (git-file-name name version))
1384 (sha256
1385 (base32 "0djxvmpw6krv459w0w98cva9clrpqicwfr0fx55hkaix1x51bgci"))))
1386 (build-system pyproject-build-system)
1387 (arguments
1388 (list
1389 #:imported-modules `(,@%cargo-build-system-modules
1390 ,@%pyproject-build-system-modules)
1391 #:modules '(((guix build cargo-build-system) #:prefix cargo:)
1392 (guix build pyproject-build-system)
1393 (guix build utils))
1394 #:phases
1395 #~(modify-phases %standard-phases
1396 (add-after 'unpack 'prepare-cargo-build-system
1397 (lambda args
1398 (for-each
1399 (lambda (phase)
1400 (format #t "Running cargo phase: ~a~%" phase)
1401 (apply (assoc-ref cargo:%standard-phases phase)
1402 #:cargo-target #$(cargo-triplet)
1403 args))
1404 '(prepare-rust-crates
1405 unpack-rust-crates
1406 configure
1407 check-for-pregenerated-files
1408 patch-cargo-checksums)))))))
1409 (propagated-inputs
1410 (list python-appdirs
1411 python-cffi
1412 python-pyyaml))
1413 (native-inputs
1414 (append
1415 (list maturin
1416 python-wrapper
1417 python-jinja2
1418 python-pytest
1419 rust
1420 `(,rust "cargo"))
1421 (or (and=> (%current-target-system)
1422 (compose list make-rust-sysroot))
1423 '())))
1424 (inputs (cargo-inputs 'python-cmsis-pack-manager))
1425 (home-page "https://github.com/pyocd/cmsis-pack-manager")
1426 (synopsis "CMSIS-Pack index manager")
1427 (description
1428 "@code{cmsis-pack-manager} is a Python module, Rust crate and command line
1429utility for managing current device information that is stored in many
1430@acronym{Common Microcontroller Software Interface Standard, CMSIS}
1431PACKs. Users of @code{cmsis-pack-manager} may query for information such as
1432processor type, flash algorithm and memory layout information in a Python
1433program or through the command line utility, @code{pack-manager}, provided as
1434part of this module.")
1435 (license license:asl2.0)))
1436
1437(define-public python-libmpsse
1438 (package
1439 (name "python-libmpsse")
1440 (version "1.4.1")
1441 (source
1442 (origin
1443 (method git-fetch)
1444 (uri (git-reference
1445 (url "https://github.com/daym/libmpsse")
1446 (commit (string-append "v" version))))
1447 (file-name "libmpsse-checkout")
1448 (sha256
1449 (base32
1450 "1rypfb96k2szqgygp3jnwg2zq9kwmfz0460dsahn3r2vkzml8wn7"))))
1451 (build-system gnu-build-system)
1452 (inputs
1453 (list libftdi python))
1454 (native-inputs
1455 (list pkg-config swig-4.4 which))
1456 (arguments
1457 `(#:tests? #f ; No tests exist.
1458 #:parallel-build? #f ; Would be buggy.
1459 #:make-flags
1460 (list (string-append "CFLAGS=-Wall -fPIC -fno-strict-aliasing -g -O2 "
1461 "$(shell pkg-config --cflags libftdi1)"))
1462 #:phases
1463 (modify-phases %standard-phases
1464 (add-after 'unpack 'set-environment-up
1465 (lambda* (#:key inputs outputs #:allow-other-keys)
1466 (let ((python (assoc-ref inputs "python")))
1467 (chdir "src")
1468 (setenv "PYDEV" (string-append python
1469 "/include/python"
1470 ,(version-major+minor (package-version python))))
1471 #t)))
1472 (replace 'install
1473 (lambda* (#:key inputs outputs make-flags #:allow-other-keys #:rest args)
1474 (let* ((out (assoc-ref outputs "out"))
1475 (out-python (string-append out
1476 "/lib/python"
1477 ,(version-major+minor (package-version python))
1478 "/site-packages"))
1479 (install (assoc-ref %standard-phases 'install)))
1480 (install #:make-flags (cons (string-append "PYLIB=" out-python)
1481 make-flags))))))))
1482 (home-page "https://code.google.com/archive/p/libmpsse/")
1483 (synopsis "Python library for MPSSE SPI I2C JTAG adapter by FTDI")
1484 (description "This package provides a library in order to support the
1485MPSSE (Multi-Protocol Synchronous Serial Engine) adapter by FTDI that can do
1486SPI, I2C, JTAG.")
1487 (license license:gpl2+)))
1488
1489(define-public picprog
1490 (package
1491 (name "picprog")
1492 (version "1.9.1")
1493 (source (origin
1494 (method url-fetch)
1495 (uri (string-append "http://www.iki.fi/hyvatti/pic/picprog-"
1496 version ".tar.gz"))
1497 (file-name (string-append name "-" version ".tar.gz"))
1498 (sha256
1499 (base32
1500 "1r04hg1n3v2jf915qr05la3q9cxy7a5jnh9cc98j04lh6c9p4x85"))
1501 (patches (search-patches "picprog-non-intel-support.patch"))))
1502 (build-system gnu-build-system)
1503 (arguments
1504 `(#:tests? #f ; No tests exist.
1505 #:phases
1506 (modify-phases %standard-phases
1507 (add-after 'unpack 'patch-paths
1508 (lambda* (#:key outputs #:allow-other-keys)
1509 (substitute* "Makefile"
1510 (("/usr/local") (assoc-ref outputs "out"))
1511 ((" -o 0 -g 0 ") " ")
1512 (("testport") ""))
1513 #t))
1514 (add-before 'install 'mkdir
1515 (lambda* (#:key outputs #:allow-other-keys)
1516 (let ((out (assoc-ref outputs "out")))
1517 (mkdir-p (string-append out "/bin"))
1518 (mkdir-p (string-append out "/man/man1"))
1519 #t)))
1520 (delete 'configure))))
1521 (synopsis "Programs Microchip's PIC microcontrollers")
1522 (description "This program programs Microchip's PIC microcontrollers.")
1523 (home-page "https://hyvatti.iki.fi/~jaakko/pic/picprog.html")
1524 (license license:gpl3+)))
1525
1526(define-public stcgal
1527 (package
1528 (name "stcgal")
1529 (version "1.10")
1530 (source
1531 (origin
1532 (method git-fetch)
1533 (uri (git-reference
1534 (url "https://github.com/grigorig/stcgal")
1535 (commit (string-append "v" version))))
1536 (file-name (git-file-name name version))
1537 (sha256
1538 (base32 "04hsj49sw5mb6swhd3sdsm7dzwp1frnzpmq70wgsn5vmjavb1ka8"))))
1539 (build-system pyproject-build-system)
1540 (propagated-inputs (list python-pyserial python-pyusb python-tqdm))
1541 (native-inputs
1542 ;; For tests.
1543 (list python-pytest python-pyyaml python-setuptools))
1544 (home-page "https://github.com/grigorig/stcgal")
1545 (synopsis "Programmer for STC 8051-compatible microcontrollers")
1546 (description "stcgal is a command-line flash-programming tool for STC
1547MCU's line of Intel 8051-compatible microcontrollers, including those in the
1548STC89, STC90, STC10, STC11, STC12, STC15, STC8 and STC32 series.")
1549 (license license:expat)))
1550
1551(define-public stlink
1552 (let ((commit "6a6718b3342b6c5e282a4e33325b9f97908a0692")
1553 (revision "0"))
1554 (package
1555 (name "stlink")
1556 (version (git-version "1.8.0" revision commit))
1557 (source
1558 (origin
1559 (method git-fetch)
1560 (uri (git-reference
1561 (url "https://github.com/stlink-org/stlink")
1562 (commit commit)))
1563 (file-name (git-file-name name version))
1564 (sha256
1565 (base32
1566 "1sk9qr3f8v1rm735vq6pxckgwzsgr4k2kl6skh79f4v2qm0hc4qd"))))
1567 (build-system cmake-build-system)
1568 (arguments
1569 (list #:tests? #f ;no tests
1570 #:configure-flags
1571 #~(let* ((etc (in-vicinity #$output "etc"))
1572 (modprobe (in-vicinity etc "modprobe.d"))
1573 (udev-rules (in-vicinity etc "udev/rules.d")))
1574 (list (string-append "-DSTLINK_UDEV_RULES_DIR=" udev-rules)
1575 (string-append "-DSTLINK_MODPROBED_DIR=" modprobe)))))
1576 (inputs
1577 (list libusb))
1578 (synopsis "Programmer for STM32 Discovery boards")
1579 (description "This package provides a firmware programmer for the STM32
1580 Discovery boards. It supports two versions of the chip: ST-LINK/V1 (on
1581 STM32VL discovery kits) and ST-LINK/V2 (on STM32L discovery and later kits).
1582 Two different transport layers are used: ST-LINK/V1 uses SCSI passthru
1583 commands over USB, and ST-LINK/V2 and ST-LINK/V2-1 (seen on Nucleo boards) use
1584 raw USB commands.")
1585 (home-page "https://github.com/stlink-org/stlink")
1586 ;; The flashloaders/stm32l0x.s and flashloaders/stm32lx.s source files are
1587 ;; licensed under the GPLv2+.
1588 (license (list license:bsd-3 license:gpl2+)))))
1589
1590(define-public west
1591 (package
1592 (name "west")
1593 (version "1.5.0")
1594 (source
1595 (origin
1596 (method git-fetch)
1597 (uri (git-reference
1598 (url "https://github.com/zephyrproject-rtos/west")
1599 (commit (string-append "v" version))))
1600 (file-name (git-file-name name version))
1601 (sha256
1602 (base32 "0fa3bbw69khw8la4mi4q18d8brixywwj5yby7dh36hd40wxspzk3"))))
1603 (build-system pyproject-build-system)
1604 (arguments
1605 (list
1606 #:test-flags
1607 ;; XXX: This test tries to access the network.
1608 #~(list "-k" "not test_init_with_clone_option_depth_one")
1609 #:phases
1610 #~(modify-phases %standard-phases
1611 (add-before 'check 'configure-tests
1612 (lambda _
1613 (setenv "TOXTEMPDIR"
1614 (mkdtemp
1615 (string-append (dirname (getcwd)) "/tmpXXXXXX"))))))))
1616 (propagated-inputs
1617 (list python-colorama
1618 python-packaging
1619 python-pykwalify
1620 python-pyyaml))
1621 (native-inputs (list git-minimal/pinned python-pytest python-setuptools))
1622 (home-page "https://github.com/zephyrproject-rtos/west")
1623 (synopsis "Zephyr RTOS Project meta-tool")
1624 (description
1625 "West is the swiss-army knife command line tool of the Zephyr project.
1626Its built-in commands provide a multiple repository management system with
1627features inspired by Google’s Repo tool and Git submodules. West simplifies
1628configuration and is also pluggable: you can write your own west \"extension
1629commands\" which add additional features to west. Zephyr uses this feature to
1630provide conveniences for building applications, flashing and debugging them,
1631and more.")
1632 (license license:expat)))
1633
1634(define-public ebusd
1635 (package
1636 (name "ebusd")
1637 (version "26.1")
1638 (source (origin
1639 (method git-fetch)
1640 (uri (git-reference
1641 (url "https://github.com/john30/ebusd")
1642 (commit version)))
1643 (file-name (string-append name "-" version "-checkout"))
1644 (sha256
1645 (base32
1646 "1as59bjv9m6hgzg7bjy4nwwzqkwf18a1ss515wjzziaz8a32nq0a"))))
1647 (build-system gnu-build-system)
1648 (arguments
1649 (list #:configure-flags #~(list "--localstatedir=/var")
1650 #:phases
1651 #~(modify-phases %standard-phases
1652 (add-after 'unpack 'patch
1653 (lambda _
1654 (let ((config (string-append #$output "/share/ebusd/")))
1655 (substitute* "src/ebusd/main.h"
1656 (("#define CONFIG_PATH .*")
1657 (format #f "#define CONFIG_PATH \"~a\"\n" config))))))
1658 ;; If we don't set GIT_REVISION, then the build system will include the
1659 ;; current date in the version string, making the build unreproducible.
1660 ;;
1661 ;; See:
1662 ;; * https://codeberg.org/guix/guix/issues/6638
1663 ;; * https://github.com/john30/ebusd/blob/v22.4/configure.ac#L159-L163
1664 (add-after 'unpack 'set-version-info
1665 (lambda _
1666 (setenv "GIT_REVISION" #$version)))
1667 (add-after 'install 'install-config
1668 (lambda _
1669 (let ((config-destination (string-append #$output
1670 "/share/ebusd"))
1671 (config #$(this-package-native-input "config")))
1672 (copy-recursively (string-append config "/src/")
1673 config-destination)))))))
1674 (inputs
1675 (list mosquitto))
1676 (native-inputs
1677 `(("automake" ,automake)
1678 ("autoconf" ,autoconf)
1679 ("config"
1680 ,(origin
1681 (method git-fetch)
1682 (uri (git-reference
1683 (url "https://github.com/john30/ebusd-configuration")
1684 (commit "f72859829a4a6a03c51f5374356f4c0d6353e897")))
1685 (file-name "ebusd-configuration")
1686 (sha256
1687 (base32
1688 "0683jnj6nvvhp6w6sam8ldakw39lf64wjlwjzva9v35ly2fddj5g"))))))
1689 (synopsis "Daemon for communicating with eBUS devices")
1690 (description "This package provides @command{ebusd}, a daemon for
1691handling communication with eBUS devices connected to a 2-wire bus system
1692(\"energy bus\" used by numerous heating systems).")
1693 (home-page "https://ebusd.eu/")
1694 (license license:gpl3+)))
1695
1696(define-public ucsim
1697 (package
1698 (name "ucsim")
1699 (version "0.8.2")
1700 (source (origin
1701 (method url-fetch)
1702 (uri (string-append
1703 "http://mazsola.iit.uni-miskolc.hu/ucsim/download/"
1704 "v" (version-major+minor version) ".x/"
1705 "ucsim_" version "_orig.tar.gz"))
1706 (sha256
1707 (base32
1708 "1zdvzfhdsbydyyjy5rf2934bn06skdlnky6l9ngbp2k645g0ynlh"))))
1709 (build-system gnu-build-system)
1710 (arguments
1711 (list
1712 #:phases
1713 #~(modify-phases %standard-phases
1714 (add-after 'unpack 'patch-makefiles
1715 (lambda _
1716 (substitute* (find-files "." "(\\.mk$|\\.in$)")
1717 (("/bin/sh") (which "sh")))
1718
1719 ;; Ensure the documentation is installed to the correct path,
1720 ;; without a duplicate "ucsim" segment (necessary as we are
1721 ;; building μCsim outside of SDCC).
1722 (substitute* "doc/Makefile.in"
1723 (("@docdir@/ucsim") "@docdir@")))))
1724 ;; μCsim's regression-test suite is of little use in this context since
1725 ;; it doesn't stop or return an error code when it encounters a problem.
1726 #:tests? #f))
1727 (inputs
1728 (list ncurses))
1729 (native-inputs
1730 (list bison flex))
1731 (outputs '("out" "doc"))
1732 (home-page "http://mazsola.iit.uni-miskolc.hu/ucsim/")
1733 (synopsis "Simulators for various microcontroller families")
1734 (description "μCsim is a collection of software simulators for
1735microcontrollers in the Atmel AVR; Fairchild F8; Intel MCS-51 (8051) and 8085;
1736MOS Technology 6502; Motorola 6800, 6809, 68HC08, 68HC11 and 68HC12; P1516;
1737Padauk PDK13, PDK14 and PDK15; STMicroelectronics ST7 and STM8; Xilinx
1738PicoBlaze; and Zilog Z80 families, plus many of their variants.")
1739 (license license:gpl2+)))
1740
1741(define-public sdcc
1742 (package
1743 (name "sdcc")
1744 (version "4.4.0")
1745 (source (origin
1746 (method url-fetch)
1747 (uri (string-append
1748 "mirror://sourceforge/sdcc/sdcc"
1749 "/" version "/sdcc-src-" version ".tar.bz2"))
1750 (sha256
1751 (base32
1752 "0xbaj3vx5cp3na1kmyhy4jvhcqwrg648scjbykgq0xmibqb1535f"))
1753 (modules '((guix build utils)))
1754 (snippet
1755 #~(begin
1756 ;; Remove non-free source files.
1757 (delete-file-recursively "device/non-free")
1758 ;; Remove bundled μCsim source.
1759 (delete-file-recursively "sim")))
1760 (patches (search-patches "sdcc-disable-non-free-code.patch"))))
1761 (build-system gnu-build-system)
1762 (arguments
1763 (list
1764 #:configure-flags
1765 #~(list
1766 ;; GPUTILS is required for the PIC ports, but the licensing status of
1767 ;; some of the files contained in its distribution is unclear (see
1768 ;; https://issues.guix.gnu.org/44557). For this reason it is not yet
1769 ;; available as a package in Guix.
1770 "--disable-pic14-port"
1771 "--disable-pic16-port"
1772
1773 ;; Do not build or install the bundled copy of μCsim, for which Guix
1774 ;; has its own package.
1775 "--disable-ucsim")
1776 #:phases
1777 #~(modify-phases %standard-phases
1778 (add-after 'unpack 'patch-makefiles
1779 (lambda _
1780 (substitute* (find-files "." "(\\.mk$|\\.in$)")
1781 (("/bin/sh") (which "sh")))
1782 ;; --disable-ucsim disables sdcc-misc, patch it back in.
1783 (substitute* "Makefile.in"
1784 (("debugger/mcs51" line)
1785 (string-append line "\n"
1786 "TARGETS += sdcc-misc\n"
1787 "PKGS += $(SDCC_MISC)")))))
1788 (add-after 'patch-makefiles 'embed-absolute-ucsim-reference
1789 (lambda _
1790 ;; Embed in the debugger an absolute reference to the MCS-51
1791 ;; simulator from Guix's μCsim package to ensure it is always
1792 ;; available.
1793 (substitute* "debugger/mcs51/sdcdb.c"
1794 (("s51")
1795 (string-append #$(this-package-input "ucsim")
1796 "/bin/s51"))))))))
1797 (inputs
1798 (list readline ucsim))
1799 (native-inputs
1800 (list bison boost flex python-minimal-wrapper texinfo zlib))
1801 (home-page "https://sdcc.sourceforge.net/")
1802 (synopsis "C compiler suite for 8-bit microcontrollers")
1803 (description "SDCC is a retargetable, optimizing Standard C compiler suite
1804that targets 8-bit microcontrollers in the Intel MCS-51 (8051); MOS Technology
18056502; Motorola 68HC08; Padauk PDK13, PDK14 and PDK15; STMicroelectronics STM8;
1806and Zilog Z80 families, plus many of their variants.")
1807 (license (list license:gpl2+
1808 license:gpl3+
1809 license:lgpl2.0+
1810 license:lgpl2.1+
1811 license:lgpl3+
1812 license:public-domain
1813 license:zlib))))
1814
1815(define-public python-psptool
1816 (package
1817 (name "python-psptool")
1818 (version "3.6")
1819 (source
1820 (origin
1821 (method git-fetch)
1822 (uri (git-reference
1823 (url "https://github.com/PSPReverse/psptool")
1824 (commit version)))
1825 (file-name (git-file-name name version))
1826 (sha256
1827 (base32 "1s53bqimh1ih0xqmyppm2ikphi8r9492k67kn4pz3jngh2gp1wnf"))))
1828 (build-system pyproject-build-system)
1829 (arguments
1830 (list #:test-backend #~'unittest))
1831 (native-inputs
1832 (list python-hatch-vcs
1833 python-hatchling
1834 python-psptrace-bootstrap
1835 python-setuptools))
1836 (propagated-inputs
1837 (list python-cryptography
1838 python-prettytable))
1839 (home-page "https://github.com/PSPReverse/psptool")
1840 (synopsis "Tool for dealing with AMD binary blobs")
1841 (description "PSPTool is a tool for dealing with AMD binary blobs.")
1842 (license license:gpl3+)))
1843
1844(define-public python-psptrace
1845 (package
1846 (name "python-psptrace")
1847 (version "0.11")
1848 (source
1849 (origin
1850 (method url-fetch)
1851 (uri (pypi-uri "psptrace" version))
1852 (sha256
1853 (base32 "0lzv0dy2m5g6q4rpjd4wpw0p7n8v8crkx7akbp53lpy1c6y40iw8"))))
1854 (build-system pyproject-build-system)
1855 (arguments
1856 (list #:tests? #f)) ;no tests in PyPI or Git
1857 (native-inputs
1858 (list python-hatch-vcs
1859 python-hatchling
1860 python-setuptools))
1861 (propagated-inputs
1862 (list python-prettytable
1863 python-psptool))
1864 (home-page "https://github.com/PSPReverse/PSPTrace")
1865 (synopsis "Capture of an AMD boot procedure")
1866 (description
1867 "PSPTrace is a tool for correlating an SPI capture of an AMD boot
1868procedure to the PSP firmware components.")
1869 (license license:gpl3+)))
1870
1871(define-public python-psptrace-bootstrap
1872 (hidden-package
1873 (package/inherit python-psptrace
1874 (name "python-psptrace")
1875 (arguments
1876 (list #:tests? #f
1877 #:phases
1878 #~(modify-phases %standard-phases
1879 (delete 'sanity-check))))
1880 (propagated-inputs '()))))
1881
1882(define-public agent-proxy
1883 (let ((commit "8927798a71d246871ea8fc22b4512296a3fa1765")
1884 (revision "0"))
1885 (package
1886 (name "agent-proxy")
1887 (version (git-version "1.98" revision commit))
1888 (home-page
1889 "https://git.kernel.org/pub/scm/utils/kernel/kgdb/agent-proxy.git")
1890 (source (origin
1891 (method git-fetch)
1892 (uri (git-reference (url home-page) (commit commit)))
1893 (file-name (git-file-name name version))
1894 (sha256
1895 (base32
1896 "1bxkzwsqfld4pknmiq8j3k55pv90n8s6kzh0xh42bhy2jv1wxz2z"))))
1897 (build-system gnu-build-system)
1898 (arguments
1899 `(#:tests? #f
1900 #:phases
1901 (modify-phases %standard-phases
1902 (delete 'configure)
1903 (add-after 'build 'build-kdmx
1904 (lambda _
1905 (invoke "make" "-C" "kdmx")
1906 #t))
1907 (replace 'install
1908 (lambda* (#:key outputs #:allow-other-keys)
1909 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
1910 (install-file "agent-proxy" bin)
1911 (install-file "kdmx/kdmx" bin)
1912 #t))))))
1913 (synopsis "Proxies to run kgdb/gdbserver and console on a serial port")
1914 (description "These programs are proxies allowing to run kgdb/gdbserver
1915and console on a single serial port. agent-proxy creates network sockets,
1916whereas kdmx creates pseudo-ttys.")
1917 (license license:gpl2))))
1918
1919(define-public mbed-tools
1920 (package
1921 (name "mbed-tools")
1922 (version "7.59.0")
1923 (source
1924 (origin
1925 (method url-fetch)
1926 (uri (pypi-uri "mbed-tools" version))
1927 (sha256
1928 (base32 "12h8g8mv3llwqcjii4zvz94mv7cmhmbc204w4nqd6nnhwfvcl6ky"))))
1929 (build-system pyproject-build-system)
1930 (arguments
1931 (list
1932 ;; tests: 631 passed, 27 skipped, 1 warning
1933 #:test-flags
1934 ;; E ModuleNotFoundError: No module named 'mbed_tools_ci_scripts'
1935 #~(list "--ignore=tests/ci_scripts/test_sync_board_db.py")))
1936 (native-inputs
1937 (list python-factory-boy
1938 python-pytest
1939 python-requests-mock
1940 python-semver
1941 python-setuptools
1942 python-setuptools-scm))
1943 (propagated-inputs
1944 (list python-click
1945 python-dotenv
1946 python-gitpython
1947 python-jinja2
1948 python-psutil
1949 python-pyserial
1950 python-pyudev
1951 python-requests
1952 python-tabulate
1953 python-tqdm
1954 python-typing-extensions))
1955 (home-page "https://github.com/ARMmbed/mbed-tools")
1956 (synopsis "ARM Mbed command line tools")
1957 (description "This package is the successor of @code{mbed-cli}. It
1958provides command line tools for Mbed OS to detect Mbed enabled devices
1959connected by USB, checkout Mbed projects and perform builds amongst other
1960operations.")
1961 (license license:asl2.0)))
1962
1963(define-public ts4900-utils
1964 (package
1965 (name "ts4900-utils")
1966 (version "3.0.0")
1967 (source (origin
1968 (method git-fetch)
1969 (uri (git-reference
1970 (url "https://github.com/embeddedTS/ts4900-utils")
1971 (commit (string-append "v" version))))
1972 (file-name (git-file-name name version))
1973 (sha256
1974 (base32
1975 "08x40ii56v4cmnz9hk6rvjrc500k1bij5ns52360vczznc8lx8bx"))))
1976 (build-system gnu-build-system)
1977 (native-inputs
1978 (list autoconf
1979 automake
1980 libgpiod
1981 pkg-config))
1982 (home-page "https://github.com/embeddedTS/ts4900-utils")
1983 (synopsis "Utilities for the TS-4900 board family")
1984 (description "This package contains utilities useful for boards of the
1985TS-4900 family. The included commands are:
1986@itemize @code
1987@item adc8390
1988@item gpioctl
1989@item isl12020rtc
1990@item load_fpga
1991@item nvramctl
1992@item tshwctl
1993@item tsmicroctl
1994@item tsmicroupdate
1995@item tssilomon
1996@end itemize")
1997 (license license:bsd-2)))
1998
1999(define-public cc-tool
2000 (package
2001 (name "cc-tool")
2002 (version "0.27")
2003 (source
2004 (origin
2005 (method git-fetch)
2006 (uri (git-reference
2007 (url "https://github.com/dashesy/cc-tool")
2008 (commit (string-append "v" version))))
2009 (file-name (git-file-name name version))
2010 (sha256
2011 (base32 "1bnyp3fxhzhz6in4yx8s6vh004gslykrpysdz6b8x8b96ha35c7c"))))
2012 (build-system gnu-build-system)
2013 (inputs (list libusb))
2014 (native-inputs (list pkg-config
2015 boost-1.83
2016 automake
2017 autoconf
2018 libtool))
2019 (home-page "https://github.com/dashesy/cc-tool")
2020 (synopsis "Support for Texas Instruments CC Debugger in Linux")
2021 (description
2022 "cc-tool provides support for Texas Instruments CC Debugger for Linux OS
2023in order to program 8051-based System-On-Chip devices: CC254x CC253x CC243x
2024CC251x CC111x.")
2025 (license license:gpl2)))
2026
2027(define-public qflipper
2028 (package
2029 (name "qflipper")
2030 (version "1.3.3")
2031 (source
2032 (origin
2033 (method git-fetch)
2034 (uri (git-reference
2035 (url "https://github.com/flipperdevices/qFlipper")
2036 (commit version)))
2037 (file-name (git-file-name name version))
2038 (sha256
2039 (base32 "0q68pkkak1ji0800hxbypshgj89vzwkql3j5x53sd32v96c8j7yp"))
2040 (patches
2041 (search-patches "qflipper-qt6.9-compat.patch"))))
2042 (build-system gnu-build-system)
2043 (arguments
2044 (list
2045 #:phases
2046 #~(modify-phases %standard-phases
2047 (replace 'configure
2048 (lambda* (#:key inputs #:allow-other-keys)
2049 (invoke "qmake"
2050 (string-append "PREFIX=" #$output)
2051 (string-append
2052 "QT_TOOL.lrelease.binary="
2053 (search-input-file inputs "/bin/lrelease"))
2054 "DEFINES+=DISABLE_APPLICATION_UPDATES")))
2055 (add-after 'unpack 'fix-version
2056 (lambda _
2057 (substitute* "qflipper_common.pri"
2058 (("GIT_VERSION =.*") (string-append "GIT_VERSION = \"" #$version "\"\n")))))
2059 (add-after 'unpack 'unbundle-nanopb
2060 (lambda _
2061 (substitute* "qFlipper.pro"
2062 ((".*3rdparty.*") ""))
2063 (substitute* "plugins/flipperproto0/flipperproto0.pro"
2064 (("-l3rdparty") "-lprotobuf-nanopb")))))))
2065 (native-inputs (list pkg-config))
2066 (inputs
2067 (list libusb
2068 nanopb-malloc
2069 qt5compat
2070 qtbase
2071 qtdeclarative
2072 qtserialport
2073 qtsvg
2074 qttools
2075 qtwayland
2076 zlib))
2077 (home-page "https://github.com/flipperdevices/qFlipper")
2078 (synopsis "Desktop application for Flipper Zero")
2079 (description
2080 "qFlipper is a graphical application for Flipper Zero with the following features:
2081
2082@itemize @bullet
2083@item Update Flipper's firmware and supplemental data
2084@item Repair a broken firmware installation
2085@item Stream Flipper's display and control it remotely
2086@item Install firmware from a @code{.dfu} file
2087@item Backup and restore settings, progress and pairing data
2088@item Command line interface
2089@end itemize
2090
2091Tip: to be able to use this application as a regular user, search for the
2092@code{42-flipperzero.rules} file in the contents of the package, install it
2093using udev-rules-service, then add your user to the dialout group.")
2094 (license license:gpl3)))