[PATCH 00/23] guix: Add avr as a platform.

  • Done
  • quality assurance status badge
Details
5 participants
  • Efraim Flashner
  • Jean-Pierre De Jesus DIAZ
  • Ludovic Courtès
  • Maxim Cournoyer
  • Mathieu Othacehe
Owner
unassigned
Submitted by
Jean-Pierre De Jesus DIAZ
Severity
normal

Debbugs page

J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:13
(address . guix-patches@gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091333.7623-1-jean@foundationdevices.com
Hello Guixers,

This adds avr as a platform to GNU Guix allowing to cross-compile
packages to it.

For the impatient, with this patch series one can build the provided
unity package with this invocation:

./pre-inst-env guix build unity --target=avr

It uses the AVR Libc as the default libc and fully builds a
cross-compiler using the AVR Libc instead of building them separately
like it's done currently. This could allow to use other of front-ends of
GCC in the future if possible, however, Fortran and Objective-C
front-ends don't build right now for AVR, haven't tested any other
front-ends.

This also adds the cross-toolchain module for instantiating
cross-toolchain packages, this is to avoid each platform defining a
module like avr to instantiate a toolchain, this helps in avoiding
circular dependencies as cross-toolchain should depend only on
cross-base and that'd be it.

I think could've added cross-toolchains there for MinGW though, but I
don't have a need for it but allows others to do so. Perhaps it could
be a requirement that to add a platform one needs to add a
cross-toolchain package.

I enabled multilib support for AVR as most embedded platforms will need
it, which makes me think, perhaps should the platform record contain a
`mutlilib?' field?

Information about individual patches:

On [PATCH 05/23] I didn't find a better way of deleting the
--disable-multilib flag from GCC configure flags, if anyone has a better
idea let me know.

The [PATCH 01/23] and [PATCH 02/23] are optional but there
might be some platforms defined in the future that don't have
a proper libc and it still should be fine to use these I think.

The [PATCH 21/23] fixes a bug in the meson-configuration module
and can be applied independently.

Feel free to cherry pick the interesting/trivial patches.

PS:

I CC'ed the embedded team and Maxim Cournoyer as I saw his current work
on QMK firmwares and could be of interest to him.

Jean-Pierre De Jesus DIAZ (23):
gnu: cross-libc: Return #f if no libc available.
guix: gnu: Handle platforms without libc.
gnu: Add avr platform.
guix: utils: Add target-avr?.
gnu: cross-gcc: Enable multilib for avr.
gnu: microscheme: Move to avr-xyz.
gnu: Add AVR phases to cross-gcc-build-phases.
gnu: avr-libc: Convert to procedure.
gnu: Add make-cross-gcc-toolchain.
gnu: Add binutils-cross-avr.
gnu: avr-binutils: Deprecate package.
gnu: Remove various AVR packages.
gnu: cross-libc: Add AVR Libc case.
gnu: cross-gcc-arguments: Handle AVR target.
guix: meson-configuration: Fix boolean assigment.
gnu: cross-gcc-search-paths: Handle AVR target.
gnu: cross-gcc: Handle inputs for AVR.
gnu: Add avr-libc.
gnu: Add gcc-cross-avr-toolchain.
gnu: Add avr-toolchain.
guix: meson-build-system: Support AVR.
guix: meson-build-system: Disable PIC for AVR.
gnu: Add unity.

Makefile.am | 1 +
doc/guix.texi | 6 +
gnu/build/cross-toolchain.scm | 41 +++++-
gnu/local.mk | 1 +
gnu/packages/avr-xyz.scm | 41 ++++++
gnu/packages/avr.scm | 152 +++-----------------
gnu/packages/check.scm | 41 ++++++
gnu/packages/cross-base.scm | 213 +++++++++++++++++++----------
gnu/packages/cross-toolchain.scm | 88 ++++++++++++
guix/build-system/gnu.scm | 12 +-
guix/build-system/meson.scm | 14 +-
guix/build/meson-configuration.scm | 4 +-
guix/platforms/avr.scm | 29 ++++
guix/utils.scm | 4 +
14 files changed, 421 insertions(+), 226 deletions(-)
create mode 100644 gnu/packages/cross-toolchain.scm
create mode 100644 guix/platforms/avr.scm

--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 04/23] guix: utils: Add target-avr?.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-4-jean@foundationdevices.com
* guix/utils.scm (target-avr?): New procedure.
---
guix/utils.scm | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (24 lines)
diff --git a/guix/utils.scm b/guix/utils.scm
index e9af33bdeb..1724b53149 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -98,6 +98,7 @@ (define-module (guix utils)
target-arm32?
target-aarch64?
target-arm?
+ target-avr?
target-ppc32?
target-ppc64le?
target-powerpc?
@@ -722,6 +723,9 @@ (define* (target-arm? #:optional (target (or (%current-target-system)
(%current-system))))
(or (target-arm32? target) (target-aarch64? target)))
+(define* (target-avr? #:optional (target (%current-target-system)))
+ (string-prefix? "avr" target))
+
(define* (target-ppc32? #:optional (target (or (%current-target-system)
(%current-system))))
(string-prefix? "powerpc-" target))
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 03/23] gnu: Add avr platform.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-3-jean@foundationdevices.com
* Makefile.am (MODULES): Add avr platform module.

* doc/guix.texi: Add documentation for avr platform.

* guix/platforms/avr.scm (avr): New variable.
---
Makefile.am | 1 +
doc/guix.texi | 6 ++++++
guix/platforms/avr.scm | 29 +++++++++++++++++++++++++++++
3 files changed, 36 insertions(+)
create mode 100644 guix/platforms/avr.scm

Toggle diff (73 lines)
diff --git a/Makefile.am b/Makefile.am
index 8924974e8a..c11a1c538d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -136,6 +136,7 @@ MODULES = \
guix/ipfs.scm \
guix/platform.scm \
guix/platforms/arm.scm \
+ guix/platforms/avr.scm \
guix/platforms/mips.scm \
guix/platforms/powerpc.scm \
guix/platforms/riscv.scm \
diff --git a/doc/guix.texi b/doc/guix.texi
index 46591b2f64..70cde9c53c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -16665,6 +16665,7 @@ The available targets are:
- aarch64-linux-gnu
- arm-linux-gnueabihf
+ - avr
- i586-pc-gnu
- i686-linux-gnu
- i686-w64-mingw32
@@ -45332,6 +45333,11 @@ Platform targeting x86 CPU running GNU/Hurd (also referred to as
``GNU'').
@end defvar
+@defvar avr
+Platform targeting AVR CPUs without an operating system, with run-time support
+from AVR Libc.
+@end defvar
+
@node System Images
@chapter Creating System Images
diff --git a/guix/platforms/avr.scm b/guix/platforms/avr.scm
new file mode 100644
index 0000000000..b6ca6e4a10
--- /dev/null
+++ b/guix/platforms/avr.scm
@@ -0,0 +1,29 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix platforms avr)
+ #:use-module (guix platform)
+ #:use-module (guix records)
+ #:export (avr))
+
+(define avr
+ (platform
+ (target "avr")
+ (system #f)
+ (glibc-dynamic-linker #f)))
+
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 05/23] gnu: cross-gcc: Enable multilib for avr.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-5-jean@foundationdevices.com
* gnu/packages/cross-base.scm (cross-gcc-arguments)
[target-avr?]: Remove --disable-mutlilib and add --enable-multilib.
---
gnu/packages/avr.scm | 4 +---
gnu/packages/cross-base.scm | 17 +++++++++++++----
2 files changed, 14 insertions(+), 7 deletions(-)

Toggle diff (47 lines)
diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index b9bee5e624..e976203b89 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -75,9 +75,7 @@ (define avr-gcc
;; several scripts inside this script, each with a #!/bin/sh
;; that needs patching.
(substitute* "gcc/genmultilib"
- (("#!/bin/sh") (string-append "#!" (which "sh"))))))))
- ((#:configure-flags flags)
- #~(delete "--disable-multilib" #$flags))))
+ (("#!/bin/sh") (string-append "#!" (which "sh"))))))))))
(native-search-paths
(list (search-path-specification
(variable "CROSS_C_INCLUDE_PATH")
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index f55765f1b0..ec7ca2186d 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -197,12 +197,21 @@ (define (cross-gcc-arguments target xgcc libc)
#~((string-append "--with-toolexeclibdir="
(assoc-ref %outputs "lib")
"/" #$target "/lib"))
+ #~())
+
+ #$@(if (target-avr? target)
+ #~("--enable-multilib")
+ #~())
+
#~()))
- #$(if libc
- flags
- #~(remove (cut string-match "--enable-languages.*" <>)
- #$flags))))
+ (remove
+ (lambda (flag)
+ (or (and (string-match "--enable-languages.*" flag)
+ #$libc)
+ (and (string-match "--disable-multilib" flag)
+ #$(target-avr? target))))
+ #$flags)))
((#:make-flags flags)
(if libc
#~(let ((libc (assoc-ref %build-inputs "libc")))
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 08/23] gnu: avr-libc: Convert to procedure.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-8-jean@foundationdevices.com
* gnu/packages/avr.scm (make-avr-libc): New procedure.

* gnu/packages/avr.scm (avr-libc): Use make-avr-libc procedure.
---
gnu/packages/avr.scm | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)

Toggle diff (53 lines)
diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index ccce686010..df1523274b 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -34,7 +34,8 @@ (define-module (gnu packages avr)
#:use-module (gnu packages check)
#:use-module (gnu packages cross-base)
#:use-module (gnu packages flashing-tools)
- #:use-module (gnu packages gcc))
+ #:use-module (gnu packages gcc)
+ #:export (make-avr-libc))
(define-public avr-binutils
(package
@@ -93,7 +94,9 @@ (define avr-gcc
`(("gcc" ,gcc)
,@(package-native-inputs xgcc))))))
-(define avr-libc
+(define* (make-avr-libc #:key
+ (xbinutils (cross-binutils "avr"))
+ (xgcc (cross-gcc "avr")))
(package
(name "avr-libc")
(version "2.0.0")
@@ -106,10 +109,12 @@ (define avr-libc
"15svr2fx8j6prql2il2fc0ppwlv50rpmyckaxx38d3gxxv97zpdj"))))
(build-system gnu-build-system)
(arguments
- '(#:out-of-source? #t
- #:configure-flags '("--host=avr")))
- (native-inputs `(("avr-binutils" ,avr-binutils)
- ("avr-gcc" ,avr-gcc)))
+ (list #:target "avr"
+
+ #:out-of-source? #t
+
+ #:implicit-cross-inputs? #f))
+ (native-inputs (list xbinutils xgcc))
(home-page "https://www.nongnu.org/avr-libc/")
(synopsis "The AVR C Library")
(description
@@ -118,6 +123,8 @@ (define avr-libc
(license
(license:non-copyleft "http://www.nongnu.org/avr-libc/LICENSE.txt"))))
+(define avr-libc (make-avr-libc))
+
(define-public avr-toolchain
;; avr-libc checks the compiler version and passes "--enable-device-lib" for avr-gcc > 5.1.0.
;; It wouldn't install the library for atmega32u4 etc if we didn't use the corret avr-gcc.
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 06/23] gnu: microscheme: Move to avr-xyz.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-6-jean@foundationdevices.com
* gnu/packages/avr.scm (microscheme): Remove from file.

* gnu/packages/avr-xyz.scm (microscheme): New variable.
---
gnu/packages/avr-xyz.scm | 41 +++++++++++++++++++++++++++++++++++++++
gnu/packages/avr.scm | 42 +---------------------------------------
2 files changed, 42 insertions(+), 41 deletions(-)

Toggle diff (121 lines)
diff --git a/gnu/packages/avr-xyz.scm b/gnu/packages/avr-xyz.scm
index a05157ede7..771753b5e4 100644
--- a/gnu/packages/avr-xyz.scm
+++ b/gnu/packages/avr-xyz.scm
@@ -28,14 +28,55 @@ (define-module (gnu packages avr-xyz)
#:use-module (gnu packages autotools)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
+ #:use-module (gnu packages check)
+ #:use-module (gnu packages compression)
#:use-module (gnu packages avr)
#:use-module (gnu packages elf)
#:use-module (gnu packages gl)
+ #:use-module (gnu packages llvm)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages version-control)
+ #:use-module (gnu packages vim)
#:use-module (gnu packages ruby))
+(define-public microscheme
+ (package
+ (name "microscheme")
+ (version "0.9.4")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/ryansuchocki/microscheme")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32 "1bflwirpcd58bngbs6hgjfwxl894ni2gpdd4pj10pm2mjhyj5dgw"))
+ (file-name (git-file-name name version))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:parallel-build? #f ; fails to build otherwise
+ #:tests? #f ; no tests
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure))
+ #:make-flags
+ (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
+ (native-inputs
+ (list clang cppcheck unzip xxd))
+ (home-page "https://github.com/ryansuchocki/microscheme/")
+ (synopsis "Scheme subset for Atmel microcontrollers")
+ (description
+ "Microscheme, or @code{(ms)} for short, is a functional programming
+language for the Arduino, and for Atmel 8-bit AVR microcontrollers in general.
+Microscheme is a subset of Scheme, in the sense that every valid @code{(ms)}
+program is also a valid Scheme program (with the exception of Arduino
+hardware-specific primitives). The @code{(ms)} compiler performs function
+inlining, and features an aggressive tree-shaker, eliminating unused top-level
+definitions. Microscheme has a robust @dfn{Foreign Function Interface} (FFI)
+meaning that C code may be invoked directly from (ms) programs.")
+ (license license:expat)))
+
(define-public simavr
(package
(name "simavr")
diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index e976203b89..ccce686010 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -32,12 +32,9 @@ (define-module (gnu packages avr)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
#:use-module (gnu packages check)
- #:use-module (gnu packages compression)
#:use-module (gnu packages cross-base)
#:use-module (gnu packages flashing-tools)
- #:use-module (gnu packages gcc)
- #:use-module (gnu packages llvm)
- #:use-module (gnu packages vim))
+ #:use-module (gnu packages gcc))
(define-public avr-binutils
(package
@@ -142,40 +139,3 @@ (define-public avr-toolchain
C++.")
(home-page (package-home-page avr-libc))
(license (package-license avr-gcc))))
-
-(define-public microscheme
- (package
- (name "microscheme")
- (version "0.9.4")
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/ryansuchocki/microscheme")
- (commit (string-append "v" version))))
- (sha256
- (base32 "1bflwirpcd58bngbs6hgjfwxl894ni2gpdd4pj10pm2mjhyj5dgw"))
- (file-name (git-file-name name version))))
- (build-system gnu-build-system)
- (arguments
- `(#:parallel-build? #f ; fails to build otherwise
- #:tests? #f ; no tests
- #:phases
- (modify-phases %standard-phases
- (delete 'configure))
- #:make-flags
- (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
- (native-inputs
- (list clang cppcheck unzip xxd))
- (home-page "https://github.com/ryansuchocki/microscheme/")
- (synopsis "Scheme subset for Atmel microcontrollers")
- (description
- "Microscheme, or @code{(ms)} for short, is a functional programming
-language for the Arduino, and for Atmel 8-bit AVR microcontrollers in general.
-Microscheme is a subset of Scheme, in the sense that every valid @code{(ms)}
-program is also a valid Scheme program (with the exception of Arduino
-hardware-specific primitives). The @code{(ms)} compiler performs function
-inlining, and features an aggressive tree-shaker, eliminating unused top-level
-definitions. Microscheme has a robust @dfn{Foreign Function Interface} (FFI)
-meaning that C code may be invoked directly from (ms) programs.")
- (license license:expat)))
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 01/23] gnu: cross-libc: Return #f if no libc available.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-1-jean@foundationdevices.com
* gnu/packages/cross-base.scm (cross-libc): Return #f if platform does
not have a libc available.
---
gnu/packages/cross-base.scm | 138 +++++++++++++++++++-----------------
1 file changed, 71 insertions(+), 67 deletions(-)

Toggle diff (158 lines)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 14cb365099..f55765f1b0 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -9,6 +9,7 @@
;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2023 Josselin Poiret <dev@jpoiret.xyz>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -611,73 +612,76 @@ (define* (cross-libc* target
(xheaders (cross-kernel-headers target)))
"Return LIBC cross-built for TARGET, a GNU triplet. Use XGCC and XBINUTILS
and the cross tool chain."
- (if (target-mingw? target)
- (let ((machine (substring target 0 (string-index target #\-))))
- (make-mingw-w64 machine
- #:xgcc xgcc
- #:xbinutils xbinutils))
- (package
- (inherit libc)
- (name (string-append "glibc-cross-" target))
- (arguments
- (substitute-keyword-arguments
- `( ;; Disable stripping (see above.)
- #:strip-binaries? #f
-
- ;; This package is used as a target input, but it should not have
- ;; the usual cross-compilation inputs since that would include
- ;; itself.
- #:implicit-cross-inputs? #f
-
- ;; We need SRFI 26.
- #:modules ((guix build gnu-build-system)
- (guix build utils)
- (srfi srfi-26))
-
- ,@(package-arguments libc))
- ((#:configure-flags flags)
- `(cons ,(string-append "--host=" target)
- ,(if (target-hurd? target)
- `(append (list "--disable-werror"
- ,@%glibc/hurd-configure-flags)
- ,flags)
- flags)))
- ((#:phases phases)
- `(modify-phases ,phases
- (add-before 'configure 'set-cross-kernel-headers-path
- (lambda* (#:key inputs #:allow-other-keys)
- (let* ((kernel (assoc-ref inputs "kernel-headers"))
- (cpath (string-append kernel "/include")))
- (for-each (cut setenv <> cpath)
- ',%gcc-cross-include-paths)
- (setenv "CROSS_LIBRARY_PATH"
- (string-append kernel "/lib")) ; for Hurd's libihash
- #t)))
- ,@(if (target-hurd? target)
- '((add-after 'install 'augment-libc.so
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out")))
- (substitute* (string-append out "/lib/libc.so")
- (("/[^ ]+/lib/libc.so.0.3")
- (string-append out "/lib/libc.so.0.3"
- " libmachuser.so libhurduser.so"))))
- #t)))
- '())))))
-
- ;; Shadow the native "kernel-headers" because glibc's recipe expects the
- ;; "kernel-headers" input to point to the right thing.
- (propagated-inputs `(("kernel-headers" ,xheaders)))
-
- (native-inputs `(("cross-gcc" ,xgcc)
- ("cross-binutils" ,xbinutils)
- ,@(if (target-hurd? target)
- `(("cross-mig"
- ,(cross-mig target
- #:xgcc xgcc
- #:xbinutils xbinutils)))
- '())
- ,@(package-inputs libc) ;FIXME: static-bash
- ,@(package-native-inputs libc))))))
+ (match target
+ ((? target-mingw?)
+ (let ((machine (substring target 0 (string-index target #\-))))
+ (make-mingw-w64 machine
+ #:xgcc xgcc
+ #:xbinutils xbinutils)))
+ ((or (? target-linux?) (? target-hurd?))
+ (package
+ (inherit libc)
+ (name (string-append "glibc-cross-" target))
+ (arguments
+ (substitute-keyword-arguments
+ `( ;; Disable stripping (see above.)
+ #:strip-binaries? #f
+
+ ;; This package is used as a target input, but it should not have
+ ;; the usual cross-compilation inputs since that would include
+ ;; itself.
+ #:implicit-cross-inputs? #f
+
+ ;; We need SRFI 26.
+ #:modules ((guix build gnu-build-system)
+ (guix build utils)
+ (srfi srfi-26))
+
+ ,@(package-arguments libc))
+ ((#:configure-flags flags)
+ `(cons ,(string-append "--host=" target)
+ ,(if (target-hurd? target)
+ `(append (list "--disable-werror"
+ ,@%glibc/hurd-configure-flags)
+ ,flags)
+ flags)))
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-before 'configure 'set-cross-kernel-headers-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let* ((kernel (assoc-ref inputs "kernel-headers"))
+ (cpath (string-append kernel "/include")))
+ (for-each (cut setenv <> cpath)
+ ',%gcc-cross-include-paths)
+ (setenv "CROSS_LIBRARY_PATH"
+ (string-append kernel "/lib")) ; for Hurd's libihash
+ #t)))
+ ,@(if (target-hurd? target)
+ '((add-after 'install 'augment-libc.so
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out")))
+ (substitute* (string-append out "/lib/libc.so")
+ (("/[^ ]+/lib/libc.so.0.3")
+ (string-append out "/lib/libc.so.0.3"
+ " libmachuser.so libhurduser.so"))))
+ #t)))
+ '())))))
+
+ ;; Shadow the native "kernel-headers" because glibc's recipe expects the
+ ;; "kernel-headers" input to point to the right thing.
+ (propagated-inputs `(("kernel-headers" ,xheaders)))
+
+ (native-inputs `(("cross-gcc" ,xgcc)
+ ("cross-binutils" ,xbinutils)
+ ,@(if (target-hurd? target)
+ `(("cross-mig"
+ ,(cross-mig target
+ #:xgcc xgcc
+ #:xbinutils xbinutils)))
+ '())
+ ,@(package-inputs libc) ;FIXME: static-bash
+ ,@(package-native-inputs libc)))))
+ (else #f)))
;;; Concrete cross tool chains are instantiated like this:
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 02/23] guix: gnu: Handle platforms without libc.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-2-jean@foundationdevices.com
* guix/build-system/gnu.scm (standard-cross-packages): Do not add
cross-libc as an input if the system doesn't support a libc.
---
guix/build-system/gnu.scm | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

Toggle diff (26 lines)
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index c1aa187c42..03a742f8b9 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -460,11 +460,15 @@ (define standard-cross-packages
`(("cross-gcc" ,(gcc target
#:xbinutils (binutils target)
#:libc libc))
- ("cross-libc" ,libc)
- ;; MinGW's libc doesn't have a "static" output.
- ,@(if (member "static" (package-outputs libc))
- `(("cross-libc:static" ,libc "static"))
+ ;; Some targets don't have a libc.
+ ,@(if libc
+ `(("cross-libc" ,libc)
+
+ ;; MinGW's libc doesn't have a "static" output.
+ ,@(if (member "static" (package-outputs libc))
+ `(("cross-libc:static" ,libc "static"))
+ '()))
'()))))))))
(define* (gnu-cross-build name
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 07/23] gnu: Add AVR phases to cross-gcc-build-phases.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-7-jean@foundationdevices.com
* gnu/build/cross-toolchain.scm (set-cross-path/avr): New procedure.

* gnu/build/cross-toolchain.scm (cross-gcc-build-phases): Add case for
AVR target.
---
gnu/build/cross-toolchain.scm | 41 +++++++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 7 deletions(-)

Toggle diff (61 lines)
diff --git a/gnu/build/cross-toolchain.scm b/gnu/build/cross-toolchain.scm
index 9746be3e50..8de62be593 100644
--- a/gnu/build/cross-toolchain.scm
+++ b/gnu/build/cross-toolchain.scm
@@ -97,6 +97,31 @@ (define (cross? x)
;; We're building the sans-libc cross-compiler, so nothing to do.
#t)))
+(define* (set-cross-path/avr #:key inputs #:allow-other-keys)
+ (match (assoc-ref inputs "libc")
+ ((? string? libc)
+ (define (cross? x)
+ ;; Return #t if X is a cross-libc.
+ (string-prefix? libc x))
+
+ (let ((cpath (string-append libc "/avr/include")))
+ (for-each (cut setenv <> cpath)
+ %gcc-cross-include-paths))
+
+ (setenv "CROSS_LIBRARY_PATH"
+ (string-append libc "/avr/lib"))
+
+ (for-each (lambda (var)
+ (and=> (getenv var)
+ (lambda (value)
+ (let* ((path (search-path-as-string->list value))
+ (native-path (list->search-path-as-string
+ (remove cross? path) ":")))
+ (setenv var native-path)))))
+ (cons "LIBRARY_PATH" %gcc-include-paths)))
+ ;; AVR sans-libc cross-compiler.
+ (else #t)))
+
(define* (set-cross-path/mingw #:key inputs target #:allow-other-keys)
"Add the cross MinGW headers to CROSS_C_*_INCLUDE_PATH, and remove them from
C_*INCLUDE_PATH."
@@ -174,13 +199,15 @@ (define* (cross-gcc-build-phases target
a target triplet."
(modify-phases phases
(add-before 'configure 'set-cross-path
- ;; This mingw32 target checking logic should match that of target-mingw?
- ;; in (guix utils), but (guix utils) is too large too copy over to the
- ;; build side entirely and for now we have no way to select variables to
- ;; copy over. See (gnu packages cross-base) for more details.
- (if (string-suffix? "-mingw32" target)
- (cut set-cross-path/mingw #:target target <...>)
- set-cross-path))
+ (cond
+ ;; This mingw32 target checking logic should match that of target-mingw?
+ ;; in (guix utils), but (guix utils) is too large too copy over to the
+ ;; build side entirely and for now we have no way to select variables to
+ ;; copy over. See (gnu packages cross-base) for more details.
+ ((string-suffix? "-mingw32" target)
+ (cut set-cross-path/mingw #:target target <...>))
+ ((string-prefix? "avr" target) set-cross-path/avr)
+ (else set-cross-path)))
(add-after 'install 'make-cross-binutils-visible
(cut make-cross-binutils-visible #:target target <...>))
(replace 'install install-strip)))
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 12/23] gnu: Remove various AVR packages.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-12-jean@foundationdevices.com
* gnu/packages/avr.scm (avr-gcc): Remove variable.
(avr-libc): Ditto.
(avr-toolchain): Ditto.
---
gnu/packages/avr.scm | 92 +++-----------------------------------------
1 file changed, 6 insertions(+), 86 deletions(-)

Toggle diff (113 lines)
diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index 97873a8691..e9b8e2b064 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -23,72 +23,16 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages avr)
- #:use-module ((guix licenses) #:prefix license:)
- #:use-module (guix gexp)
- #:use-module (guix utils)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages cross-base)
+ #:use-module (guix build-system gnu)
#:use-module (guix download)
- #:use-module (guix git-download)
+ #:use-module (guix gexp)
+ #:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
- #:use-module (guix build-system gnu)
- #:use-module (guix build-system trivial)
- #:use-module (gnu packages check)
- #:use-module (gnu packages cross-base)
- #:use-module (gnu packages flashing-tools)
- #:use-module (gnu packages gcc)
+ #:use-module (guix utils)
#:export (make-avr-libc))
-(define avr-gcc
- (let ((xgcc (cross-gcc "avr" #:xbinutils avr-binutils)))
- (package
- (inherit xgcc)
- (name "avr-gcc")
- (arguments
- (substitute-keyword-arguments (package-arguments xgcc)
- ((#:phases phases)
- #~(modify-phases #$phases
- (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
- (lambda* (#:key inputs #:allow-other-keys)
- (let ((gcc (assoc-ref inputs "gcc")))
- ;; Remove the default compiler from CPLUS_INCLUDE_PATH to
- ;; prevent header conflict with the GCC from native-inputs.
- (setenv "CPLUS_INCLUDE_PATH"
- (string-join
- (delete (string-append gcc "/include/c++")
- (string-split (getenv "CPLUS_INCLUDE_PATH")
- #\:))
- ":"))
- (format #t
- "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
- (getenv "CPLUS_INCLUDE_PATH")))))
- ;; Without a working multilib build, the resulting GCC lacks
- ;; support for nearly every AVR chip.
- (add-after 'unpack 'fix-genmultilib
- (lambda _
- ;; patch-shebang doesn't work here because there are actually
- ;; several scripts inside this script, each with a #!/bin/sh
- ;; that needs patching.
- (substitute* "gcc/genmultilib"
- (("#!/bin/sh") (string-append "#!" (which "sh"))))))))))
- (native-search-paths
- (list (search-path-specification
- (variable "CROSS_C_INCLUDE_PATH")
- (files '("avr/include")))
- (search-path-specification
- (variable "CROSS_CPLUS_INCLUDE_PATH")
- (files '("avr/include")))
- (search-path-specification
- (variable "CROSS_OBJC_INCLUDE_PATH")
- (files '("avr/include")))
- (search-path-specification
- (variable "CROSS_OBJCPLUS_INCLUDE_PATH")
- (files '("avr/include")))
- (search-path-specification
- (variable "CROSS_LIBRARY_PATH")
- (files '("avr/lib")))))
- (native-inputs
- `(("gcc" ,gcc)
- ,@(package-native-inputs xgcc))))))
-
(define* (make-avr-libc #:key
(xbinutils (cross-binutils "avr"))
(xgcc (cross-gcc "avr")))
@@ -117,27 +61,3 @@ (define* (make-avr-libc #:key
for use with GCC on Atmel AVR microcontrollers.")
(license
(license:non-copyleft "http://www.nongnu.org/avr-libc/LICENSE.txt"))))
-
-(define avr-libc (make-avr-libc))
-
-(define-public avr-toolchain
- ;; avr-libc checks the compiler version and passes "--enable-device-lib" for avr-gcc > 5.1.0.
- ;; It wouldn't install the library for atmega32u4 etc if we didn't use the corret avr-gcc.
- (package
- (name "avr-toolchain")
- (version (package-version avr-gcc))
- (source #f)
- (build-system trivial-build-system)
- (arguments '(#:builder (begin (mkdir %output) #t)))
- (propagated-inputs
- `(("avrdude" ,avrdude)
- ("binutils" ,avr-binutils)
- ("gcc" ,avr-gcc)
- ("libc" ,avr-libc)))
- (synopsis "Complete GCC tool chain for AVR microcontroller development")
- (description "This package provides a complete GCC tool chain for AVR
-microcontroller development. This includes the GCC AVR cross compiler and
-avrdude for firmware flashing. The supported programming languages are C and
-C++.")
- (home-page (package-home-page avr-libc))
- (license (package-license avr-gcc))))
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 14/23] gnu: cross-gcc-arguments: Handle AVR target.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-14-jean@foundationdevices.com
* gnu/packages/cross-base.scm (cross-gcc-arguments): Handle AVR target.
---
gnu/packages/cross-base.scm | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)

Toggle diff (50 lines)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index fc21e7c4fd..10d912b755 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -204,23 +204,38 @@ (define (cross-gcc-arguments target xgcc libc)
#~("--enable-multilib")
#~())
+ #$@(if (and libc (target-avr? target))
+ #~("--enable-languages=c,c++"
+ (string-append "--with-native-system-header-dir="
+ #$libc "/avr/include" ))
#~()))
(remove
(lambda (flag)
(or (and (string-match "--enable-languages.*" flag)
#$libc)
+ (and (string-match "--with-native-system-header-dir.*"
+ flag)
+ #$libc
+ #$(target-avr? target))
(and (string-match "--disable-multilib" flag)
#$(target-avr? target))))
#$flags)))
((#:make-flags flags)
- (if libc
- #~(let ((libc (assoc-ref %build-inputs "libc")))
+ (cond
+ ((and (target-avr? target) libc)
+ #~(let ((libc (assoc-ref %build-inputs "libc")))
;; FLAGS_FOR_TARGET are needed for the target libraries to receive
;; the -Bxxx for the startfiles.
- (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib")
- #$flags))
- flags))
+ (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/avr/lib")
+ #$flags)))
+ (libc
+ #~(let ((libc (assoc-ref %build-inputs "libc")))
+ ;; FLAGS_FOR_TARGET are needed for the target libraries to receive
+ ;; the -Bxxx for the startfiles.
+ (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib")
+ #$flags)))
+ (else flags)))
((#:phases phases)
#~(cross-gcc-build-phases #$target #$phases))))))
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 13/23] gnu: cross-libc: Add AVR Libc case.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-13-jean@foundationdevices.com
* gnu/packages/cross-base.scm (cross-libc): Handle the AVR target case
and return AVR Libc package.
---
gnu/packages/cross-base.scm | 3 +++
1 file changed, 3 insertions(+)

Toggle diff (23 lines)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index ec7ca2186d..fc21e7c4fd 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -28,6 +28,7 @@
(define-module (gnu packages cross-base)
#:use-module (gnu packages)
+ #:use-module (gnu packages avr)
#:use-module (gnu packages gcc)
#:use-module (gnu packages base)
#:use-module (gnu packages linux)
@@ -622,6 +623,8 @@ (define* (cross-libc* target
"Return LIBC cross-built for TARGET, a GNU triplet. Use XGCC and XBINUTILS
and the cross tool chain."
(match target
+ ((? target-avr?)
+ (make-avr-libc #:xgcc xgcc #:xbinutils xbinutils))
((? target-mingw?)
(let ((machine (substring target 0 (string-index target #\-))))
(make-mingw-w64 machine
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 15/23] guix: meson-configuration: Fix boolean assigment.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-15-jean@foundationdevices.com
* guix/build/meson-configuration.scm (write-assigment): Print true for
#t and false for #f. Previously it was inverting the values.
---
guix/build/meson-configuration.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (18 lines)
diff --git a/guix/build/meson-configuration.scm b/guix/build/meson-configuration.scm
index 1aac5f8f0a..5e194d4c2b 100644
--- a/guix/build/meson-configuration.scm
+++ b/guix/build/meson-configuration.scm
@@ -43,9 +43,9 @@ (define (write-assignment port key value)
(format port "~a = '~a'~%" key value))
((? integer?)
(format port "~a = ~a~%" key value))
- (#f
- (format port "~a = true~%" key))
(#t
+ (format port "~a = true~%" key))
+ (#f
(format port "~a = false~%" key))))
(define* (write-assignments port alist)
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 16/23] gnu: cross-gcc-search-paths: Handle AVR target.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-16-jean@foundationdevices.com
* gnu/packages/cross-base.scm (cross-gcc-search-paths): Handle AVR
target case.
---
gnu/packages/cross-base.scm | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

Toggle diff (38 lines)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 10d912b755..ee90424076 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -267,6 +267,31 @@ (define (cross-gcc-snippet target)
"-DTOOLDIR_BASE_PREFIX=\\\"../../../../\\\""))
#t))
+(define (cross-gcc-search-paths target)
+ "Return GCC search paths needed for TARGET."
+ (cons (search-path-specification
+ (variable "CROSS_LIBRARY_PATH")
+ (files `("lib" "lib64"
+ ,@(list (string-append target "/lib")
+ (string-append target "/lib64")))))
+
+ (map (lambda (variable)
+ (search-path-specification
+ (variable variable)
+
+ ;; Add 'include/c++' here so that <cstdlib>'s
+ ;; "#include_next <stdlib.h>" finds GCC's
+ ;; <stdlib.h>, not libc's.
+ (files (match variable
+ ("CROSS_CPLUS_INCLUDE_PATH"
+ `("include/c++" "include"
+ ,@(list (string-append target "/include/c++")
+ (string-append target "/include"))))
+ (_
+ `("include"
+ ,@(string-append target "/include")))))))
+ %gcc-cross-include-paths)))
+
(define* (cross-gcc target
#:key
(xgcc %xgcc)
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 17/23] gnu: cross-gcc: Handle inputs for AVR.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-17-jean@foundationdevices.com
* gnu/packages/cross-base.scm (cross-gcc) <inputs>: Handle inputs for
AVR.
---
gnu/packages/cross-base.scm | 5 +++++
1 file changed, 5 insertions(+)

Toggle diff (18 lines)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index ee90424076..ef793557fc 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -366,6 +366,11 @@ (define* (cross-gcc target
,@(assoc-ref (%final-inputs)
"libc:static"))))))
(cond
+ ((target-avr? target)
+ (if libc
+ `(,@inputs
+ ("libc" ,libc))
+ inputs))
((target-mingw? target)
(if libc
`(,@inputs
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 11/23] gnu: avr-binutils: Deprecate package.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-11-jean@foundationdevices.com
* gnu/packages/avr.scm (avr-binutils): Delete variable.

* gnu/packages/cross-toolchain.scm (avr-binutils): New deprecated variable.
---
gnu/packages/avr.scm | 5 -----
gnu/packages/cross-toolchain.scm | 4 ++++
2 files changed, 4 insertions(+), 5 deletions(-)

Toggle diff (37 lines)
diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index df1523274b..97873a8691 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -37,11 +37,6 @@ (define-module (gnu packages avr)
#:use-module (gnu packages gcc)
#:export (make-avr-libc))
-(define-public avr-binutils
- (package
- (inherit (cross-binutils "avr"))
- (name "avr-binutils")))
-
(define avr-gcc
(let ((xgcc (cross-gcc "avr" #:xbinutils avr-binutils)))
(package
diff --git a/gnu/packages/cross-toolchain.scm b/gnu/packages/cross-toolchain.scm
index 5617959851..77af6b862b 100644
--- a/gnu/packages/cross-toolchain.scm
+++ b/gnu/packages/cross-toolchain.scm
@@ -20,6 +20,7 @@ (define-module (gnu packages cross-toolchain)
#:use-module (gnu packages avr)
#:use-module (gnu packages cross-base)
#:use-module (guix build-system trivial)
+ #:use-module (guix deprecation)
#:use-module (guix packages)
#:use-module (srfi srfi-1)
#:export (make-cross-gcc-toolchain))
@@ -61,3 +62,6 @@ (define* (make-cross-gcc-toolchain target
(define-public binutils-cross-avr
(cross-binutils "avr"))
+
+(define-deprecated/public avr-binutils binutils-cross-avr
+ (deprecated-package "avr-binutils" binutils-cross-avr))
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 19/23] gnu: Add gcc-cross-avr-toolchain.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-19-jean@foundationdevices.com
* gnu/packages/cross-toolchain.scm (gcc-cross-avr-toolchain): New
variable.
---
gnu/packages/cross-toolchain.scm | 8 ++++++++
1 file changed, 8 insertions(+)

Toggle diff (18 lines)
diff --git a/gnu/packages/cross-toolchain.scm b/gnu/packages/cross-toolchain.scm
index 929e665e50..2ee039c7f6 100644
--- a/gnu/packages/cross-toolchain.scm
+++ b/gnu/packages/cross-toolchain.scm
@@ -70,3 +70,11 @@ (define-deprecated/public avr-binutils binutils-cross-avr
(define-public avr-libc
(cross-libc "avr"))
+
+;;; Cross toolchains:
+
+(define-public gcc-cross-avr-toolchain
+ (make-cross-gcc-toolchain "avr"
+ #:libc avr-libc
+ #:xgcc (cross-gcc "avr" #:libc avr-libc)
+ #:xbinutils binutils-cross-avr))
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 09/23] gnu: Add make-cross-gcc-toolchain.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-9-jean@foundationdevices.com
* gnu/packages/cross-toolchain.scm (make-cross-gcc-toolchain): New
procedure.
---
gnu/local.mk | 1 +
gnu/packages/cross-toolchain.scm | 58 ++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+)
create mode 100644 gnu/packages/cross-toolchain.scm

Toggle diff (78 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index bfa816d717..bdd3af5080 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -197,6 +197,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/crates-graphics.scm \
%D%/packages/crates-gtk.scm \
%D%/packages/cross-base.scm \
+ %D%/packages/cross-toolchain.scm \
%D%/packages/crypto.scm \
%D%/packages/cryptsetup.scm \
%D%/packages/cups.scm \
diff --git a/gnu/packages/cross-toolchain.scm b/gnu/packages/cross-toolchain.scm
new file mode 100644
index 0000000000..0062d043a0
--- /dev/null
+++ b/gnu/packages/cross-toolchain.scm
@@ -0,0 +1,58 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages cross-toolchain)
+ #:use-module (gnu packages avr)
+ #:use-module (gnu packages cross-base)
+ #:use-module (guix build-system trivial)
+ #:use-module (guix packages)
+ #:use-module (srfi srfi-1)
+ #:export (make-cross-gcc-toolchain))
+
+(define* (make-cross-gcc-toolchain target
+ #:key
+ (libc (cross-libc target))
+ (xgcc (cross-gcc target #:libc libc))
+ (xbinutils (cross-binutils target)))
+ (package
+ (name (string-append (package-name xgcc) "-toolchain"))
+ (version (package-version xgcc))
+ (source #f)
+ (build-system trivial-build-system)
+ (arguments
+ '(#:modules ((guix build union))
+ #:builder (begin
+ (use-modules (ice-9 match)
+ (guix build union))
+
+ (match %build-inputs
+ (((names . directory) ...)
+ (union-build (assoc-ref %outputs "out") directory))))))
+ (inputs (list xgcc xbinutils libc))
+ (native-search-paths (package-native-search-paths xgcc))
+ (search-paths (package-search-paths xgcc))
+ (properties (alist-delete 'hidden? (package-properties xgcc)))
+ (license (package-license xgcc))
+ (synopsis (string-append "Complete GCC tool chain for C/C++ development ("
+ target ")"))
+ (description
+ "This package provides a complete GCC cross tool chain for C/C++
+development to be installed in user profiles. This includes GCC, as well as
+libc (headers and binaries), and Binutils. GCC is the GNU Compiler
+Collection.")
+ (home-page "https://gcc.gnu.org/")))
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 20/23] gnu: Add avr-toolchain.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-20-jean@foundationdevices.com
* gnu/packages/cross-toolchain.scm (avr-toolchain): New variable.
---
gnu/packages/cross-toolchain.scm | 8 ++++++++
1 file changed, 8 insertions(+)

Toggle diff (25 lines)
diff --git a/gnu/packages/cross-toolchain.scm b/gnu/packages/cross-toolchain.scm
index 2ee039c7f6..0f1cd45b40 100644
--- a/gnu/packages/cross-toolchain.scm
+++ b/gnu/packages/cross-toolchain.scm
@@ -19,6 +19,7 @@
(define-module (gnu packages cross-toolchain)
#:use-module (gnu packages avr)
#:use-module (gnu packages cross-base)
+ #:use-module (gnu packages flashing-tools)
#:use-module (guix build-system trivial)
#:use-module (guix deprecation)
#:use-module (guix packages)
@@ -78,3 +79,10 @@ (define-public gcc-cross-avr-toolchain
#:libc avr-libc
#:xgcc (cross-gcc "avr" #:libc avr-libc)
#:xbinutils binutils-cross-avr))
+
+(define-deprecated/public avr-toolchain gcc-cross-avr-toolchain
+ (deprecated-package "avr-toolchain"
+ (package/inherit gcc-cross-avr-toolchain
+ (inputs
+ (modify-inputs (package-inputs gcc-cross-avr-toolchain)
+ (append avrdude))))))
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 21/23] guix: meson-build-system: Support AVR.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-21-jean@foundationdevices.com
* guix/build-system/meson.scm (make-machine-alist)
<system> [target-avr?]: Set to none.
<cpu_family> [target-avr?]: Set to avr.
<cpu> [target-avr?]: Set to avr.
---
guix/build-system/meson.scm | 3 +++
1 file changed, 3 insertions(+)

Toggle diff (28 lines)
diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm
index 7c617bffb0..b894789fb8 100644
--- a/guix/build-system/meson.scm
+++ b/guix/build-system/meson.scm
@@ -49,11 +49,13 @@ (define (make-machine-alist triplet)
`((system . ,(cond ((target-hurd? triplet) "gnu")
((target-linux? triplet) "linux")
((target-mingw? triplet) "windows")
+ ((target-avr? triplet) "none")
(#t (error "meson: unknown operating system"))))
(cpu_family . ,(cond ((target-x86-32? triplet) "x86")
((target-x86-64? triplet) "x86_64")
((target-arm32? triplet) "arm")
((target-aarch64? triplet) "aarch64")
+ ((target-avr? triplet) "avr")
((target-mips64el? triplet) "mips64")
((target-powerpc? triplet)
(if (target-64bit? triplet)
@@ -66,6 +68,7 @@ (define (make-machine-alist triplet)
((target-x86-64? triplet) "x86_64")
((target-aarch64? triplet) "armv8-a")
((target-arm32? triplet) "armv7")
+ ((target-avr? triplet) "avr")
;; According to #mesonbuild on OFTC, there does not appear
;; to be an official-ish list of CPU types recognised by
;; Meson, the "cpu" field is not used by Meson itself and
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 22/23] guix: meson-build-system: Disable PIC for AVR.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-22-jean@foundationdevices.com
* guix/build-system/meson.scm (make-built-in-options-alist): New
variable.

* guix/build-system/meson.scm (make-cross-file): Add 'built-in options'
section to cross file.
---
guix/build-system/meson.scm | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

Toggle diff (31 lines)
diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm
index b894789fb8..92e47285d6 100644
--- a/guix/build-system/meson.scm
+++ b/guix/build-system/meson.scm
@@ -92,6 +92,13 @@ (define (make-binaries-alist triplet)
(ld . ,(string-append triplet "-ld"))
(strip . ,(string-append triplet "-strip"))))
+(define (make-built-in-options-alist triplet)
+ (if (target-avr? triplet)
+ `((b_pie . #f)
+ (b_staticpic . #f)
+ (default_library . "static"))
+ '()))
+
(define (make-cross-file triplet)
(computed-file "cross-file"
(with-imported-modules '((guix build meson-configuration))
@@ -102,7 +109,9 @@ (define (make-cross-file triplet)
(write-section-header port "host_machine")
(write-assignments port '#$(make-machine-alist triplet))
(write-section-header port "binaries")
- (write-assignments port '#$(make-binaries-alist triplet))))))))
+ (write-assignments port '#$(make-binaries-alist triplet))
+ (write-section-header port "built-in options")
+ (write-assignments port '#$(make-built-in-options-alist triplet))))))))
(define %meson-build-system-modules
;; Build-side modules imported by default.
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 18/23] gnu: Add avr-libc.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-18-jean@foundationdevices.com
* gnu/packages/cross-toolchain.scm (avr-libc): New variable.
---
gnu/packages/cross-toolchain.scm | 5 +++++
1 file changed, 5 insertions(+)

Toggle diff (15 lines)
diff --git a/gnu/packages/cross-toolchain.scm b/gnu/packages/cross-toolchain.scm
index 77af6b862b..929e665e50 100644
--- a/gnu/packages/cross-toolchain.scm
+++ b/gnu/packages/cross-toolchain.scm
@@ -65,3 +65,8 @@ (define-public binutils-cross-avr
(define-deprecated/public avr-binutils binutils-cross-avr
(deprecated-package "avr-binutils" binutils-cross-avr))
+
+;;; C standard libraries:
+
+(define-public avr-libc
+ (cross-libc "avr"))
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 23/23] gnu: Add unity.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-23-jean@foundationdevices.com
* gnu/packages/check.scm (unity): New variable.
---
gnu/packages/check.scm | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)

Toggle diff (61 lines)
diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index 5af3b49280..db368663d4 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -87,6 +87,7 @@ (define-module (gnu packages check)
#:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages python-science)
+ #:use-module (gnu packages ruby)
#:use-module (gnu packages texinfo)
#:use-module (gnu packages time)
#:use-module (gnu packages xml)
@@ -3170,6 +3171,46 @@ (define-public unittest-cpp
portable to just about any platform.")
(license license:expat)))
+(define-public unity
+ (let ((revision "0")
+ (commit "2775e1b05875cf45afce7153e36af76ddbfdba26"))
+ (package
+ (name "unity")
+ (version (git-version "2.5.4" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/ThrowTheSwitch/Unity")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0y803ibjkqvj1fil0a0hzs7x0m98amm5ibwl8xxk3p8bj9wgdps1"))))
+ (build-system meson-build-system)
+ (arguments
+ (list #:configure-flags #~(list "-Dextension_fixture=true"
+ "-Dextension_memory=true"
+ "-Dsupport_double=true")
+ #:phases #~(modify-phases %standard-phases
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (with-directory-excursion "../source/test"
+ (invoke "rake" "all"))))))))
+ (native-inputs
+ (append (list python)
+ (if (not (%current-target-system))
+ (list ruby
+ ruby-rake
+ ruby-rspec
+ ruby-rubocop)
+ '())))
+ (home-page "http://throwtheswitch.org")
+ (synopsis "Unit testing framework for C")
+ (description "Unity is a lightweight unit testing framework for C. It was
+designed to allow running tests on embedded devices and on a host computer.")
+ (license license:expat))))
+
(define-public libfaketime
(package
(name "libfaketime")
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 29 Sep 2023 02:16
[PATCH 10/23] gnu: Add binutils-cross-avr.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230929091627.7820-10-jean@foundationdevices.com
* gnu/packages/cross-toolchain.scm (binutils-cross-avr): New variable.
---
gnu/packages/cross-toolchain.scm | 5 +++++
1 file changed, 5 insertions(+)

Toggle diff (15 lines)
diff --git a/gnu/packages/cross-toolchain.scm b/gnu/packages/cross-toolchain.scm
index 0062d043a0..5617959851 100644
--- a/gnu/packages/cross-toolchain.scm
+++ b/gnu/packages/cross-toolchain.scm
@@ -56,3 +56,8 @@ (define* (make-cross-gcc-toolchain target
libc (headers and binaries), and Binutils. GCC is the GNU Compiler
Collection.")
(home-page "https://gcc.gnu.org/")))
+
+;;; Cross binutils:
+
+(define-public binutils-cross-avr
+ (cross-binutils "avr"))
--
2.34.1
J
J
Jean-Pierre De Jesus Diaz wrote on 29 Sep 2023 02:18
Re: [PATCH 00/23] guix: Add avr as a platform.
(address . guix-patches@gnu.org)
CAG1gdUrFca4xmGNLiaJsWWGcSpYRHHxsYUbUtZYO_NcE=jhHfw@mail.gmail.com
Toggle quote (3 lines)
> The [PATCH 21/23] fixes a bug in the meson-configuration module
> and can be applied independently.

Meant [PATCH 15/23], my mistake.

--
Jean-Pierre De Jesus DIAZ
Software Engineer
Foundation Devices
M
M
Mathieu Othacehe wrote on 4 Oct 2023 06:01
Re: bug#66263: [PATCH 00/23] guix: Add avr as a platform.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87il7mk0dm.fsf@gnu.org
Hello,

Toggle quote (3 lines)
> The [PATCH 21/23] fixes a bug in the meson-configuration module
> and can be applied independently.

I applied this one. Now the rest of the series also seems fine to me.
Maxim, Efraim, Vagrant any thoughts?

Thanks,

Mathieu
E
E
Efraim Flashner wrote on 4 Oct 2023 07:07
Re: [bug#66263] [PATCH 06/23] gnu: microscheme: Move to avr-xyz.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
ZR1xocpTwA6N1mCp@3900XT
Attachment: file
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmUdcZ0ACgkQQarn3Mo9
g1H3XxAAoOnTuowzfz9mjFiw1B2dcYb0Lvh/iNWv94sT6EhQn+Sk3c4qnJ3YwXCh
C7T4knTwLiWx46tR5dhI1L2SkuE6cy0qUwYL8VcsrQs1/s8wOxkHRDr44cIYD6wL
yTvFt5eCqVbmxhIcazsiQOv31Fqgk6iVeYAzhhNeNg47NtZT7LBn3uuJP3GDlbU9
yX/HdteTTHjGjbqtSUcB6ITce9VoURvMpqtNObRs8FqF5lrwFIxo2V+QjoiMpuca
TzlfHFJvZ6jYNh6enH+3JZgvobmlJNhcR9rbluUpLG2Xf1quJ3aHUS3duqgmuMbc
9Qgj49XfncfNAkds+wvv/uFjyitBUU5Y77Sea06kX9O1mhCdF5TXpVjDbhbJFn1F
CvnUnwwTL7bXMteIwJ/jf2zdYoGajf8gs8Ie8JLo1iz8GTMAgFAD0+9CJh7v98p6
KSeOLIRQ4zsO9fvz3bTKmIDrO3N9qV11nfSXkSrEFx46kvTszfWZpWsGOIM0hexQ
f3y9H2YGb+gZSdVeqsXyyPcwXI4Fu3etl7/28rlQqebmgS7Bk6PeQh1FrTbVDrWf
PWr1tSmpFMwZn1vkj53y5AzM3j/sdbe4Lcz0G8p4V2AptQl6iK297fezYApMXG1v
710MlxGj3GEGyNko++in9tWPk4u29GssTDe9dIv/vqhxWLthGp4=
=9qm+
-----END PGP SIGNATURE-----


E
E
Efraim Flashner wrote on 4 Oct 2023 07:07
Re: [bug#66263] [PATCH 04/23] guix: utils: Add target-avr?.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
ZR1xrtB-Db-ZQ83W@3900XT
On Fri, Sep 29, 2023 at 11:16:08AM +0200, Jean-Pierre De Jesus DIAZ wrote:
Toggle quote (21 lines)
> * guix/utils.scm (target-avr?): New procedure.
> ---
> guix/utils.scm | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/guix/utils.scm b/guix/utils.scm
> index e9af33bdeb..1724b53149 100644
> --- a/guix/utils.scm
> +++ b/guix/utils.scm
> @@ -98,6 +98,7 @@ (define-module (guix utils)
> target-arm32?
> target-aarch64?
> target-arm?
> + target-avr?
> target-ppc32?
> target-ppc64le?
> target-powerpc?
> @@ -722,6 +723,9 @@ (define* (target-arm? #:optional (target (or (%current-target-system)
> (%current-system))))
> (or (target-arm32? target) (target-aarch64? target)))

Is it ever avr<something> or is it always avr? Mostly wondering if it
should be string=?

Toggle quote (12 lines)
> +(define* (target-avr? #:optional (target (%current-target-system)))
> + (string-prefix? "avr" target))
> +
> (define* (target-ppc32? #:optional (target (or (%current-target-system)
> (%current-system))))
> (string-prefix? "powerpc-" target))
> --
> 2.34.1
>
>
>

--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmUdca4ACgkQQarn3Mo9
g1Fdew/9ER8vhRFlWFMIJj4CA+H9eLpaklZexjX3IbwrS3TVD06RDCxGBfgN8xnf
3Ea7d4RnEUU2XYWFXcWuHMngUQCy2Z2iqxPUDVyByk/dvjgvsfj6ZDJaAE+bdCFn
cxmo/ld/rer1iNyAf3woTPlDWndE409L7GTWPTQvw2gz7K9UaqoZmT9CLINeozSY
zRa7jc3HAYHLJgg/EtS+GDUCErV2FCXIsAg9olml6i7hvg1Tk12mMqfz6WSUOGJH
w9aYJh73Z+9OjllYyQZG8vo8l5BkDK6NdpOjz8TDsp8TH/lQYoAqdJ3MUVE0uxwo
9E6IT2tWkcxczTW0r1F4A+pUbtA+rfrK8m3yB4ZzdLsW4Gvg9KSLvAiizeeWYXBa
u9lt/2muxPlw7zUVvNuvLR6qWEXyRvdC0siY5vqQSkio3khzuYxQrOdfi/Ib7T79
jTvNBPO881JjpqghcoDvSiMDsaN8F9eYg+u+x50q8hNQnIrW6j/E0jwU3vwlNYHO
i+O9F3kVXy6RXN5vizCYXwFytFfWP+49wGdVLXJTbEZ2Cq6E5/MrQdxksL/Gful3
cm/fPHfOhQB+4E0IW5KUUNilNw6q0N12duug7GcKxl3pCT4dPV+5d9hJFAebI7h7
ZsJCCDOGoVjREdjWQJemqdORDn3h9Rd8rCFeLRRc5pX4h3JeMq8=
=hOFh
-----END PGP SIGNATURE-----


E
E
Efraim Flashner wrote on 4 Oct 2023 07:07
Re: [bug#66263] [PATCH 09/23] gnu: Add make-cross-gcc-toolchain.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
ZR1xt8RVnOOX50wF@3900XT
On Fri, Sep 29, 2023 at 11:16:13AM +0200, Jean-Pierre De Jesus DIAZ wrote:
Toggle quote (77 lines)
> * gnu/packages/cross-toolchain.scm (make-cross-gcc-toolchain): New
> procedure.
> ---
> gnu/local.mk | 1 +
> gnu/packages/cross-toolchain.scm | 58 ++++++++++++++++++++++++++++++++
> 2 files changed, 59 insertions(+)
> create mode 100644 gnu/packages/cross-toolchain.scm
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index bfa816d717..bdd3af5080 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -197,6 +197,7 @@ GNU_SYSTEM_MODULES = \
> %D%/packages/crates-graphics.scm \
> %D%/packages/crates-gtk.scm \
> %D%/packages/cross-base.scm \
> + %D%/packages/cross-toolchain.scm \
> %D%/packages/crypto.scm \
> %D%/packages/cryptsetup.scm \
> %D%/packages/cups.scm \
> diff --git a/gnu/packages/cross-toolchain.scm b/gnu/packages/cross-toolchain.scm
> new file mode 100644
> index 0000000000..0062d043a0
> --- /dev/null
> +++ b/gnu/packages/cross-toolchain.scm
> @@ -0,0 +1,58 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify it
> +;;; under the terms of the GNU General Public License as published by
> +;;; the Free Software Foundation; either version 3 of the License, or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu packages cross-toolchain)
> + #:use-module (gnu packages avr)
> + #:use-module (gnu packages cross-base)
> + #:use-module (guix build-system trivial)
> + #:use-module (guix packages)
> + #:use-module (srfi srfi-1)
> + #:export (make-cross-gcc-toolchain))
> +
> +(define* (make-cross-gcc-toolchain target
> + #:key
> + (libc (cross-libc target))
> + (xgcc (cross-gcc target #:libc libc))
> + (xbinutils (cross-binutils target)))
> + (package
> + (name (string-append (package-name xgcc) "-toolchain"))
> + (version (package-version xgcc))
> + (source #f)
> + (build-system trivial-build-system)
> + (arguments
> + '(#:modules ((guix build union))
> + #:builder (begin
> + (use-modules (ice-9 match)
> + (guix build union))
> +
> + (match %build-inputs
> + (((names . directory) ...)
> + (union-build (assoc-ref %outputs "out") directory))))))
> + (inputs (list xgcc xbinutils libc))
> + (native-search-paths (package-native-search-paths xgcc))
> + (search-paths (package-search-paths xgcc))
> + (properties (alist-delete 'hidden? (package-properties xgcc)))
> + (license (package-license xgcc))

Trivial thing but the break in the synopsis really bothers me. I'd put
the string-append starting on the next line

Toggle quote (14 lines)
> + (synopsis (string-append "Complete GCC tool chain for C/C++ development ("
> + target ")"))
> + (description
> + "This package provides a complete GCC cross tool chain for C/C++
> +development to be installed in user profiles. This includes GCC, as well as
> +libc (headers and binaries), and Binutils. GCC is the GNU Compiler
> +Collection.")
> + (home-page "https://gcc.gnu.org/")))
> --
> 2.34.1
>
>
>

--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmUdcbcACgkQQarn3Mo9
g1Eb6RAAvYic4r2dcOXj90Mktw7cMvMQoyrgT0CLfCcF4foHXY5IvGE2xqq/JOdQ
WIhL4xnNXzFAhrjRcJNgQIVdC2FQhSCyIDEotgGSBIgp/EE273qN9OBPbp/JP/ta
uDcN2RJCtVbzZUm4avldkUvVrRMDSVFrLe2OIrrmaUgNjhjUMeTkfu8eo1ryVoBy
5KyXrfwgxG3Td3A6igbxSqScJK3CAyAV/DXuvGE/J1RSpofhsbMCK3TvmTYqSlY6
6hV+i1ju/ikw8A3CRiA/BJjPODrM/5ltIEEbKegAMjZ73+B2irmqqEL3VtdmWmYM
cWJwWMER+V3Aa0dfn67UWYI3LbRGhjzttfvfGPuSh9inJftEL12R9U8E1MjJJ6Ow
1I24YUc78kO1R5piwiFq/eJAiuponFxkuiWIg9LhoLbPJDsf1S4RrSsmKv+hZ3LS
0eTDDiGgR6WmPay1b9i5LMlywOb996saMPoodK8fVdsDxUiu5dva/hryq3scGIfG
og+ndHsrgwvGeYS6lLmd/RnAvY0pExb3SdTBrpcy7l03TrMZ48jRLNM84ho6eWZL
QkyvcDXV6dCcLly0pHHMnoO9XR9xFZvzEUC754LG1K29IQpKd4+prlDKAqaTbx9B
EStlvIblZnOiFksu9B4uYn2+hQWfMJKVSVxlWsgCVGEXPa1/unI=
=Ku8m
-----END PGP SIGNATURE-----


M
M
Maxim Cournoyer wrote on 4 Oct 2023 21:15
Re: bug#66263: [PATCH 00/23] guix: Add avr as a platform.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87jzs11z8f.fsf_-_@gmail.com
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (47 lines)
> * gnu/packages/cross-base.scm (cross-gcc-arguments)
> [target-avr?]: Remove --disable-mutlilib and add --enable-multilib.
> ---
> gnu/packages/avr.scm | 4 +---
> gnu/packages/cross-base.scm | 17 +++++++++++++----
> 2 files changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
> index b9bee5e624..e976203b89 100644
> --- a/gnu/packages/avr.scm
> +++ b/gnu/packages/avr.scm
> @@ -75,9 +75,7 @@ (define avr-gcc
> ;; several scripts inside this script, each with a #!/bin/sh
> ;; that needs patching.
> (substitute* "gcc/genmultilib"
> - (("#!/bin/sh") (string-append "#!" (which "sh"))))))))
> - ((#:configure-flags flags)
> - #~(delete "--disable-multilib" #$flags))))
> + (("#!/bin/sh") (string-append "#!" (which "sh"))))))))))
> (native-search-paths
> (list (search-path-specification
> (variable "CROSS_C_INCLUDE_PATH")
> diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
> index f55765f1b0..ec7ca2186d 100644
> --- a/gnu/packages/cross-base.scm
> +++ b/gnu/packages/cross-base.scm
> @@ -197,12 +197,21 @@ (define (cross-gcc-arguments target xgcc libc)
> #~((string-append "--with-toolexeclibdir="
> (assoc-ref %outputs "lib")
> "/" #$target "/lib"))
> + #~())
> +
> + #$@(if (target-avr? target)
> + #~("--enable-multilib")
> + #~())
> +
> #~()))
>
> - #$(if libc
> - flags
> - #~(remove (cut string-match "--enable-languages.*" <>)
> - #$flags))))
> + (remove
> + (lambda (flag)
> + (or (and (string-match "--enable-languages.*" flag)
> + #$libc)

Not your code, but it'd be cleaner to use (string-prefix?
"--enable-languages" flag) here.

Toggle quote (3 lines)
> + (and (string-match "--disable-multilib" flag)
> + #$(target-avr? target))))

I'd also move the #$libc above and #$(target-avr? ...) expressions as
the first tests for 'and', as there is no reason to match strings when
these are #f.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 4 Oct 2023 21:17
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87fs2p1z4s.fsf_-_@gmail.com
Hello,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (32 lines)
> * gnu/packages/avr.scm (make-avr-libc): New procedure.
>
> * gnu/packages/avr.scm (avr-libc): Use make-avr-libc procedure.
> ---
> gnu/packages/avr.scm | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
> index ccce686010..df1523274b 100644
> --- a/gnu/packages/avr.scm
> +++ b/gnu/packages/avr.scm
> @@ -34,7 +34,8 @@ (define-module (gnu packages avr)
> #:use-module (gnu packages check)
> #:use-module (gnu packages cross-base)
> #:use-module (gnu packages flashing-tools)
> - #:use-module (gnu packages gcc))
> + #:use-module (gnu packages gcc)
> + #:export (make-avr-libc))
>
> (define-public avr-binutils
> (package
> @@ -93,7 +94,9 @@ (define avr-gcc
> `(("gcc" ,gcc)
> ,@(package-native-inputs xgcc))))))
>
> -(define avr-libc
> +(define* (make-avr-libc #:key
> + (xbinutils (cross-binutils "avr"))
> + (xgcc (cross-gcc "avr")))
> (package
> (name "avr-libc")

[...]

Procedures returning packages should be memoized, using 'memoize' from
(guix memoization) here since you have keyword arguments.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 4 Oct 2023 21:19
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87bkdd1z1o.fsf_-_@gmail.com
Hi,


Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (4 lines)
> * gnu/packages/avr.scm (microscheme): Remove from file.
>
> * gnu/packages/avr-xyz.scm (microscheme): New variable.

Nitpicks: I'd drop the separating blank line and reword to:

Toggle snippet (4 lines)
* gnu/packages/avr.scm (microscheme): Move to...
* gnu/packages/avr-xyz.scm (microscheme): ... here.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 4 Oct 2023 21:23
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
877co11yvg.fsf_-_@gmail.com
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (30 lines)
> * gnu/packages/avr.scm (make-avr-libc): New procedure.
>
> * gnu/packages/avr.scm (avr-libc): Use make-avr-libc procedure.
> ---
> gnu/packages/avr.scm | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
> index ccce686010..df1523274b 100644
> --- a/gnu/packages/avr.scm
> +++ b/gnu/packages/avr.scm
> @@ -34,7 +34,8 @@ (define-module (gnu packages avr)
> #:use-module (gnu packages check)
> #:use-module (gnu packages cross-base)
> #:use-module (gnu packages flashing-tools)
> - #:use-module (gnu packages gcc))
> + #:use-module (gnu packages gcc)
> + #:export (make-avr-libc))
>
> (define-public avr-binutils
> (package
> @@ -93,7 +94,9 @@ (define avr-gcc
> `(("gcc" ,gcc)
> ,@(package-native-inputs xgcc))))))
>
> -(define avr-libc
> +(define* (make-avr-libc #:key
> + (xbinutils (cross-binutils "avr"))
> + (xgcc (cross-gcc "avr")))

I had forgotten: please document any newly added procedures with doc
strings, especially public ones.

Toggle quote (20 lines)
> (package
> (name "avr-libc")
> (version "2.0.0")
> @@ -106,10 +109,12 @@ (define avr-libc
> "15svr2fx8j6prql2il2fc0ppwlv50rpmyckaxx38d3gxxv97zpdj"))))
> (build-system gnu-build-system)
> (arguments
> - '(#:out-of-source? #t
> - #:configure-flags '("--host=avr")))
> - (native-inputs `(("avr-binutils" ,avr-binutils)
> - ("avr-gcc" ,avr-gcc)))
> + (list #:target "avr"
> +
> + #:out-of-source? #t
> +
> + #:implicit-cross-inputs? #f))
> + (native-inputs (list xbinutils xgcc))
> (home-page "https://www.nongnu.org/avr-libc/")
> (synopsis "The AVR C Library")

This already was like this, but the leading 'The' determinant should be
dropped for synopsis.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 4 Oct 2023 21:34
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
8734yp1ycj.fsf_-_@gmail.com
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (3 lines)
> * gnu/packages/cross-toolchain.scm (make-cross-gcc-toolchain): New
> procedure.

You forgot to mention the registration of the new module in the local.mk
file.

[...]

Toggle quote (29 lines)
> +++ b/gnu/packages/cross-toolchain.scm
> @@ -0,0 +1,58 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify it
> +;;; under the terms of the GNU General Public License as published by
> +;;; the Free Software Foundation; either version 3 of the License, or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu packages cross-toolchain)
> + #:use-module (gnu packages avr)
> + #:use-module (gnu packages cross-base)
> + #:use-module (guix build-system trivial)
> + #:use-module (guix packages)
> + #:use-module (srfi srfi-1)
> + #:export (make-cross-gcc-toolchain))


I'm a bit confused; why do we need this new module; couldn't it live in
(gnu packages cross-base)? Also, there are extraneous imports: (gnu packages
avr) is not needed for one. With a recent Guile you can check for such
imports with

Toggle snippet (3 lines)
guild compile -W3 your-file.scm

Toggle quote (6 lines)
> +(define* (make-cross-gcc-toolchain target
> + #:key
> + (libc (cross-libc target))
> + (xgcc (cross-gcc target #:libc libc))
> + (xbinutils (cross-binutils target)))

Please add a doc string, and memoize packages returning procedures like
this one.

Toggle quote (11 lines)
> + (package
> + (name (string-append (package-name xgcc) "-toolchain"))
> + (version (package-version xgcc))
> + (source #f)
> + (build-system trivial-build-system)
> + (arguments
> + '(#:modules ((guix build union))
> + #:builder (begin
> + (use-modules (ice-9 match)
> + (guix build union))

This will work as long as all the file names are ASCII only, as there's
no locale support in the trivial-build-system. I guess this is not a
problem here, but just mentioning it, as it bit me in the past.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Oct 2023 07:46
Re: [bug#66263] [PATCH 10/23] gnu: Add binutils-cross-avr.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
878r8hrusw.fsf@gmail.com
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (19 lines)
> * gnu/packages/cross-toolchain.scm (binutils-cross-avr): New variable.
> ---
> gnu/packages/cross-toolchain.scm | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/gnu/packages/cross-toolchain.scm b/gnu/packages/cross-toolchain.scm
> index 0062d043a0..5617959851 100644
> --- a/gnu/packages/cross-toolchain.scm
> +++ b/gnu/packages/cross-toolchain.scm
> @@ -56,3 +56,8 @@ (define* (make-cross-gcc-toolchain target
> libc (headers and binaries), and Binutils. GCC is the GNU Compiler
> Collection.")
> (home-page "https://gcc.gnu.org/")))
> +
> +;;; Cross binutils:
> +
> +(define-public binutils-cross-avr
> + (cross-binutils "avr"))

Since this module *uses* the cross* procedures that are likely to create
top level cycles, it should be stressed after the imports near the top
in a ;;; Commentary: comment block that this module exists solely to
provide a convenient way to install the cross toolchains as packages,
and should NOT be imported by any other module to avoid introducing
module cycles.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Oct 2023 07:48
Re: [bug#66263] [PATCH 11/23] gnu: avr-binutils: Deprecate package.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
871qe9ruqa.fsf@gmail.com
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (5 lines)
> * gnu/packages/avr.scm (avr-binutils): Delete variable.
>
> * gnu/packages/cross-toolchain.scm (avr-binutils): New deprecated
> variable.

nitpick: I'd drop the newline between file names in the ChangeLog, but
otherwise, LGTM.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Oct 2023 07:51
Re: [bug#66263] [PATCH 12/23] gnu: Remove various AVR packages.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87wmw1qfzq.fsf@gmail.com
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (4 lines)
> * gnu/packages/avr.scm (avr-gcc): Remove variable.
> (avr-libc): Ditto.
> (avr-toolchain): Ditto.

nitpick: Superfluous hanging indent in GNU ChangeLog.

I think you'll want to rebase this series onto master, as the avr module
has changed since this was made. There are no longer packages such as
avr-toolchain, they are procedures now.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Oct 2023 07:52
Re: [bug#66263] [PATCH 13/23] gnu: cross-libc: Add AVR Libc case.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87sf6pqfy3.fsf@gmail.com
Hello,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (3 lines)
> * gnu/packages/cross-base.scm (cross-libc): Handle the AVR target case
> and return AVR Libc package.

nitpick: hanging indent :-). Otherwise, LGTM.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Oct 2023 07:59
Re: [bug#66263] [PATCH 14/23] gnu: cross-gcc-arguments: Handle AVR target.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87o7hdqfms.fsf@gmail.com
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (37 lines)
> * gnu/packages/cross-base.scm (cross-gcc-arguments): Handle AVR target.
> ---
> gnu/packages/cross-base.scm | 25 ++++++++++++++++++++-----
> 1 file changed, 20 insertions(+), 5 deletions(-)
>
> diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
> index fc21e7c4fd..10d912b755 100644
> --- a/gnu/packages/cross-base.scm
> +++ b/gnu/packages/cross-base.scm
> @@ -204,23 +204,38 @@ (define (cross-gcc-arguments target xgcc libc)
> #~("--enable-multilib")
> #~())
>
> + #$@(if (and libc (target-avr? target))
> + #~("--enable-languages=c,c++"
> + (string-append "--with-native-system-header-dir="
> + #$libc "/avr/include" ))
> #~()))
>
> (remove
> (lambda (flag)
> (or (and (string-match "--enable-languages.*" flag)
> #$libc)
> + (and (string-match "--with-native-system-header-dir.*"
> + flag)
> + #$libc
> + #$(target-avr? target))
> (and (string-match "--disable-multilib" flag)
> #$(target-avr? target))))
> #$flags)))
> ((#:make-flags flags)
> - (if libc
> - #~(let ((libc (assoc-ref %build-inputs "libc")))
> + (cond
> + ((and (target-avr? target) libc)
> + #~(let ((libc (assoc-ref %build-inputs "libc")))

While at it, you may want to use the more modern #$(this-package-input
"libc")

Toggle quote (15 lines)
> ;; FLAGS_FOR_TARGET are needed for the target libraries to receive
> ;; the -Bxxx for the startfiles.
> - (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib")
> - #$flags))
> - flags))
> + (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/avr/lib")
> + #$flags)))
> + (libc
> + #~(let ((libc (assoc-ref %build-inputs "libc")))
> + ;; FLAGS_FOR_TARGET are needed for the target libraries to receive
> + ;; the -Bxxx for the startfiles.
> + (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib")
> + #$flags)))
> + (else flags)))

The only thing that needs to be made conditional here is the "/lib" vs
"/avr/lib" prefix, so you could let-bind a LIB-PREFIX variable
conditionally and keep the rest shared.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Oct 2023 08:00
Re: [bug#66263] [PATCH 15/23] guix: meson-configuration: Fix boolean assigment.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87jzs1qfks.fsf@gmail.com
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (3 lines)
> * guix/build/meson-configuration.scm (write-assigment): Print true for
> #t and false for #f. Previously it was inverting the values.

LGTM.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Oct 2023 08:08
Re: [bug#66263] [PATCH 16/23] gnu: cross-gcc-search-paths: Handle AVR target.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87fs2pqf8p.fsf@gmail.com
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (39 lines)
> * gnu/packages/cross-base.scm (cross-gcc-search-paths): Handle AVR
> target case.
> ---
> gnu/packages/cross-base.scm | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
> index 10d912b755..ee90424076 100644
> --- a/gnu/packages/cross-base.scm
> +++ b/gnu/packages/cross-base.scm
> @@ -267,6 +267,31 @@ (define (cross-gcc-snippet target)
> "-DTOOLDIR_BASE_PREFIX=\\\"../../../../\\\""))
> #t))
>
> +(define (cross-gcc-search-paths target)
> + "Return GCC search paths needed for TARGET."
> + (cons (search-path-specification
> + (variable "CROSS_LIBRARY_PATH")
> + (files `("lib" "lib64"
> + ,@(list (string-append target "/lib")
> + (string-append target "/lib64")))))
> +
> + (map (lambda (variable)
> + (search-path-specification
> + (variable variable)
> +
> + ;; Add 'include/c++' here so that <cstdlib>'s
> + ;; "#include_next <stdlib.h>" finds GCC's
> + ;; <stdlib.h>, not libc's.
> + (files (match variable
> + ("CROSS_CPLUS_INCLUDE_PATH"
> + `("include/c++" "include"
> + ,@(list (string-append target "/include/c++")
> + (string-append target "/include"))))
> + (_
> + `("include"
> + ,@(string-append target "/include")))))))
> + %gcc-cross-include-paths)))

That was a bit hard to parse, but LGTM.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Oct 2023 08:08
Re: [bug#66263] [PATCH 17/23] gnu: cross-gcc: Handle inputs for AVR.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87bkddqf7a.fsf@gmail.com
Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (3 lines)
> * gnu/packages/cross-base.scm (cross-gcc) <inputs>: Handle inputs for
> AVR.

LGTM.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Oct 2023 08:10
Re: [bug#66263] [PATCH 18/23] gnu: Add avr-libc.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
877co1qf5c.fsf@gmail.com
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (19 lines)
> * gnu/packages/cross-toolchain.scm (avr-libc): New variable.
> ---
> gnu/packages/cross-toolchain.scm | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/gnu/packages/cross-toolchain.scm b/gnu/packages/cross-toolchain.scm
> index 77af6b862b..929e665e50 100644
> --- a/gnu/packages/cross-toolchain.scm
> +++ b/gnu/packages/cross-toolchain.scm
> @@ -65,3 +65,8 @@ (define-public binutils-cross-avr
>
> (define-deprecated/public avr-binutils binutils-cross-avr
> (deprecated-package "avr-binutils" binutils-cross-avr))
> +
> +;;; C standard libraries:
> +
> +(define-public avr-libc
> + (cross-libc "avr"))

LGTM, with the Commentary section added as suggested before to warn this
module should *not* be imported elsewhere, for cyclic module
dependency reasons.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Oct 2023 08:11
Re: [bug#66263] [PATCH 19/23] gnu: Add gcc-cross-avr-toolchain.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
8734ypqf3l.fsf@gmail.com
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (23 lines)
> * gnu/packages/cross-toolchain.scm (gcc-cross-avr-toolchain): New
> variable.
> ---
> gnu/packages/cross-toolchain.scm | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/gnu/packages/cross-toolchain.scm b/gnu/packages/cross-toolchain.scm
> index 929e665e50..2ee039c7f6 100644
> --- a/gnu/packages/cross-toolchain.scm
> +++ b/gnu/packages/cross-toolchain.scm
> @@ -70,3 +70,11 @@ (define-deprecated/public avr-binutils binutils-cross-avr
>
> (define-public avr-libc
> (cross-libc "avr"))
> +
> +;;; Cross toolchains:
> +
> +(define-public gcc-cross-avr-toolchain
> + (make-cross-gcc-toolchain "avr"
> + #:libc avr-libc
> + #:xgcc (cross-gcc "avr" #:libc avr-libc)
> + #:xbinutils binutils-cross-avr))

Is this still necessary given the make-avr-toolchain procedure we have?
Perhaps it can use that? To be rebased on master.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Oct 2023 08:13
Re: [bug#66263] [PATCH 21/23] guix: meson-build-system: Support AVR.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87v8blp0fy.fsf@gmail.com
Hello,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (5 lines)
> * guix/build-system/meson.scm (make-machine-alist)
> <system> [target-avr?]: Set to none.
> <cpu_family> [target-avr?]: Set to avr.
> <cpu> [target-avr?]: Set to avr.

LGTM.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Oct 2023 08:14
Re: [bug#66263] [PATCH 22/23] guix: meson-build-system: Disable PIC for AVR.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87r0m9p0ea.fsf@gmail.com
Hello,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (6 lines)
> * guix/build-system/meson.scm (make-built-in-options-alist): New
> variable.
>
> * guix/build-system/meson.scm (make-cross-file): Add 'built-in options'
> section to cross file.

I'm no Meson expert, but that LGTM.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Oct 2023 08:19
Re: [bug#66263] [PATCH 23/23] gnu: Add unity.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87mswxp05q.fsf@gmail.com
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

Toggle quote (56 lines)
> * gnu/packages/check.scm (unity): New variable.
> ---
> gnu/packages/check.scm | 41 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 41 insertions(+)
>
> diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
> index 5af3b49280..db368663d4 100644
> --- a/gnu/packages/check.scm
> +++ b/gnu/packages/check.scm
> @@ -87,6 +87,7 @@ (define-module (gnu packages check)
> #:use-module (gnu packages python-web)
> #:use-module (gnu packages python-xyz)
> #:use-module (gnu packages python-science)
> + #:use-module (gnu packages ruby)
> #:use-module (gnu packages texinfo)
> #:use-module (gnu packages time)
> #:use-module (gnu packages xml)
> @@ -3170,6 +3171,46 @@ (define-public unittest-cpp
> portable to just about any platform.")
> (license license:expat)))
>
> +(define-public unity
> + (let ((revision "0")
> + (commit "2775e1b05875cf45afce7153e36af76ddbfdba26"))
> + (package
> + (name "unity")
> + (version (git-version "2.5.4" revision commit))
> + (source (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/ThrowTheSwitch/Unity")
> + (commit commit)))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32
> + "0y803ibjkqvj1fil0a0hzs7x0m98amm5ibwl8xxk3p8bj9wgdps1"))))
> + (build-system meson-build-system)
> + (arguments
> + (list #:configure-flags #~(list "-Dextension_fixture=true"
> + "-Dextension_memory=true"
> + "-Dsupport_double=true")
> + #:phases #~(modify-phases %standard-phases
> + (replace 'check
> + (lambda* (#:key tests? #:allow-other-keys)
> + (when tests?
> + (with-directory-excursion "../source/test"
> + (invoke "rake" "all"))))))))
> + (native-inputs
> + (append (list python)
> + (if (not (%current-target-system))
> + (list ruby
> + ruby-rake
> + ruby-rspec
> + ruby-rubocop)
> + '())))

I believe these are test-related inputs? Should the tests be disabled
when cross-compiling? Otherwise it'd probably fail, no?

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Oct 2023 08:19
control message for bug #66263
(address . control@debbugs.gnu.org)
87lechp05m.fsf@gmail.com
tags 66263 + moreinfo
quit
M
M
Maxim Cournoyer wrote on 5 Oct 2023 08:20
Re: bug#66263: [PATCH 00/23] guix: Add avr as a platform.
(name . Mathieu Othacehe)(address . othacehe@gnu.org)
87h6n5p03f.fsf@gmail.com
Hi,

Mathieu Othacehe <othacehe@gnu.org> writes:

Toggle quote (8 lines)
> Hello,
>
>> The [PATCH 21/23] fixes a bug in the meson-configuration module
>> and can be applied independently.
>
> I applied this one. Now the rest of the series also seems fine to me.
> Maxim, Efraim, Vagrant any thoughts?

I've reviewed the series, thanks for the ping. It seems it'll need to
be rebased on master as some of the changes conflict with turning the
previous avr-toolchain and friends into procedure that was merged
perhaps a week ago.

--
Thanks,
Maxim
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 01/22] gnu: cross-libc: Return #f if no libc available.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-1-jean@foundationdevices.com
* gnu/packages/cross-base.scm (cross-libc): Return #f if no libc is
available for the given TARGET.

Change-Id: I17d19716373dd5704bb70d805437738fd29bd96b
---
gnu/packages/cross-base.scm | 140 ++++++++++++++++++------------------
1 file changed, 72 insertions(+), 68 deletions(-)

Toggle diff (153 lines)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 14cb365099..4b7c4b6cbe 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -610,74 +610,78 @@ (define* (cross-libc* target
(xbinutils (cross-binutils target))
(xheaders (cross-kernel-headers target)))
"Return LIBC cross-built for TARGET, a GNU triplet. Use XGCC and XBINUTILS
-and the cross tool chain."
- (if (target-mingw? target)
- (let ((machine (substring target 0 (string-index target #\-))))
- (make-mingw-w64 machine
- #:xgcc xgcc
- #:xbinutils xbinutils))
- (package
- (inherit libc)
- (name (string-append "glibc-cross-" target))
- (arguments
- (substitute-keyword-arguments
- `( ;; Disable stripping (see above.)
- #:strip-binaries? #f
-
- ;; This package is used as a target input, but it should not have
- ;; the usual cross-compilation inputs since that would include
- ;; itself.
- #:implicit-cross-inputs? #f
-
- ;; We need SRFI 26.
- #:modules ((guix build gnu-build-system)
- (guix build utils)
- (srfi srfi-26))
-
- ,@(package-arguments libc))
- ((#:configure-flags flags)
- `(cons ,(string-append "--host=" target)
- ,(if (target-hurd? target)
- `(append (list "--disable-werror"
- ,@%glibc/hurd-configure-flags)
- ,flags)
- flags)))
- ((#:phases phases)
- `(modify-phases ,phases
- (add-before 'configure 'set-cross-kernel-headers-path
- (lambda* (#:key inputs #:allow-other-keys)
- (let* ((kernel (assoc-ref inputs "kernel-headers"))
- (cpath (string-append kernel "/include")))
- (for-each (cut setenv <> cpath)
- ',%gcc-cross-include-paths)
- (setenv "CROSS_LIBRARY_PATH"
- (string-append kernel "/lib")) ; for Hurd's libihash
- #t)))
- ,@(if (target-hurd? target)
- '((add-after 'install 'augment-libc.so
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out")))
- (substitute* (string-append out "/lib/libc.so")
- (("/[^ ]+/lib/libc.so.0.3")
- (string-append out "/lib/libc.so.0.3"
- " libmachuser.so libhurduser.so"))))
- #t)))
- '())))))
-
- ;; Shadow the native "kernel-headers" because glibc's recipe expects the
- ;; "kernel-headers" input to point to the right thing.
- (propagated-inputs `(("kernel-headers" ,xheaders)))
-
- (native-inputs `(("cross-gcc" ,xgcc)
- ("cross-binutils" ,xbinutils)
- ,@(if (target-hurd? target)
- `(("cross-mig"
- ,(cross-mig target
- #:xgcc xgcc
- #:xbinutils xbinutils)))
- '())
- ,@(package-inputs libc) ;FIXME: static-bash
- ,@(package-native-inputs libc))))))
+and the cross tool chain. If TARGET doesn't have a standard C library #f is
+returned."
+ (match target
+ ((? target-mingw?)
+ (let ((machine (substring target 0 (string-index target #\-))))
+ (make-mingw-w64 machine
+ #:xgcc xgcc
+ #:xbinutils xbinutils)))
+ ((or (? target-linux?) (? target-hurd?))
+ (package
+ (inherit libc)
+ (name (string-append "glibc-cross-" target))
+ (arguments
+ (substitute-keyword-arguments
+ `( ;; Disable stripping (see above.)
+ #:strip-binaries? #f
+
+ ;; This package is used as a target input, but it should not have
+ ;; the usual cross-compilation inputs since that would include
+ ;; itself.
+ #:implicit-cross-inputs? #f
+
+ ;; We need SRFI 26.
+ #:modules ((guix build gnu-build-system)
+ (guix build utils)
+ (srfi srfi-26))
+
+ ,@(package-arguments libc))
+ ((#:configure-flags flags)
+ `(cons ,(string-append "--host=" target)
+ ,(if (target-hurd? target)
+ `(append (list "--disable-werror"
+ ,@%glibc/hurd-configure-flags)
+ ,flags)
+ flags)))
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-before 'configure 'set-cross-kernel-headers-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let* ((kernel (assoc-ref inputs "kernel-headers"))
+ (cpath (string-append kernel "/include")))
+ (for-each (cut setenv <> cpath)
+ ',%gcc-cross-include-paths)
+ (setenv "CROSS_LIBRARY_PATH"
+ (string-append kernel "/lib")) ; for Hurd's libihash
+ #t)))
+ ,@(if (target-hurd? target)
+ '((add-after 'install 'augment-libc.so
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out")))
+ (substitute* (string-append out "/lib/libc.so")
+ (("/[^ ]+/lib/libc.so.0.3")
+ (string-append out "/lib/libc.so.0.3"
+ " libmachuser.so libhurduser.so"))))
+ #t)))
+ '())))))
+
+ ;; Shadow the native "kernel-headers" because glibc's recipe expects the
+ ;; "kernel-headers" input to point to the right thing.
+ (propagated-inputs `(("kernel-headers" ,xheaders)))
+
+ (native-inputs `(("cross-gcc" ,xgcc)
+ ("cross-binutils" ,xbinutils)
+ ,@(if (target-hurd? target)
+ `(("cross-mig"
+ ,(cross-mig target
+ #:xgcc xgcc
+ #:xbinutils xbinutils)))
+ '())
+ ,@(package-inputs libc) ;FIXME: static-bash
+ ,@(package-native-inputs libc)))))
+ (else #f)))
;;; Concrete cross tool chains are instantiated like this:
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 02/22] guix: gnu-build-system: Handle missing libc.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-2-jean@foundationdevices.com
* guix/build-system/gnu.scm (standard-cross-packages): Handle the case
when `cross-libc` returns #f.

Change-Id: I85ee5456f10ff141d521a5f2d91267cd612c5616
---
guix/build-system/gnu.scm | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Toggle diff (22 lines)
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index c1aa187c42..cdbb547773 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -460,10 +460,13 @@ (define standard-cross-packages
`(("cross-gcc" ,(gcc target
#:xbinutils (binutils target)
#:libc libc))
- ("cross-libc" ,libc)
+ ;; Some targets don't have a libc. (e.g. *-elf targets).
+ ,@(if libc
+ `(("cross-libc" ,libc))
+ '())
;; MinGW's libc doesn't have a "static" output.
- ,@(if (member "static" (package-outputs libc))
+ ,@(if (and libc (member "static" (package-outputs libc)))
`(("cross-libc:static" ,libc "static"))
'()))))))))
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 03/22] guix: Add avr platform.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-3-jean@foundationdevices.com
* Makefile.am (MODULES): Add avr platform module.
* doc/guix.texi: Add documentation for avr platform.
* guix/platforms/avr.scm (avr): New variable.

Change-Id: I0f425eac61a71390b618e093f5a034ad4205a6f4
---
Makefile.am | 1 +
doc/guix.texi | 7 +++++++
guix/platforms/avr.scm | 28 ++++++++++++++++++++++++++++
3 files changed, 36 insertions(+)
create mode 100644 guix/platforms/avr.scm

Toggle diff (80 lines)
diff --git a/Makefile.am b/Makefile.am
index cbc3191dfc..9784b19054 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -138,6 +138,7 @@ MODULES = \
guix/ipfs.scm \
guix/platform.scm \
guix/platforms/arm.scm \
+ guix/platforms/avr.scm \
guix/platforms/mips.scm \
guix/platforms/powerpc.scm \
guix/platforms/riscv.scm \
diff --git a/doc/guix.texi b/doc/guix.texi
index 1fd2e21608..1026e24ebe 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -119,6 +119,7 @@ Copyright @copyright{} 2023 Tanguy Le Carrour@*
Copyright @copyright{} 2023 Zheng Junjie@*
Copyright @copyright{} 2023 Brian Cully@*
Copyright @copyright{} 2023 Felix Lechner@*
+Copyright @copyright{} 2023 Foundation Devices, Inc.@*
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -16699,6 +16700,7 @@ The available targets are:
- aarch64-linux-gnu
- arm-linux-gnueabihf
+ - avr
- i586-pc-gnu
- i686-linux-gnu
- i686-w64-mingw32
@@ -45789,6 +45791,11 @@ Platform targeting x86 CPU running GNU/Hurd (also referred to as
``GNU'').
@end defvar
+@defvar avr
+Platform targeting AVR CPUs without an operating system, with run-time support
+from AVR Libc.
+@end defvar
+
@node System Images
@chapter Creating System Images
diff --git a/guix/platforms/avr.scm b/guix/platforms/avr.scm
new file mode 100644
index 0000000000..ba178db6ea
--- /dev/null
+++ b/guix/platforms/avr.scm
@@ -0,0 +1,28 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix platforms avr)
+ #:use-module (guix platform)
+ #:use-module (guix records)
+ #:export (avr))
+
+(define avr
+ (platform
+ (target "avr")
+ (system #f)
+ (glibc-dynamic-linker #f)))
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 04/22] guix: Add target-avr?.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-4-jean@foundationdevices.com
* guix/utils.scm (target-avr?): New procedure.
* tests/utils.scm: Add tests for target-avr? procedure.

Change-Id: Iaa0fa97a2b6bc45d45f907f43157f1548a0ba3fa
---
guix/utils.scm | 6 ++++++
tests/utils.scm | 12 ++++++++++++
2 files changed, 18 insertions(+)

Toggle diff (63 lines)
diff --git a/guix/utils.scm b/guix/utils.scm
index 7a42b49df2..8e71f97e1c 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -19,6 +19,7 @@
;;; Copyright © 2023 Philip McGrath <philip@philipmcgrath.com>
;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -99,6 +100,7 @@ (define-module (guix utils)
target-arm32?
target-aarch64?
target-arm?
+ target-avr?
target-ppc32?
target-ppc64le?
target-powerpc?
@@ -724,6 +726,10 @@ (define* (target-arm? #:optional (target (or (%current-target-system)
(%current-system))))
(or (target-arm32? target) (target-aarch64? target)))
+(define* (target-avr? #:optional (target (%current-target-system)))
+ "Is the architecture of TARGET a variant of Microchip's AVR architecture?"
+ (or (string=? target "avr") (string-prefix? "avr-" target)))
+
(define* (target-ppc32? #:optional (target (or (%current-target-system)
(%current-system))))
(string-prefix? "powerpc-" target))
diff --git a/tests/utils.scm b/tests/utils.scm
index 648e91f242..5664165c85 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -329,6 +330,17 @@ (define (test-compression/decompression method run?)
;; However, it isn't 32-bit.
,(format #f "x86_~a-linux-gnu" (expt 2 109)))))
+(test-equal "target-avr?"
+ '(#t #t #t #f #f)
+ (map target-avr?
+ '("avr" "avr-unknown-none"
+ ;; In addition LLVM also uses this form.
+ "avr-unknown-unknown"
+ ;; The AVR32 architecture also was made by Atmel/Microchip but it
+ ;; does not resemble the AVR family, they aren't compatible in any
+ ;; way.
+ "avr32" "avr32-unknown-none")))
+
(test-end)
(false-if-exception (delete-file temp-file))
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 05/22] gnu: microscheme: Move to avr-xyz.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-5-jean@foundationdevices.com
* gnu/packages/avr.scm (microscheme): Move to ...
* gnu/packages/avr-xyz.scm (microscheme): ... here.

Change-Id: I1272bfc98b583ab0ab36fcba5a8e19ae018b0b80
---
gnu/packages/avr-xyz.scm | 41 ++++++++++++++++++++++++++++++++++++++++
gnu/packages/avr.scm | 37 ------------------------------------
2 files changed, 41 insertions(+), 37 deletions(-)

Toggle diff (110 lines)
diff --git a/gnu/packages/avr-xyz.scm b/gnu/packages/avr-xyz.scm
index e0db2e3a0c..cc34189841 100644
--- a/gnu/packages/avr-xyz.scm
+++ b/gnu/packages/avr-xyz.scm
@@ -29,13 +29,17 @@ (define-module (gnu packages avr-xyz)
#:use-module (gnu packages autotools)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
+ #:use-module (gnu packages check)
+ #:use-module (gnu packages compression)
#:use-module (gnu packages avr)
#:use-module (gnu packages documentation)
#:use-module (gnu packages elf)
#:use-module (gnu packages gl)
#:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages llvm)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages version-control)
+ #:use-module (gnu packages vim)
#:use-module (gnu packages ruby))
(define-public simavr
@@ -178,3 +182,40 @@ (define-public lufa
compatible microcontroller models, as well as the demos and the
documentation.")
(license license:expat))) ;see LUFA/License.txt
+
+(define-public microscheme
+ (package
+ (name "microscheme")
+ (version "0.9.4")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/ryansuchocki/microscheme")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32 "1bflwirpcd58bngbs6hgjfwxl894ni2gpdd4pj10pm2mjhyj5dgw"))
+ (file-name (git-file-name name version))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:parallel-build? #f ; fails to build otherwise
+ #:tests? #f ; no tests
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure))
+ #:make-flags
+ (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
+ (native-inputs
+ (list clang cppcheck unzip xxd))
+ (home-page "https://github.com/ryansuchocki/microscheme/")
+ (synopsis "Scheme subset for Atmel microcontrollers")
+ (description
+ "Microscheme, or @code{(ms)} for short, is a functional programming
+language for the Arduino, and for Atmel 8-bit AVR microcontrollers in general.
+Microscheme is a subset of Scheme, in the sense that every valid @code{(ms)}
+program is also a valid Scheme program (with the exception of Arduino
+hardware-specific primitives). The @code{(ms)} compiler performs function
+inlining, and features an aggressive tree-shaker, eliminating unused top-level
+definitions. Microscheme has a robust @dfn{Foreign Function Interface} (FFI)
+meaning that C code may be invoked directly from (ms) programs.")
+ (license license:expat)))
diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index a66abbbd3a..111547ef87 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -175,40 +175,3 @@ (define* (make-avr-toolchain/implementation #:key (xgcc gcc))
(define make-avr-toolchain
(memoize make-avr-toolchain/implementation))
-
-(define-public microscheme
- (package
- (name "microscheme")
- (version "0.9.4")
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/ryansuchocki/microscheme")
- (commit (string-append "v" version))))
- (sha256
- (base32 "1bflwirpcd58bngbs6hgjfwxl894ni2gpdd4pj10pm2mjhyj5dgw"))
- (file-name (git-file-name name version))))
- (build-system gnu-build-system)
- (arguments
- `(#:parallel-build? #f ; fails to build otherwise
- #:tests? #f ; no tests
- #:phases
- (modify-phases %standard-phases
- (delete 'configure))
- #:make-flags
- (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
- (native-inputs
- (list clang cppcheck unzip xxd))
- (home-page "https://github.com/ryansuchocki/microscheme/")
- (synopsis "Scheme subset for Atmel microcontrollers")
- (description
- "Microscheme, or @code{(ms)} for short, is a functional programming
-language for the Arduino, and for Atmel 8-bit AVR microcontrollers in general.
-Microscheme is a subset of Scheme, in the sense that every valid @code{(ms)}
-program is also a valid Scheme program (with the exception of Arduino
-hardware-specific primitives). The @code{(ms)} compiler performs function
-inlining, and features an aggressive tree-shaker, eliminating unused top-level
-definitions. Microscheme has a robust @dfn{Foreign Function Interface} (FFI)
-meaning that C code may be invoked directly from (ms) programs.")
- (license license:expat)))
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 06/22] gnu: make-avr-libc: Fix synopsis.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-6-jean@foundationdevices.com
* gnu/packages/avr.scm (make-avr-libc/implementation): Drop 'The' from
synopsis.

Change-Id: Idb6c008d709a988075789a6220af63f4917c2179
---
gnu/packages/avr.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index 111547ef87..c035df2b1d 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -137,7 +137,7 @@ (define* (make-avr-libc/implementation #:key (xgcc gcc))
(native-inputs `(("avr-binutils" ,(make-avr-binutils))
("avr-gcc" ,(make-avr-gcc #:xgcc xgcc))))
(home-page "https://www.nongnu.org/avr-libc/")
- (synopsis "The AVR C Library")
+ (synopsis "AVR C Library")
(description
"AVR Libc is a project whose goal is to provide a high quality C library
for use with GCC on Atmel AVR microcontrollers.")
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 07/22] gnu: cross-gcc: Enable multilib for AVR.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-7-jean@foundationdevices.com
* gnu/build/cross-toolchain.scm (patch-multilib-shebang): New procedure.
* gnu/packages/avr.scm (make-avr-gcc): Remove uneeded phases and flags
for multilib.
* gnu/packages/cross-base (cross-gcc-arguments) <#:configure-flags>
[target-avr?]: Remove --disable-multilib and add --enable-multilib.

Change-Id: Id68d803057ac898f0a670f10487b08bf0891ab0b
---
gnu/build/cross-toolchain.scm | 10 ++++++++++
gnu/packages/avr.scm | 13 +------------
gnu/packages/cross-base.scm | 16 ++++++++++++----
3 files changed, 23 insertions(+), 16 deletions(-)

Toggle diff (90 lines)
diff --git a/gnu/build/cross-toolchain.scm b/gnu/build/cross-toolchain.scm
index 9746be3e50..085b88a2c3 100644
--- a/gnu/build/cross-toolchain.scm
+++ b/gnu/build/cross-toolchain.scm
@@ -48,6 +48,14 @@ (define %gcc-cross-include-paths
;; Search path for target headers when cross-compiling.
(map (cut string-append "CROSS_" <>) %gcc-include-paths))
+(define* (patch-genmultilib-shebang #:key inputs native-inputs #:allow-other-keys)
+ "Patch shebangs in the gcc/genmultilib file as it contains several scripts
+inside, each with a #!/bin/sh that needs patching."
+ (substitute* "gcc/genmultilib"
+ (("#!/bin/sh")
+ (string-append "#!" (assoc-ref (or native-inputs inputs) "bash")
+ "/bin/bash"))))
+
(define* (make-cross-binutils-visible #:key outputs inputs target
#:allow-other-keys)
"Create symlinks for 'as', 'nm', and 'ld' in the \"out\" output, under
@@ -173,6 +181,8 @@ (define* (cross-gcc-build-phases target
"Modify PHASES to include everything needed to build a cross-GCC for TARGET,
a target triplet."
(modify-phases phases
+ (add-after 'unpack 'patch-genmultilib-shebang
+ patch-genmultilib-shebang)
(add-before 'configure 'set-cross-path
;; This mingw32 target checking logic should match that of target-mingw?
;; in (guix utils), but (guix utils) is too large too copy over to the
diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index c035df2b1d..ac09b799f3 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -84,18 +84,7 @@ (define* (make-avr-gcc/implementation #:key (xgcc gcc))
(format #t
"environment variable `CPLUS_INCLUDE_PATH' \
changed to ~a~%"
- (getenv "CPLUS_INCLUDE_PATH")))))
- ;; Without a working multilib build, the resulting GCC lacks
- ;; support for nearly every AVR chip.
- (add-after 'unpack 'fix-genmultilib
- (lambda _
- ;; patch-shebang doesn't work here because there are
- ;; actually several scripts inside this script, each with
- ;; a #!/bin/sh that needs patching.
- (substitute* "gcc/genmultilib"
- (("#!/bin/sh") (string-append "#!" (which "sh"))))))))
- ((#:configure-flags flags)
- #~(delete "--disable-multilib" #$flags))))
+ (getenv "CPLUS_INCLUDE_PATH")))))))))
(native-search-paths
(list (search-path-specification
(variable "CROSS_C_INCLUDE_PATH")
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 4b7c4b6cbe..dcb1c3efa8 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -9,6 +9,7 @@
;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2023 Josselin Poiret <dev@jpoiret.xyz>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -196,12 +197,19 @@ (define (cross-gcc-arguments target xgcc libc)
#~((string-append "--with-toolexeclibdir="
(assoc-ref %outputs "lib")
"/" #$target "/lib"))
+ #~())
+
+ #$@(if (target-avr? target)
+ #~("--enable-multilib")
#~()))
- #$(if libc
- flags
- #~(remove (cut string-match "--enable-languages.*" <>)
- #$flags))))
+ (remove
+ (lambda (flag)
+ (or (and #$libc
+ (string-prefix? "--enable-languages" flag))
+ (and #$(target-avr? target)
+ (string=? flag "--disable-multilib"))))
+ #$flags)))
((#:make-flags flags)
(if libc
#~(let ((libc (assoc-ref %build-inputs "libc")))
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 08/22] gnu: cross-gcc: Handle target include paths.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-8-jean@foundationdevices.com
* gnu/packages/cross-base.scm (cross-gcc-search-paths): New procedure.
* gnu/packages/cross-base.scm (cross-gcc) <search-paths>: Convert to and use
cross-gcc-search-paths procedure.

Change-Id: Id306782eaf928d05cd005b9539087ed631506b5b
---
gnu/packages/cross-base.scm | 42 +++++++++++++++++++++++--------------
1 file changed, 26 insertions(+), 16 deletions(-)

Toggle diff (62 lines)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index dcb1c3efa8..fe33770c2a 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -249,6 +249,31 @@ (define (cross-gcc-snippet target)
"-DTOOLDIR_BASE_PREFIX=\\\"../../../../\\\""))
#t))
+(define (cross-gcc-search-paths target)
+ "Return list of GCC search path specifications needed for TARGET."
+ (cons (search-path-specification
+ (variable "CROSS_LIBRARY_PATH")
+ (files `("lib" "lib64"
+ ,@(list (string-append target "/lib")
+ (string-append target "/lib64")))))
+
+ (map (lambda (variable)
+ (search-path-specification
+ (variable variable)
+
+ ;; Add 'include/c++' here so that <cstdlib>'s
+ ;; "#include_next <stdlib.h>" finds GCC's
+ ;; <stdlib.h>, not libc's.
+ (files (match variable
+ ("CROSS_CPLUS_INCLUDE_PATH"
+ `("include/c++" "include"
+ ,@(list (string-append target "/include/c++")
+ (string-append target "/include"))))
+ (_
+ `("include"
+ ,(string-append target "/include")))))))
+ %gcc-cross-include-paths)))
+
(define* (cross-gcc target
#:key
(xgcc %xgcc)
@@ -341,22 +366,7 @@ (define* (cross-gcc target
(inputs '())
;; Only search target inputs, not host inputs.
- (search-paths (cons (search-path-specification
- (variable "CROSS_LIBRARY_PATH")
- (files '("lib" "lib64")))
- (map (lambda (variable)
- (search-path-specification
- (variable variable)
-
- ;; Add 'include/c++' here so that <cstdlib>'s
- ;; "#include_next <stdlib.h>" finds GCC's
- ;; <stdlib.h>, not libc's.
- (files (match variable
- ("CROSS_CPLUS_INCLUDE_PATH"
- '("include/c++" "include"))
- (_
- '("include"))))))
- %gcc-cross-include-paths)))
+ (search-paths (cross-gcc-search-paths target))
(native-search-paths '())))
(define* (cross-kernel-headers . args)
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 09/22] gnu: cross-libc: Add AVR Libc support.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-9-jean@foundationdevices.com
* gnu/packages/avr.scm (make-avr-libc/implementation)
<arguments>: Add avr target parameter and disable implicit cross inputs.
<native-inputs>: Rename avr-gcc and avr-binutils to cross-gcc
and cross-binutils to keep consistency with gnu-build-system.
* gnu/packages/cross-base.scm (cross-libc) [target-avr?]: Return AVR
Libc package from `make-avr-libc`.

Change-Id: I6b087946d1287a82fac61c48c513e7f2d2184794
---
gnu/packages/avr.scm | 21 ++++++++++++++-------
gnu/packages/cross-base.scm | 4 ++++
2 files changed, 18 insertions(+), 7 deletions(-)

Toggle diff (77 lines)
diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index ac09b799f3..fc87e4ea13 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -40,7 +40,8 @@ (define-module (gnu packages avr)
#:use-module (gnu packages gcc)
#:use-module (gnu packages llvm)
#:use-module (gnu packages vim)
- #:export (make-avr-toolchain))
+ #:export (make-avr-libc
+ make-avr-toolchain))
;;; Commentary:
;;;
@@ -108,7 +109,10 @@ (define* (make-avr-gcc/implementation #:key (xgcc gcc))
(define make-avr-gcc
(memoize make-avr-gcc/implementation))
-(define* (make-avr-libc/implementation #:key (xgcc gcc))
+(define* (make-avr-libc/implementation #:key
+ (xbinutils (cross-binutils "avr"))
+ (xgcc (cross-gcc "avr"
+ #:xbinutils xbinutils)))
(package
(name "avr-libc")
(version "2.0.0")
@@ -121,10 +125,13 @@ (define* (make-avr-libc/implementation #:key (xgcc gcc))
"15svr2fx8j6prql2il2fc0ppwlv50rpmyckaxx38d3gxxv97zpdj"))))
(build-system gnu-build-system)
(arguments
- '(#:out-of-source? #t
- #:configure-flags '("--host=avr")))
- (native-inputs `(("avr-binutils" ,(make-avr-binutils))
- ("avr-gcc" ,(make-avr-gcc #:xgcc xgcc))))
+ '(#:target "avr"
+ #:out-of-source? #t
+ ;; Avoid including itself as this package is a target input and cannot
+ ;; use the normal cross compilation inputs.
+ #:implicit-cross-inputs? #f))
+ (native-inputs `(("cross-binutils" ,xbinutils)
+ ("cross-gcc" ,xgcc)))
(home-page "https://www.nongnu.org/avr-libc/")
(synopsis "AVR C Library")
(description
@@ -138,7 +145,7 @@ (define make-avr-libc
(define* (make-avr-toolchain/implementation #:key (xgcc gcc))
(let ((avr-binutils (make-avr-binutils))
- (avr-libc (make-avr-libc #:xgcc xgcc))
+ (avr-libc (make-avr-libc #:xgcc (cross-gcc "avr" #:xgcc xgcc)))
(avr-gcc (make-avr-gcc #:xgcc xgcc)))
;; avr-libc checks the compiler version and passes "--enable-device-lib"
;; for avr-gcc > 5.1.0. It wouldn't install the library for atmega32u4
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index fe33770c2a..d4a0de6f90 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -28,6 +28,7 @@
(define-module (gnu packages cross-base)
#:use-module (gnu packages)
+ #:use-module (gnu packages avr)
#:use-module (gnu packages gcc)
#:use-module (gnu packages base)
#:use-module (gnu packages linux)
@@ -699,6 +700,9 @@ (define* (cross-libc* target
'())
,@(package-inputs libc) ;FIXME: static-bash
,@(package-native-inputs libc)))))
+ ((? target-avr?)
+ (make-avr-libc #:xbinutils xbinutils
+ #:xgcc xgcc))
(else #f)))
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 11/22] gnu: cross-toolchain: Add set-cross-path for AVR.
(address . 66263@debbugs.gnu.org)
20231128113510.11214-11-jean@foundationdevices.com
* gnu/build/cross-toolchain.scm (set-cross-path/avr): New procedure.
* gnu/build/cross-toolchain.scm (cross-gcc-build-phases)
[string-prefix? "avr"]: Return set-cross-path/avr procedure.

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
Change-Id: I00bd39236ac2e31fef02164a7fffc8b56a166f0d
---
gnu/build/cross-toolchain.scm | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)

Toggle diff (53 lines)
diff --git a/gnu/build/cross-toolchain.scm b/gnu/build/cross-toolchain.scm
index 085b88a2c3..6f5e3b0f57 100644
--- a/gnu/build/cross-toolchain.scm
+++ b/gnu/build/cross-toolchain.scm
@@ -170,6 +170,31 @@ (define (unpacked-mingw-dir)
(cons "LIBRARY_PATH" %gcc-include-paths))
#t))
+(define* (set-cross-path/avr #:key inputs #:allow-other-keys)
+ (match (assoc-ref inputs "libc")
+ ((? string? libc)
+ (define (cross? x)
+ ;; Return #t if X is a cross-libc.
+ (string-prefix? libc x))
+
+ (let ((cpath (string-append libc "/avr/include")))
+ (for-each (cut setenv <> cpath)
+ %gcc-cross-include-paths))
+
+ (setenv "CROSS_LIBRARY_PATH"
+ (string-append libc "/avr/lib"))
+
+ (for-each (lambda (var)
+ (and=> (getenv var)
+ (lambda (value)
+ (let* ((path (search-path-as-string->list value))
+ (native-path (list->search-path-as-string
+ (remove cross? path) ":")))
+ (setenv var native-path)))))
+ (cons "LIBRARY_PATH" %gcc-include-paths)))
+ ;; AVR sans-libc cross-compiler.
+ (else #t)))
+
(define (install-strip . _)
"Install a stripped GCC."
;; Unlike our 'strip' phase, this will do the right thing for
@@ -188,9 +213,11 @@ (define* (cross-gcc-build-phases target
;; in (guix utils), but (guix utils) is too large too copy over to the
;; build side entirely and for now we have no way to select variables to
;; copy over. See (gnu packages cross-base) for more details.
- (if (string-suffix? "-mingw32" target)
- (cut set-cross-path/mingw #:target target <...>)
- set-cross-path))
+ (cond
+ ((string-suffix? "-mingw32" target)
+ (cut set-cross-path/mingw #:target target <...>))
+ ((string-prefix? "avr" target) set-cross-path/avr)
+ (#t set-cross-path)))
(add-after 'install 'make-cross-binutils-visible
(cut make-cross-binutils-visible #:target target <...>))
(replace 'install install-strip)))
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 10/22] gnu: cross-gcc: Handle AVR inputs.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-10-jean@foundationdevices.com
* gnu/packages/cross-base.scm (cross-gcc) <native-inputs> [target-avr?]:
Add case to handle AVR.

Change-Id: I1ac38b721ed807302747cecb5fb1f6075694a01a
---
gnu/packages/cross-base.scm | 3 +++
1 file changed, 3 insertions(+)

Toggle diff (16 lines)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index d4a0de6f90..5f87eec56b 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -355,6 +355,9 @@ (define* (cross-gcc target
("libc" ,libc))
`(,@inputs
("mingw-source" ,(package-source mingw-w64)))))
+ ((and libc (target-avr? target))
+ `(,@inputs
+ ("libc" ,libc)))
(libc
`(,@inputs
("libc" ,libc)
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 13/22] gnu: cross-gcc: Only C and C++ for AVR.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-13-jean@foundationdevices.com
* gnu/packages/cross-base.scm (cross-gcc-arguments)
<configure-flags> [target-avr?]: Add --enable-languages=c,c++.

Change-Id: I1d63bb1b0a3074b9ff8650c5afb93777183c0ea4
---
gnu/packages/cross-base.scm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

Toggle diff (26 lines)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 58c37e43c1..72f786dc35 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -200,13 +200,18 @@ (define (cross-gcc-arguments target xgcc libc)
"/" #$target "/lib"))
#~())
+
#$@(if (target-avr? target)
#~("--enable-multilib")
#~())
#$@(if (and libc (target-avr? target))
- #~((string-append "--with-native-system-header-dir="
+ #~(;; By default GCC will attemp to compile
+ ;; some libraries for other languages (objc,
+ ;; fortran) but compilation fails for AVR.
+ "--enable-languages=c,c++"
+ (string-append "--with-native-system-header-dir="
#$libc "/" #$target "/include"))
#~()))
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 14/22] guix: meson-build-system: Support AVR.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-14-jean@foundationdevices.com
* guix/build-system/meson.scm (make-machine-alist)
<system> [target-avr?]: Set to none.
<cpu_family> [target-avr?]: Set to avr.
<cpu> [target-avr?]: Set to avr.

Change-Id: Ie47d666099c4c48edd36812f035625dccc4a3900
---
guix/build-system/meson.scm | 3 +++
1 file changed, 3 insertions(+)

Toggle diff (28 lines)
diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm
index 2d14016b94..ce3362db31 100644
--- a/guix/build-system/meson.scm
+++ b/guix/build-system/meson.scm
@@ -49,11 +49,13 @@ (define (make-machine-alist triplet)
`((system . ,(cond ((target-hurd? triplet) "gnu")
((target-linux? triplet) "linux")
((target-mingw? triplet) "windows")
+ ((target-avr? triplet) "none")
(#t (error "meson: unknown operating system"))))
(cpu_family . ,(cond ((target-x86-32? triplet) "x86")
((target-x86-64? triplet) "x86_64")
((target-arm32? triplet) "arm")
((target-aarch64? triplet) "aarch64")
+ ((target-avrch64? triplet) "avr")
((target-mips64el? triplet) "mips64")
((target-powerpc? triplet)
(if (target-64bit? triplet)
@@ -66,6 +68,7 @@ (define (make-machine-alist triplet)
((target-x86-64? triplet) "x86_64")
((target-aarch64? triplet) "armv8-a")
((target-arm32? triplet) "armv7")
+ ((target-avr? triplet) "avr")
;; According to #mesonbuild on OFTC, there does not appear
;; to be an official-ish list of CPU types recognised by
;; Meson, the "cpu" field is not used by Meson itself and
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 15/22] guix: meson-build-system: Disable PIC for AVR.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-15-jean@foundationdevices.com
* guix/build-system/meson.scm (make-built-in-options-alist): New procedure.
* guix/build-system/meson.scm (make-cross-file): Add 'built-in options'
section to cross file.

Change-Id: Ifff7f6fb1eb8b0e8ddd04881d22acb863c9e85b2
---
guix/build-system/meson.scm | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

Toggle diff (31 lines)
diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm
index ce3362db31..c30c2000b4 100644
--- a/guix/build-system/meson.scm
+++ b/guix/build-system/meson.scm
@@ -92,6 +92,13 @@ (define (make-binaries-alist triplet)
(ld . ,(string-append triplet "-ld"))
(strip . ,(string-append triplet "-strip"))))
+(define (make-built-in-options-alist triplet)
+ (if (target-avr? triplet)
+ `((b_pie . #f)
+ (b_staticpic . #f)
+ (default_library . "static"))
+ '()))
+
(define (make-cross-file triplet)
(computed-file "cross-file"
(with-imported-modules '((guix build meson-configuration))
@@ -102,7 +109,9 @@ (define (make-cross-file triplet)
(write-section-header port "host_machine")
(write-assignments port '#$(make-machine-alist triplet))
(write-section-header port "binaries")
- (write-assignments port '#$(make-binaries-alist triplet))))))))
+ (write-assignments port '#$(make-binaries-alist triplet))
+ (write-section-header port "built-in options")
+ (write-assignments port '#$(make-built-in-options-alist triplet))))))))
(define %meson-build-system-modules
;; Build-side modules imported by default.
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 16/22] gnu: Add cross-gcc-toolchain procedure.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-16-jean@foundationdevices.com
* gnu/packages/cross-base.scm (cross-gcc-toolchain/implementation): New procedure.
* gnu/packages/cross-base.scm (cross-gcc-toolchain): New procedure.

Change-Id: I994067eac094d0a50a7399e61bda944eded9187f
---
gnu/packages/cross-base.scm | 51 ++++++++++++++++++++++++++++++++++++-
1 file changed, 50 insertions(+), 1 deletion(-)

Toggle diff (85 lines)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 72f786dc35..0a8a0bb95c 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -34,6 +34,7 @@ (define-module (gnu packages cross-base)
#:use-module (gnu packages linux)
#:use-module (gnu packages hurd)
#:use-module (gnu packages mingw)
+ #:use-module (guix memoization)
#:use-module (guix platform)
#:use-module (guix packages)
#:use-module (guix diagnostics)
@@ -41,6 +42,7 @@ (define-module (gnu packages cross-base)
#:use-module (guix i18n)
#:use-module (guix utils)
#:use-module (guix build-system gnu)
+ #:use-module (guix build-system trivial)
#:use-module (guix gexp)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
@@ -50,7 +52,8 @@ (define-module (gnu packages cross-base)
cross-libc
cross-gcc
cross-mig
- cross-kernel-headers))
+ cross-kernel-headers
+ cross-gcc-toolchain))
(define-syntax %xgcc
;; GCC package used as the basis for cross-compilation. It doesn't have to
@@ -727,6 +730,52 @@ (define* (cross-libc* target
#:xgcc xgcc))
(else #f)))
+(define* (cross-gcc-toolchain/implementation target
+ #:key
+ (base-gcc %xgcc)
+ (xbinutils (cross-binutils target))
+ (libc (cross-libc
+ target
+ #:xgcc (cross-gcc target #:xgcc base-gcc)
+ #:xbinutils xbinutils))
+ (xgcc (cross-gcc target
+ #:xgcc base-gcc
+ #:libc libc
+ #:xbinutils xbinutils)))
+ "Returns PACKAGE that contains a cross-compilation tool chain for TARGET
+with XBINUTILS, XGCC and LIBC (if exists for TARGET)."
+ (package
+ (name (string-append (package-name xgcc) "-toolchain"))
+ (version (package-version xgcc))
+ (source #f)
+ (build-system trivial-build-system)
+ (arguments
+ (list #:modules '((guix build union))
+ #:builder
+ #~(begin
+ (use-modules (ice-9 match)
+ (guix build union))
+
+ (match %build-inputs
+ (((names . directory) ...)
+ (union-build #$output directory))))))
+ (inputs `(,xbinutils ,xgcc ,@(if libc (list libc) '())))
+ (home-page (package-home-page xgcc))
+ (synopsis
+ (format #f "Complete GCC tool chain for C/C++ development (~a)" target))
+ (description "This package provides a complete GCC cross toolchain for
+C/C++ development to be installed in user profiles. This includes GCC, as
+well as libc (headers and binariesl), and Binutils. GCC is the GNU Compiler
+Collection.")
+ (license (delete-duplicates `(,(package-license xgcc)
+ ,(package-license xbinutils)
+ ,@(if libc
+ (list (package-license libc))
+ '()))))))
+
+(define cross-gcc-toolchain
+ (memoize cross-gcc-toolchain/implementation))
+
;;; Concrete cross tool chains are instantiated like this:
;;
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:34
[PATCH v1 12/22] gnu: cross-gcc: Find AVR Libc files.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-12-jean@foundationdevices.com
* gnu/packages/cross-base.scm (cross-gcc-arguments)
<configure-flags>: Add --with-native-system-header-dir for AVR.
<make-flags>: Add target prefix to /lib to find AVR library.

Change-Id: Ie9cae338da241fe987f53463aa3774a890e2af9a
---
gnu/packages/cross-base.scm | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)

Toggle diff (44 lines)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 5f87eec56b..58c37e43c1 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -202,21 +202,35 @@ (define (cross-gcc-arguments target xgcc libc)
#$@(if (target-avr? target)
#~("--enable-multilib")
+ #~())
+
+
+ #$@(if (and libc (target-avr? target))
+ #~((string-append "--with-native-system-header-dir="
+ #$libc "/" #$target "/include"))
#~()))
(remove
(lambda (flag)
(or (and #$libc
(string-prefix? "--enable-languages" flag))
+ (and #$libc
+ #$(target-avr? target)
+ (string-prefix? "--with-native-system-header-dir"
+ flag))
(and #$(target-avr? target)
(string=? flag "--disable-multilib"))))
#$flags)))
((#:make-flags flags)
(if libc
- #~(let ((libc (assoc-ref %build-inputs "libc")))
+ #~(let ((libc (assoc-ref %build-inputs "libc"))
+ (lib-prefix (if #$(target-avr? target)
+ (string-append "/" #$target)
+ "")))
;; FLAGS_FOR_TARGET are needed for the target libraries to receive
;; the -Bxxx for the startfiles.
- (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib")
+ (cons (string-append "FLAGS_FOR_TARGET=-B"
+ libc lib-prefix "/lib")
#$flags))
flags))
((#:phases phases)
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:35
[PATCH v1 17/22] gnu: Add gcc-cross-avr-toolchain.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-17-jean@foundationdevices.com
* gnu/local.mk (GNU_SYSTEM_MODULES): Add cross-toolchain.scm.
* gnu/packages/cross-toolchain.scm (gcc-cross-avr-toolchain): New variable.

Change-Id: Ie768d5cc0663dd57753af1d4ac631b3cafbf9e8c
---
gnu/local.mk | 1 +
gnu/packages/cross-toolchain.scm | 36 ++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+)
create mode 100644 gnu/packages/cross-toolchain.scm

Toggle diff (56 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index a8142bb0f2..1360548e69 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -201,6 +201,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/crates-graphics.scm \
%D%/packages/crates-gtk.scm \
%D%/packages/cross-base.scm \
+ %D%/packages/cross-toolchain.scm \
%D%/packages/crypto.scm \
%D%/packages/cryptsetup.scm \
%D%/packages/cups.scm \
diff --git a/gnu/packages/cross-toolchain.scm b/gnu/packages/cross-toolchain.scm
new file mode 100644
index 0000000000..08511a7c00
--- /dev/null
+++ b/gnu/packages/cross-toolchain.scm
@@ -0,0 +1,36 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages cross-toolchain)
+ #:use-module (gnu packages cross-base)
+ #:use-module (guix packages))
+
+;;; Commentary:
+;;;
+;;; This module provides packages for cross compilation toolchains. These
+;;; packages must not be used at the top level to avoid cyclic module
+;;; dependencies caused by the (gnu packages cross-base) module referring to
+;;; to top level bindings from (gnu packages gcc).
+;;;
+;;; The real purpose of these packages is for installation on profiles by users
+;;; and other packages should make use of the toolchain through the usual cross
+;;; compilation methods. For example, by using the `#:target' argument on
+;;; packages or `--target' on the command line.
+
+(define-public gcc-cross-avr-toolchain
+ (cross-gcc-toolchain "avr"))
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:35
[PATCH v1 18/22] gnu: make-ergodox-firmware: Use AVR target.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-18-jean@foundationdevices.com
* gnu/packages/firmware.scm (make-ergodox-firmware/implementation):
Use `#:target "avr"` keyword argument instead of using `make-avr-toolchain`.

Change-Id: I4345a55d5dbd436d524de4886969b3332c6288a9
---
gnu/packages/firmware.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Toggle diff (23 lines)
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 294bbea184..58253b93a7 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1256,6 +1256,7 @@ (define* (make-ergodox-firmware/implementation layout #:key override.c
(arguments
(list
#:tests? #f ;no test suite
+ #:target "avr"
#:make-flags
#~(list (string-append "LAYOUT=" #$layout)
;; Simplify the output directory name.
@@ -1281,7 +1282,7 @@ (define* (make-ergodox-firmware/implementation layout #:key override.c
(install-file "firmware.hex" #$output)
(install-file "firmware.eep" #$output)
(install-file "firmware--layout.html" #$output)))))))
- (native-inputs (list (make-avr-toolchain) python))
+ (native-inputs (list python))
(home-page "https://www.ergodox.io")
(synopsis "Firmware for the ErgoDox keyboard")
(description (format #f "This package contains the original firmware for
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:35
[PATCH v1 19/22] gnu: make-qmk-firmware: Use AVR target.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-19-jean@foundationdevices.com
* gnu/packages/firmware.scm (qmk) <inputs>: Remove AVR toolchain.
* gnu/packages/firmware.scm (make-qmk-firmware/implementation):
Use `#:target "avr"` keyword argument as qmk does not provide the
toolchain.

Change-Id: Ibe09f6ef3c555052faf2c5c243303d85675866be
---
gnu/packages/firmware.scm | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

Toggle diff (44 lines)
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 58253b93a7..06abfcec71 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1344,9 +1344,7 @@ (define-public qmk
`("PATH" prefix
,(map (compose dirname
(cut search-input-file inputs <>))
- '("bin/avr-ar"
- "bin/avr-gcc"
- "bin/avrdude"
+ '("bin/avrdude"
"bin/awk"
"bin/cmp"
"bin/dfu-programmer"
@@ -1359,16 +1357,13 @@ (define-public qmk
;; TODO: Remove after git is wrapped with these.
"bin/basename"
"bin/sed"
- "bin/uname")))
- `("CROSS_C_INCLUDE_PATH" = (,(getenv "CROSS_C_INCLUDE_PATH")))
- `("CROSS_LIBRARY_PATH" = (,(getenv "CROSS_LIBRARY_PATH")))))))))
+ "bin/uname")))))))))
;; The inputs are not propagated since qmk is to be used strictly as a
;; command.
(inputs
;; The 'qmk setup' command advises to use GCC at version 8, and there are
;; compilation errors in some firmware otherwise.
- (list (make-avr-toolchain #:xgcc gcc-8)
- avrdude
+ (list avrdude
bash-minimal
dfu-programmer
dfu-util
@@ -1441,6 +1436,7 @@ (define* (make-qmk-firmware/implementation keyboard keymap
(ice-9 ftw)
(ice-9 match)
(srfi srfi-26))
+ #:target "avr"
;; XXX: Running a test target like "test:$keyboard" doesn't seem to run
;; anything and causes the .hex file to be regenerated; leave the tests
;; out for now.
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:35
[PATCH v1 20/22] gnu: lufa: Use AVR target.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-20-jean@foundationdevices.com
* gnu/packages/avr-xyz.scm (lufa): Remove AVR toolchain from inputs and
use `#:target "avr"` keyword argument instead.

Change-Id: I792132a9211b1aa64283f9b4e76a4dd57e86646d
---
gnu/packages/avr-xyz.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Toggle diff (23 lines)
diff --git a/gnu/packages/avr-xyz.scm b/gnu/packages/avr-xyz.scm
index cc34189841..b14a0e7dfe 100644
--- a/gnu/packages/avr-xyz.scm
+++ b/gnu/packages/avr-xyz.scm
@@ -122,6 +122,7 @@ (define-public lufa
;; only built).
(list
#:tests? #f
+ #:target "avr"
#:modules '((guix build gnu-build-system)
(guix build utils)
(ice-9 match)
@@ -172,7 +173,7 @@ (define-public lufa
(mkdir-p dest)
(copy-recursively html dest)))
html-dirs)))))))
- (native-inputs (list doxygen (make-avr-toolchain)))
+ (native-inputs (list doxygen))
(home-page "https://www.lufa-lib.org/")
(synopsis "Lightweight USB Framework for AVRs")
(description "UFA is a simple to use, lightweight framework which sits
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:35
[PATCH v1 21/22] gnu: Add gcc-cross-i686-w64-mingw32-toolchain.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-21-jean@foundationdevices.com
* gnu/packages/cross-toolchain.scm (gcc-cross-i686-w64-mingw32-toolchain): New variable.

Change-Id: I5d6056fc4943acae03aeaafa587f40ced182b1d4
---
gnu/packages/cross-toolchain.scm | 3 +++
1 file changed, 3 insertions(+)

Toggle diff (13 lines)
diff --git a/gnu/packages/cross-toolchain.scm b/gnu/packages/cross-toolchain.scm
index 08511a7c00..4c212bdce5 100644
--- a/gnu/packages/cross-toolchain.scm
+++ b/gnu/packages/cross-toolchain.scm
@@ -34,3 +34,6 @@ (define-module (gnu packages cross-toolchain)
(define-public gcc-cross-avr-toolchain
(cross-gcc-toolchain "avr"))
+
+(define-public gcc-cross-i686-w64-mingw32-toolchain
+ (cross-gcc-toolchain "i686-w64-mingw32"))
--
2.41.0
J
J
Jean-Pierre De Jesus DIAZ wrote on 28 Nov 2023 03:35
[PATCH v1 22/22] gnu: Add gcc-cross-x86_64-w64-mingw32-toolchain.
(address . 66263@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20231128113510.11214-22-jean@foundationdevices.com
* gnu/packages/cross-toolchain.scm (gcc-cross-x86_64-w64-mingw32-toolchain): New variable.

Change-Id: I94802e5e7cb218d7afb0ee09871125bae5db933c
---
gnu/packages/cross-toolchain.scm | 3 +++
1 file changed, 3 insertions(+)

Toggle diff (13 lines)
diff --git a/gnu/packages/cross-toolchain.scm b/gnu/packages/cross-toolchain.scm
index 4c212bdce5..ab071e1005 100644
--- a/gnu/packages/cross-toolchain.scm
+++ b/gnu/packages/cross-toolchain.scm
@@ -37,3 +37,6 @@ (define-public gcc-cross-avr-toolchain
(define-public gcc-cross-i686-w64-mingw32-toolchain
(cross-gcc-toolchain "i686-w64-mingw32"))
+
+(define-public gcc-cross-x86_64-w64-mingw32-toolchain
+ (cross-gcc-toolchain "x86_64-w64-mingw32"))
--
2.41.0
J
J
Jean-Pierre De Jesus Diaz wrote on 28 Nov 2023 03:50
Updated patch series.
(address . 66263@debbugs.gnu.org)
CAG1gdUpHpxSarXp2xHKzCujHa9GhPnf4rW+C6y-df06sHJnxWA@mail.gmail.com
Hello,

I've sent an updated revision of the changes, now adding
the MinGW toolchain targets and also changing the Ergodox
and QMK firmwares to use #:target "avr" for cross-compilation,
so it removes make-avr-toolchain from `qmk` inputs as packages
should use #:target "avr" or in user profiles cases they can install
the toolchain from the packages in cross-toolchain.scm.

The QMK package warns about the firmware not compiling with
GCC 8+ but it seems to be working right now with the default
GCC used in Guix, so maybe it'd be to tie the package to the
default GCC version as IIRC there's no way to pass a custom base
GCC version when using #:target means of cross compilation.

I've also moved the toolchain procedure to cross-base.scm and
memoized it.

--
Jean-Pierre De Jesus DIAZ
Foundation Devices
L
L
Ludovic Courtès wrote on 6 Dec 2023 13:57
Re: [bug#66263] [PATCH 00/23] guix: Add avr as a platform.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
87y1e7f0zb.fsf@gnu.org
Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

Toggle quote (15 lines)
> Mathieu Othacehe <othacehe@gnu.org> writes:
>
>> Hello,
>>
>>> The [PATCH 21/23] fixes a bug in the meson-configuration module
>>> and can be applied independently.
>>
>> I applied this one. Now the rest of the series also seems fine to me.
>> Maxim, Efraim, Vagrant any thoughts?
>
> I've reviewed the series, thanks for the ping. It seems it'll need to
> be rebased on master as some of the changes conflict with turning the
> previous avr-toolchain and friends into procedure that was merged
> perhaps a week ago.

Just a heads-up for you embedded team :-) : Jean-Pierre sent an updated
version last week.

Ludo’.
E
E
Efraim Flashner wrote on 11 Dec 2023 03:58
Re: [bug#66263] Updated patch series.
(name . Jean-Pierre De Jesus Diaz)(address . jean@foundationdevices.com)(address . 66263-done@debbugs.gnu.org)
ZXb5SqKIwRi1Lc3M@3900XT
On Tue, Nov 28, 2023 at 11:50:50AM +0000, Jean-Pierre De Jesus Diaz via Guix-patches via wrote:
Toggle quote (18 lines)
> Hello,
>
> I've sent an updated revision of the changes, now adding
> the MinGW toolchain targets and also changing the Ergodox
> and QMK firmwares to use #:target "avr" for cross-compilation,
> so it removes make-avr-toolchain from `qmk` inputs as packages
> should use #:target "avr" or in user profiles cases they can install
> the toolchain from the packages in cross-toolchain.scm.
>
> The QMK package warns about the firmware not compiling with
> GCC 8+ but it seems to be working right now with the default
> GCC used in Guix, so maybe it'd be to tie the package to the
> default GCC version as IIRC there's no way to pass a custom base
> GCC version when using #:target means of cross compilation.
>
> I've also moved the toolchain procedure to cross-base.scm and
> memoized it.

Wow! Thank you for all the work on this.

Patches slightly modified (indentation, wording on commit messages) and
pushed!

--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmV2+UoACgkQQarn3Mo9
g1EVohAAp5r6dJ/T5vFoNdHYJTEO4ZEPL6F1e+PymwwGNmQrYUiPNqRJhH5yj88C
1kEkAtAd6I8WomDxFVsAcl93Ie3OrbQ1g3+ZZw0SpZedr6771Pq+uQ2zqpFPf4Io
ucifXxzXomg0zRe57KcQzj/k58G7y0mA46l7VlfaNearh10vLamRoVdFMPYymSCN
2nvXEesaZHufM4fi0LCkaCQXnQaOAf/iP0+2ZQCgA+Y0k9KbsGqbL05nj5P/M0ub
onQGWQwPQsHi9K8V71VkLrOjLWenKNsGDETEBDpSXW9DBpdUHUSDkwjBB/fN4ia2
1Vcc4l2O2Ia+P1iFyiW2Hmq3w7OzFTl5g3n644NTaD/yRqgm0YnPQOTcBSlTM6In
aTxSE36PM6FnXcTXPxaDt4QDvTi3M2cySXp+DlG4Kw8A7jDPPyMNAtpWHjbtVqV+
pVEi8B6DKZh3cpX9hPfUqoS5fNIb1nilKnShk5yUS6NA4nFysETL2+T5EA9dmVJ2
PtxkLZUbNxHVg+aQTj6bHwJ7Pg+0Cs7uXI4oVWS9cKSmFj8s/9b70iLRzrFpT8UI
AWj6ZLJ1uPkJ/GRSNTnV4vf5+p4m4oE0/Q10F3KtQ7/KFEywvp/jeIYFzdeVE9cf
MKPXYtW8qI5/Jo7TjUY9/hTCsqwx8jxzVGkQDnbyGNaCq7dgma0=
=bB9p
-----END PGP SIGNATURE-----


Closed
J
J
Jean-Pierre De Jesus Diaz wrote on 11 Dec 2023 04:30
CAG1gdUrGtAKcr7mEUdeFr1fu9yxEz4oR0eq1mw5KqjOspK+y7w@mail.gmail.com
Hi!

Thanks for pushing these changes! Hope to help around more in embedded
target areas,
and sorry for the issues on indentation and commit messages.

Cheers!

On Mon, Dec 11, 2023 at 11:58 AM Efraim Flashner <efraim@flashner.co.il> wrote:
Toggle quote (32 lines)
>
> On Tue, Nov 28, 2023 at 11:50:50AM +0000, Jean-Pierre De Jesus Diaz via Guix-patches via wrote:
> > Hello,
> >
> > I've sent an updated revision of the changes, now adding
> > the MinGW toolchain targets and also changing the Ergodox
> > and QMK firmwares to use #:target "avr" for cross-compilation,
> > so it removes make-avr-toolchain from `qmk` inputs as packages
> > should use #:target "avr" or in user profiles cases they can install
> > the toolchain from the packages in cross-toolchain.scm.
> >
> > The QMK package warns about the firmware not compiling with
> > GCC 8+ but it seems to be working right now with the default
> > GCC used in Guix, so maybe it'd be to tie the package to the
> > default GCC version as IIRC there's no way to pass a custom base
> > GCC version when using #:target means of cross compilation.
> >
> > I've also moved the toolchain procedure to cross-base.scm and
> > memoized it.
>
> Wow! Thank you for all the work on this.
>
> Patches slightly modified (indentation, wording on commit messages) and
> pushed!
>
> --
> Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
> GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
> Confidentiality cannot be guaranteed on emails sent or received unencrypted



--
Jean-Pierre De Jesus DIAZ
Foundation Devices, Inc.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 66263@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 66263
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch