@@ 16,7 16,9 @@
#:export (make-gcc-arm-none-eabi-12.3.rel1
make-newlib-nano-arm-none-eabi-12.3.rel1
- arm-none-eabi-nano-toolchain-12.3.rel1))
+ make-newlib-arm-none-eabi-12.3.rel1
+ arm-none-eabi-nano-toolchain-12.3.rel1
+ arm-none-eabi-toolchain-12.3.rel1))
(define make-gcc-arm-none-eabi-12.3.rel1
(mlambda ()
@@ 95,10 97,9 @@
(variable "CROSS_LIBRARY_PATH")
(files '("arm-none-eabi/lib")))))))))
-(define make-newlib-nano-arm-none-eabi-12.3.rel1
- (mlambda ()
- (let ((base (make-newlib-nano-arm-none-eabi))
- (commit "4c7d0dfec5793cbf5cf3930b91f930479126d8ce")
+(define make-base-newlib-arm-none-eabi-12.3.rel1
+ (mlambda (base)
+ (let ((commit "4c7d0dfec5793cbf5cf3930b91f930479126d8ce")
(revision "0"))
(package
(inherit base)
@@ 138,6 139,14 @@
("xgcc" ,(make-gcc-arm-none-eabi-12.3.rel1))
("texinfo" ,texinfo)))))))
+(define make-newlib-nano-arm-none-eabi-12.3.rel1
+ (mlambda ()
+ (make-base-newlib-arm-none-eabi-12.3.rel1 (make-newlib-nano-arm-none-eabi))))
+
+(define make-newlib-arm-none-eabi-12.3.rel1
+ (mlambda ()
+ (make-base-newlib-arm-none-eabi-12.3.rel1 (make-newlib-arm-none-eabi))))
+
(define make-libstdc++-12.3.rel1
(mlambda (xgcc newlib)
(let* ((newlib-with-xgcc
@@ 155,13 164,46 @@
(outputs '("out"))
(arguments (substitute-keyword-arguments (package-arguments base)
((#:configure-flags flags)
-
#~(cons* "--with-target-subdir=yes"
+ "CFLAGS=-ffunction-sections -fdata-sections"
(string-append "--libdir="
#$output
"/arm-none-eabi/lib")
#$flags))))))))
+(define make-libstdc++-nano-12.3.rel1
+ (mlambda (xgcc newlib-nano)
+ (let ((base (make-libstdc++-12.3.rel1 xgcc newlib-nano)))
+ (package
+ (inherit base)
+ (name "libstdc++-arm-none-eabi-nano")
+ (arguments (substitute-keyword-arguments (package-arguments base)
+ ((#:configure-flags flags)
+ #~(cons* "CFLAGS=-ffunction-sections -fdata-sections -fno-exceptions"
+ (filter
+ (lambda (flag)
+ (not (string-prefix? "CFLAGS=" flag)))
+ #$flags)))
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ ;; This is mostly the same as for newlib-nano
+ (add-after 'install 'hardlink-libstdc++
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ ;; The nano.specs file says that newlib-nano files should
+ ;; end in "_nano.a" instead of just ".a". Note that this
+ ;; applies to all the multilib folders too.
+ (for-each
+ (lambda (file)
+ (link file
+ (string-append
+ ;; Strip ".a" off the end
+ (substring file 0 (- (string-length file) 2))
+ ;; Add "_nano.a" onto the end
+ "_nano.a")))
+ (find-files
+ out "^(libstdc\\+\\+.a|libsupc\\+\\+.a)$")))))))))))))
+
(define make-arm-none-eabi-toolchain
(mlambda (xgcc newlib)
"Produce a cross-compiler toolchain package with the compiler XGCC and the
@@ 173,11 215,7 @@ C library variant NEWLIB."
(alist-replace "xgcc" (list xgcc)
(package-native-inputs newlib))))))
(package
- (name (string-append "arm-none-eabi"
- (if (string=? (package-name newlib-with-xgcc)
- "newlib-nano")
- "-nano" "")
- "-toolchain"))
+ (name "arm-none-eabi-toolchain")
(version (package-version xgcc))
(source #f)
(build-system trivial-build-system)
@@ 204,6 242,22 @@ languages are C and C++.")
(home-page (package-home-page xgcc))
(license (package-license xgcc))))))
+(define make-arm-none-eabi-nano-toolchain
+ (mlambda (xgcc newlib-nano)
+ (let ((base (make-arm-none-eabi-toolchain xgcc newlib-nano)))
+ (package
+ (inherit base)
+ (name "arm-none-eabi-nano-toolchain")
+ (propagated-inputs
+ (modify-inputs (package-propagated-inputs base)
+ (replace "libstdc++" (make-libstdc++-nano-12.3.rel1 xgcc newlib-nano))))))))
+
+(define arm-none-eabi-toolchain-12.3.rel1
+ (make-arm-none-eabi-toolchain
+ (make-gcc-arm-none-eabi-12.3.rel1)
+ (make-newlib-arm-none-eabi-12.3.rel1)))
+
(define arm-none-eabi-nano-toolchain-12.3.rel1
- (make-arm-none-eabi-toolchain (make-gcc-arm-none-eabi-12.3.rel1)
+ (make-arm-none-eabi-nano-toolchain
+ (make-gcc-arm-none-eabi-12.3.rel1)
(make-newlib-nano-arm-none-eabi-12.3.rel1)))