File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
2- stdenv ,
2+ stdenvNoCC ,
3+ lib ,
34 callPackage ,
45 python3Packages ,
5- git ,
66 cmake ,
7- ninja ,
87 gcc-arm-embedded ,
8+ dtc ,
99} :
1010
11- stdenv . mkDerivation {
11+ stdenvNoCC . mkDerivation {
1212 pname = "water-level-sensor" ;
13- version = "0.1 .0" ;
13+ version = "0.2 .0" ;
1414
1515 src = callPackage ./firmware/west.nix { } ;
1616
1717 nativeBuildInputs = [
18- git
1918 cmake
20- ninja
2119 gcc-arm-embedded
20+ dtc
2221 ]
2322 ++ ( with python3Packages ; [
24- west
23+ packaging
2524 pyelftools
25+ pykwalify
26+ pyyaml
27+ jsonschema
2628 ] ) ;
2729
28- GNUARMEMB_TOOLCHAIN_PATH = gcc-arm-embedded ;
29-
30- dontConfigure = true ;
31-
32- buildPhase = ''
33- runHook preBuild
34-
35- west build -b nrf51_ble400 firmware -- -DZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb -DUSER_CACHE_DIR="$(pwd)/.cache"
36- cat .west/config
37-
38- runHook postBuild
30+ env =
31+ let
32+ tool = name : "${ lib . getBin gcc-arm-embedded } /bin/arm-none-eabi-${ name } " ;
33+ in
34+ {
35+ ZEPHYR_TOOLCHAIN_VARIANT = "gnuarmemb" ;
36+ GNUARMEMB_TOOLCHAIN_PATH = gcc-arm-embedded ;
37+ STRIP = tool "strip" ;
38+ RANLIB = tool "ranlib" ;
39+ AR = tool "ar" ;
40+ CC = tool "gcc" ;
41+ CXX = tool "g++" ;
42+ } ;
43+
44+ cmakeDir = "../firmware" ;
45+
46+ preConfigure = ''
47+ export XDG_CACHE_HOME="$TMPDIR"
48+ source .zephyr-env
49+ cmakeFlagsArray+=("-DBUILD_VERSION=$ZEPHYR_BUILD_VERSION")
3950 '' ;
4051
4152 installPhase = ''
4253 runHook preInstall
4354
4455 mkdir -p "$out"
45- cp build/ zephyr/zephyr.elf "$out"
56+ cp zephyr/zephyr.{ elf,bin,hex,map} "$out"
4657
4758 runHook postInstall
4859 '' ;
Original file line number Diff line number Diff line change @@ -85,8 +85,9 @@ nativeBuildInputs = [ lndir ];
8585 } ) } \
8686 "$out"/'modules/hal/nordic/zephyr/blobs/suit/bin/suit_manifest_starter.hex'
8787
88- cat << EOF > "$out/.zephyr-env"
89- export ZEPHYR_BASE=${ lib . escapeShellArg "${ placeholder "out" } /zephyr" }
90- export ZEPHYR_MODULES=${ lib . escapeShellArg "${ placeholder "out" } /firmware;${ placeholder "out" } /modules/hal/cmsis_6;${ placeholder "out" } /modules/hal/nordic;${ placeholder "out" } /modules/crypto/mbedtls;${ placeholder "out" } /modules/crypto/tf-psa-crypto" }
91- EOF
88+ cat << EOF > "$out/.zephyr-env"
89+ export ZEPHYR_BASE=${ lib . escapeShellArg "${ placeholder "out" } /zephyr" }
90+ export ZEPHYR_MODULES=${ lib . escapeShellArg "${ placeholder "out" } /firmware;${ placeholder "out" } /modules/hal/cmsis_6;${ placeholder "out" } /modules/hal/nordic;${ placeholder "out" } /modules/crypto/mbedtls;${ placeholder "out" } /modules/crypto/tf-psa-crypto" }
91+ export ZEPHYR_BUILD_VERSION=${ lib . escapeShellArg "v4.4.0-1-g487d489b6f0a" }
92+ EOF
9293''
Original file line number Diff line number Diff line change 1313
1414mkShell {
1515 name = "water-level-monitor-env" ;
16+
1617 disableHardening = [ "all" ] ;
18+
1719 nativeBuildInputs = [
1820 which
1921 git
@@ -33,5 +35,5 @@ mkShell {
3335 jsonschema
3436 ] ) ;
3537
36- GNUARMEMB_TOOLCHAIN_PATH = gcc-arm-embedded ;
38+ env . GNUARMEMB_TOOLCHAIN_PATH = gcc-arm-embedded ;
3739}
You can’t perform that action at this time.
0 commit comments