stm32: generate memory image from elf for dfu bootloader to download #33

Merged
sb10q merged 1 commits from harry/nix-scripts:stm32-dfu into master 2020-09-17 12:58:29 +08:00
1 changed files with 3 additions and 0 deletions

View File

@ -20,6 +20,7 @@ let
cargoSha256 = (import cargoSha256Drv); cargoSha256 = (import cargoSha256Drv);
inherit patchPhase; inherit patchPhase;
buildInputs = [ pkgs.llvm ];
buildPhase = '' buildPhase = ''
export CARGO_HOME=$(mktemp -d cargo-home.XXX) export CARGO_HOME=$(mktemp -d cargo-home.XXX)
cargo build --release cargo build --release
@ -30,6 +31,8 @@ let
mkdir -p $out $out/nix-support mkdir -p $out $out/nix-support
cp target/thumbv7em-none-eabihf/release/${name} $out/${name}.elf cp target/thumbv7em-none-eabihf/release/${name} $out/${name}.elf
echo file binary-dist $out/${name}.elf >> $out/nix-support/hydra-build-products echo file binary-dist $out/${name}.elf >> $out/nix-support/hydra-build-products
llvm-objcopy -O binary target/thumbv7em-none-eabihf/release/${name} $out/${name}.bin
echo file binary-dist $out/${name}.bin >> $out/nix-support/hydra-build-products
''; '';
}; };
in in