This commit is contained in:
shimun 2020-10-30 15:43:25 +01:00
parent 5f9537bccc
commit 3de4d0155e
Signed by: shimun
GPG Key ID: E81D8382DC2F971B

View File

@ -5,44 +5,20 @@ let
] ++ (with builtins; map (d: getAttr d python-packages) (filter (d: stringLength d > 0) (pkgs.lib.splitString "\n" (builtins.readFile ./tools/requirements.txt))))));
python-with-my-packages = pkgs.python3.withPackages pyPackages;
src = ./.;
tinycbor = with pkgs; stdenv.mkDerivation {
name = "tinycbor";
src = "${src}/tinycbor";
makeFlags = [ "PREFIX=$(out)" "prefix=$(out)" ];
buildInputs = [ gcc gcc-arm-embedded-8 ];
};
standalone = with pkgs; stdenv.mkDerivation {
name = "solo-standalone";
src = [
src
tinycbor
];
buildInputs = [ gnumake gcc gcc-arm-embedded-8 python-with-my-packages ];
installPhase = ''
make clean
make all PREFIX=$(out)" "prefix=$(out)
mkdir -p $out/bin
cp main $out/bin/
'';
};
in
with pkgs; stdenv.mkDerivation {
name = "solo";
outputs = [ "out" "firmware" ];
src = builtins.filterSource (path: type: (!(lib.hasSuffix path "./tinycbor/lib") && !(lib.hasSuffix path ".hex")&& !(lib.hasSuffix path ".sha256")&& !(lib.hasSuffix path ".elf"))) ./.;
outputs = [ "out" ];
src = with lib; builtins.filterSource (path: type: !(hasSuffix path "hex" || hasSuffix path "sha256")) src;
buildInputs = [ gnumake gcc gcc-arm-embedded-8 git python-with-my-packages ];
########installPhase = ''
######## mkdir -p $firmware $standalone/bin/
######## cp main $standalone/bin/
######## cd stm32l432
######## make firmware
######## cp *.hex *.sha256 *.elf cubeconfig_stm32l442.ioc $firmware/
########'';
phases = [ "unpackPhase" "configurePhase" "buildPhase" "installPhase" ];
installPhase = ''
cd targets/stm32l432
make cbor
mkdir -p $out/firmware $out
cd targets/stm32l432
make cbor
make build-hacker
cp *.hex *.sha256 *.elf cubeconfig_stm32l442.ioc $firmware/
'';
cp *.hex *.sha256 *.elf cubeconfig_stm32l442.ioc $out/firmware/
'';
keepDebugInfo = true;
}