Add picolibc, improve GCC builds, update Zephyr, ZMK, Redox

This commit is contained in:
Stefan 2024-05-19 22:22:01 +02:00
parent c03fdc6264
commit 5fce2e4987
5 changed files with 1592 additions and 787 deletions

File diff suppressed because it is too large Load diff

View file

@ -33,7 +33,7 @@
;; to collect in the ZEPHYR_MODULES environment variable. The build-system of
;; Zephyr searches for a file zephyr/module.yml in all paths listed in the
;; environment variable ZEPHYR_MODULES. If that file is missing a name
;; property, then the parent directory name is used as the module name. Having
;; property, then the parent directory name is used as the module name. Having
;; two modules with the same name is treated as an error. As Guix needs a
;; common directory name for search-path-specification, we need this
;; intermediate directory as a pattern to find unique module names.
@ -42,7 +42,7 @@
(define-public %zephyr-module "zephyr-module")
(define-public zephyr
(let ((version "3.4.0"))
(let ((version "3.5.0"))
(package
(name "zephyr")
(version version)
@ -54,7 +54,7 @@
(commit (string-append "zephyr-v" version))))
(file-name (git-file-name name version))
(sha256 (base32
"1gcry9fxv88js5nymi9akgrkghkwavggj3wqdgg2cz6brr5wg284"))))
"0mca9ca8b2xjwjg0vl5858fd9l6h0m1jqbd3zr651zryf2897a80"))))
(build-system copy-build-system)
(arguments
(list
@ -66,13 +66,13 @@
(lambda _
;; Avoid fetching the BUILD_VERSION from the git repository.
(substitute* "CMakeLists.txt"
(("if *\\(DEFINED BUILD_VERSION\\)")
(("if *\\(DEFINED BUILD_VERSION\\)")
(string-append
"if (NOT DEFINED BUILD_VERSION)\n"
" set(BUILD_VERSION " #$version ")\n"
"elseif (DEFINED BUILD_VERSION)")))
;; Avoid USER_CACHE_DIR to point to XDG_CACHE_HOME, HOME, or to
;; ZEPHYR_BASE inside the store. Instead use the build dir.
;; Avoid USER_CACHE_DIR to point to XDG_CACHE_HOME, HOME or to
;; ZEPHYR_BASE inside the store. Instead use the build dir.
(with-output-to-file
"cmake/modules/user_cache.cmake"
(lambda ()
@ -93,12 +93,12 @@
constrained devices, and built with security in mind.")
(license license:apsl2))))
(define-public zephyr-3.2+zmk-fixes
(define-public zephyr-3.5+zmk-fixes
(let ((revision "1")
(commit "0a586db7b58269fb08248b081bdc3b43452da5f4"))
(commit "8f87b3be1e7631332cd8b245fb94d24d0354d0cb"))
(package/inherit zephyr
(name "zephyr+zmk-fixes")
(version (git-version "3.2.0" revision commit))
(version (git-version "3.5.0" revision commit))
(source
(origin
(method git-fetch)
@ -107,7 +107,7 @@ constrained devices, and built with security in mind.")
(commit commit)))
(file-name (git-file-name name version))
(sha256 (base32
"04mqgzhgjb43ybryvpwrbq2g9i0gk7wd7s2ds3fsrakl4hxqss78"))))
"0bgy6psg2wb4fflkz1ww5dkh5qq2yrfr3cqpi2qkwgj250m8cdfb"))))
(home-page "https://github.com/zmkfirmware/zephyr"))))
(define-public zephyr-build-tools

View file

@ -40,9 +40,9 @@
(define-public (complete-zephyr-application zephyr-application
zephyr
zephyr-build-tools
target
toolchain
c-toolchain
target
additional-configure-flags
directory-to-install-from
source-prefix
target-prefix)
@ -59,17 +59,18 @@ boilerplate."
(arguments
(append
(substitute-keyword-arguments (package-arguments zephyr-application)
((#:configure-flags configure-flags #~(list))
#~(append #$configure-flags
(list
"-DZEPHYR_TOOLCHAIN_VARIANT=cross-compile"
(string-append "-DCROSS_COMPILE=" #$cross-compile-prefix)))))
((#:configure-flags configure-flags '())
#~(append
(list "-DZEPHYR_TOOLCHAIN_VARIANT=cross-compile"
(string-append "-DCROSS_COMPILE=" #$cross-compile-prefix))
'#$additional-configure-flags
#$configure-flags)))
(list
#:tests? #f
#:phases
#~(modify-phases %standard-phases
(add-after 'set-paths 'correct-ZEPHYR_MODULES
;; The search-path-specification is not powerful enough. Zephyr
;; The search-path-specification is not powerful enough. Zephyr
;; modules contain a zephyr-module/<name>/zephyr directory
;; without a common pattern for <name> and the ZEPHYR_MODULES
;; environment variable needs to list the zephyr-module/<name>
@ -138,7 +139,7 @@ boilerplate."
(cons (package-license zephyr-application)
(map (compose package-license second)
(filter package? extended-inputs))))))
c-toolchain)))
(c-toolchain toolchain))))
(define*-public (make-zephyr-application-for-arm zephyr-application
#:key
@ -150,16 +151,17 @@ boilerplate."
target-prefix)
"Make a Zephyr application for Arm microcontrollers by completing the
incomplete ZEPHYR-APPLICATION package with Arm specific Zephyr boilerplate."
(complete-zephyr-application zephyr-application
zephyr
zephyr-build-tools
"arm-none-eabi"
gcc12-cross-newlib-arm-none-eabi-toolchain
gcc12-cross-newlib-arm-none-eabi-c-toolchain
directory-to-install-from
source-prefix
(or target-prefix
(package-name zephyr-application))))
(complete-zephyr-application
zephyr-application
zephyr
zephyr-build-tools
GCC-cross-picolibc-arm-none-eabi-toolchain
"arm-none-eabi"
'("-DTOOLCHAIN_HAS_PICOLIBC=y"
"-DCONFIG_TOOLCHAIN_CROSS_COMPILE_SUPPORTS_THREAD_LOCAL_STORAGE=y")
directory-to-install-from
source-prefix
(or target-prefix (package-name zephyr-application))))
(define-public zephyr-hello-world
(make-zephyr-application-for-arm
@ -171,10 +173,7 @@ incomplete ZEPHYR-APPLICATION package with Arm specific Zephyr boilerplate."
(arguments
(list
#:configure-flags
#~(list "-DBOARD=nucleo_wb55rg"
"-DCONFIG_BT=y"
"-DCONFIG_BT_STM32_IPM=y"
"-DCMAKE_C_FLAGS=-DCFG_BLE_LSE_SOURCE=1"
#~(list "-DBOARD=nucleo_f767zi"
"-DCMAKE_BUILD_TYPE=RelMinSize")))
(inputs (list zephyr-module-cmsis
zephyr-module-hal-stm32
@ -250,10 +249,10 @@ optional CONFIGURE-FLAGS. Use the public KEY file for firmware decryption."
python-cbor2
python-click
python-cryptography
python-intelhex
python-intelhex
python-pyyaml))
(home-page (package-home-page zephyr-module-mcuboot))
(synopsis "MCUboot's image signing and key management")
(description "A tool to securely sign firmware images for booting by
(home-page (package-home-page zephyr-module-mcuboot))
(synopsis "MCUboot's image signing and key management")
(description "A tool to securely sign firmware images for booting by
MCUboot.")
(license (package-license zephyr-module-mcuboot))))
(license (package-license zephyr-module-mcuboot))))

View file

@ -56,11 +56,11 @@ provides the build-system and proper arguments."
(license #f)))
(define-public zephyr-module-cmsis
(let ((revision "1")
(commit "74981bf893e8b10931464b9945e2143d99a3f0a3"))
(let ((revision "2")
(commit "dc9658a1723ad911303a48b53a3e08222f10c181"))
(package/inherit zephyr-module-template
(name "zephyr-module-cmsis")
(version (git-version "5.8.0" revision commit))
(version (git-version "5.9.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
@ -69,7 +69,7 @@ provides the build-system and proper arguments."
(file-name (git-file-name name version))
(sha256
(base32
"11wwcdwzi5ac8k881616p69v7cz356cwvbqsmmfw3w3v63b9dsmy"))))
"0kyjmr2jvndnx1lpglg9rvcwbnb2abjksp0b9hydx366ivaza5xn"))))
(home-page "https://github.com/zephyrproject-rtos/cmsis")
(synopsis "Zephyr module for CMSIS")
(description "Zephyr module providing the Common Microcontroller
@ -78,22 +78,22 @@ Software Interface Standard.")
(define-public zephyr-module-hal-nordic
(let ((revision "1")
(commit "cf6e9fc5f7c2c98df26f2a4227a95df9a50823e7"))
(commit "2947109e8dbc06ab6645d404499b6b6f6b04f3cf"))
(package/inherit zephyr-module-template
(name "zephyr-module-hal-nordic")
(version (git-version "3.1.0" revision commit))
(version (git-version "3.4.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/hal_nordic")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"1zbnhf7r9sg67xjhbdh6fn4gvccc71pxqcmbfnsi6a75bhfv9y55"))))
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/hal_nordic")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"1sjhlxn866ip944a9y6lg3j2nr2nn9awzvny723cfm84xmrvq0kf"))))
(home-page "https://github.com/zephyrproject-rtos/hal_nordic")
(synopsis "Zephyr module for Nordic Semiconductor's SoCs and SiPs")
(description "Zephyr module providing the Hardware Abstraction Layer for
(synopsis "Zephyr module for Nordic Semiconductor's SoCs and SiPs")
(description "Zephyr module providing the Hardware Abstraction Layer for
Nordic Semiconductor's SoCs and SiPs.
Supported SoCs and SiPs:
@ -112,85 +112,69 @@ Supported SoCs and SiPs:
@item nRF9161
@end itemize
")
(license license:bsd-3))))
(license license:bsd-3))))
(define-public zephyr-module-hal-nordic-2.11
(let ((revision "0")
(commit "5644a13252e5d12e3e841105d106cfdeb40e59f9"))
(define-public zephyr-module-hal-nordic-3.1.0
(let ((revision "1")
(commit "d054a315eb888ba70e09e5f6decd4097b0276d1f"))
(package/inherit zephyr-module-hal-nordic
(name "zephyr-module-hal-nordic")
(version (git-version "2.11.0" revision commit))
(version (git-version "3.1.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/hal_nordic")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"0lj7wlbfp9pb5pv819h9kbddmlzfbdnbmxhpm1i4xmf89z9v14sm")))))))
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/hal_nordic")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"0ypny416ylb2w5jg4bg55xvfg0yhqlbrakzvm0w23lnamg49kd6j")))))))
(define-public zephyr-module-hal-stm32
(let ((revision "1")
(commit "d466dc8421ee0c6592bb5682aa93a671bc948107"))
(let ((revision "2")
(commit "89ef0a3383edebf661073073bcdf6e2836fe90ee"))
(package/inherit zephyr-module-template
(name "zephyr-module-hal-stm32")
;; Using highest version number listed in:
;; https://github.com/zephyrproject-rtos/hal_stm32/blob/main/stm32cube/common_ll/README.rst
(version (git-version "1.27.1" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/hal_stm32")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"0q0ckial6a3lvlag44zm65dklbbdnqpzr1vbh85dhwx7acpjd5ni"))))
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/hal_stm32")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"0z7q5xg1rn9c3anjvi2kl0hgik3y3r25svwf97w1cjhjx1rhqmpv"))))
(home-page "https://github.com/zephyrproject-rtos/hal_stm32")
(synopsis "Zephyr module for STM32 microcontrollers")
(description "Zephyr module providing the required STM32cube packages,
(synopsis "Zephyr module for STM32 microcontrollers")
(description "Zephyr module providing the required STM32cube packages,
dtsi files and libraries needed to build a Zephyr application running on STM32
silicon.")
(license license:bsd-3))))
(license license:bsd-3))))
(define-public zephyr-module-lvgl-8.2.0
(define-public zephyr-module-lvgl-8.3.11
(let ((revision "1")
(commit "70a7849726be8375e3d941153dc417823ea7f355"))
(commit "2b498e6f36d6b82ae1da12c8b7742e318624ecf5"))
(package/inherit zephyr-module-template
(name "zephyr-module-lvgl")
(version (git-version "8.2.0" revision commit)) ; Taken from lvgl.h.
(version (git-version "8.4.0" revision commit)) ; Taken from lvgl.h.
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/zmkfirmware/lvgl")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"147mykkb72nwbjhrw4z7h0kkxw4p7kvy0w001s44rgplxhqqsg98"))))
(home-page "https://github.com/zmkfirmware/lvgl")
(synopsis "Zephyr module for LVGL")
(description "Zephyr module providing LVGL, the Light and Versatile
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/lvgl/")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"09ch4zd0ha806jiasspvcxx526y663rw5gskyz9ikv9kcd5wdjks"))))
(home-page "https://github.com/zephyrproject-rtos/lvgl")
(synopsis "Zephyr module for LVGL")
(description "Zephyr module providing LVGL, the Light and Versatile
Graphics Library for an embedded GUI with graphical elements, visual effects
and a low memory footprint.")
(license license:apsl2))))
(define-public zephyr-module-lvgl
(let ((revision "2")
(commit "5da257f782a8f9c6e265bdc60ebc2a93fdee24de"))
(package/inherit zephyr-module-lvgl-8.2.0
(name "zephyr-module-lvgl")
(version (git-version "8.3.7" revision commit)) ; Taken from lvgl.h.
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/lvgl")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"14isczxi36dasks1w4hwdlbzpvja4wal458i0km0hi92bbxayg0a")))))))
(license license:apsl2))))
(define-public zephyr-module-mbedtls
(let ((revision "1")
@ -199,44 +183,44 @@ and a low memory footprint.")
(name "zephyr-module-mbedtls")
(version (git-version "3.4.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/mbedtls")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"0661myy0wjz38nypbyfw51x10mzg57syb5c28irblgjm2w25wbi7"))))
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/mbedtls")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"0661myy0wjz38nypbyfw51x10mzg57syb5c28irblgjm2w25wbi7"))))
(home-page "https://github.com/zephyrproject-rtos/mbedtls")
(synopsis "Zephyr module for Mbed TLS")
(description "Zephyr module providing Mbed TLS, a C library that
(synopsis "Zephyr module for Mbed TLS")
(description "Zephyr module providing Mbed TLS, a C library that
implements cryptographic primitives, X.509 certificate manipulation and the
SSL/TLS and DTLS protocols. Its small code footprint makes it suitable for
embedded systems.")
(license license:apsl2))))
(license license:apsl2))))
(define-public zephyr-module-mcuboot
(let ((revision "1")
(commit "76d19b3b8885ea7ae25a6f4f5d8501f7ec646447"))
(commit "02267cfdb5b368c700e3ca6bf47ecc97924c9a56"))
(package/inherit zephyr-module-template
(name "zephyr-module-mcuboot")
(version (git-version "1.11.0-dev" revision commit))
(version (git-version "2.0.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/mcuboot")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"1frm9330bir1cz7h87qq26r74igy3pvrz3iqpvc7r6l7silj0fxf"))))
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/mcuboot")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"1xxsaz6fanv9k1gb9d9ch0klfd88daaxrdha14vhx8xfx1wdrsiv"))))
(home-page "https://github.com/zephyrproject-rtos/mcuboot")
(synopsis "Zephyr module for MCUboot")
(description "Zephyr module providing the secure bootloader MCUboot for
(synopsis "Zephyr module for MCUboot")
(description "Zephyr module providing the secure bootloader MCUboot for
32-bit microcontrollers. It defines a common infrastructure for the bootloader
and the system flash layout on microcontroller systems, and provides a secure
bootloader that enables easy software upgrade.")
(license license:apsl2))))
(license license:apsl2))))
(define-public zephyr-module-tinycrypt
(let ((revision "1")
@ -245,38 +229,37 @@ bootloader that enables easy software upgrade.")
(name "zephyr-module-tinycrypt")
(version (git-version "0.2.8" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/tinycrypt")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"19d2q9y23yzz9i383q3cldjl3k5mryx9762cab23zy3ijdnmj2z6"))))
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/tinycrypt")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"19d2q9y23yzz9i383q3cldjl3k5mryx9762cab23zy3ijdnmj2z6"))))
(home-page "https://github.com/zephyrproject-rtos/tinycrypt")
(synopsis "Zephyr module for the TinyCrypt library")
(description "Zephyr module providing the TinyCrypt library.")
(license (license:non-copyleft "file://README.zephyr")))))
(synopsis "Zephyr module for the TinyCrypt library")
(description "Zephyr module providing the TinyCrypt library.")
(license (license:non-copyleft "file://README.zephyr")))))
(define-public zephyr-module-zcbor
(let ((revision "1")
(commit "67fd8bb88d3136738661fa8bb5f9989103f4599e"))
(let ((version "0.8.1"))
(package/inherit zephyr-module-template
(name "zephyr-module-zcbor")
(version (git-version "0.7.0" revision commit))
(version version)
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/zcbor")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"16138k7xlahf63dfvplm8c2m0kxs1g17gcx1fa31y4gcfbi3b0k7"))))
(method git-fetch)
(uri (git-reference
(url "https://github.com/zephyrproject-rtos/zcbor")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32
"1sc8bvqqjqyaxdmnvp7hk4js1vwa1gpxahqc1i16d5sl8gp7h8v2"))))
(home-page "https://github.com/zephyrproject-rtos/zcbor")
(synopsis "Zephyr module for the zcbor library")
(description "Zephyr module providing the zcbor low footprint CBOR
(synopsis "Zephyr module for the zcbor library")
(description "Zephyr module providing the zcbor low footprint CBOR
(Concise Binary Object Representation) library in the C language, tailored for
use in microcontrollers.")
(license license:apsl2))))
(license license:apsl2))))

File diff suppressed because it is too large Load diff