default.nix, nix/openocd: replace shell script with makeWrapper
This commit is contained in:
parent
462c5e2668
commit
cbfe3a177b
28
default.nix
28
default.nix
|
@ -19,26 +19,30 @@ stdenv.mkDerivation {
|
|||
buildInputs = [
|
||||
adc2tcp
|
||||
openocd
|
||||
makeWrapper
|
||||
];
|
||||
src = ./.;
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
installPhase =
|
||||
let
|
||||
firmwareBinary = "$out/lib/adc2tcp.elf";
|
||||
openOcdFlags = [
|
||||
"-c" "reset halt"
|
||||
"-c" "flash write_image erase ${firmwareBinary}"
|
||||
"-c" "verify_image ${firmwareBinary}"
|
||||
"-c" "reset run"
|
||||
"-c" "shutdown"
|
||||
];
|
||||
in ''
|
||||
mkdir -p $out/bin $out/lib $out/nix-support
|
||||
|
||||
BIN=$out/lib/adc2tcp
|
||||
ln -s ${adc2tcp}/lib/adc2tcp $BIN
|
||||
cat >> $out/bin/flash-adc2tcp <<EOF
|
||||
#!/usr/bin/env bash
|
||||
${openocd}/bin/openocd-nucleo-f429zi \
|
||||
-c "reset halt" \
|
||||
-c "flash write_image erase $BIN" \
|
||||
-c "verify_image $BIN" \
|
||||
-c "reset run" \
|
||||
-c "shutdown"
|
||||
EOF
|
||||
chmod +x $out/bin/flash-adc2tcp
|
||||
|
||||
echo file binary-dist $BIN >> $out/nix-support/hydra-build-products
|
||||
makeWrapper ${openocd}/bin/openocd-nucleo-f429zi $out/bin/flash-adc2tcp \
|
||||
--add-flags "${lib.escapeShellArgs openOcdFlags}"
|
||||
|
||||
echo file binary-dist ${firmwareBinary} >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
{ stdenv, openocd }:
|
||||
{ stdenv, lib, openocd, makeWrapper }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "openocd-nucleo-f429zi";
|
||||
buildInputs = [
|
||||
openocd
|
||||
makeWrapper
|
||||
];
|
||||
src = ./.;
|
||||
noBuild = true;
|
||||
installPhase = ''
|
||||
installPhase =
|
||||
let
|
||||
openOcdFlags = [
|
||||
"-f" "${openocd}/share/openocd/scripts/interface/stlink-v2-1.cfg"
|
||||
"-f" "${openocd}/share/openocd/scripts/target/stm32f4x.cfg"
|
||||
"-c" "init"
|
||||
];
|
||||
in ''
|
||||
mkdir -p $out/bin
|
||||
cat >> $out/bin/openocd-nucleo-f429zi <<EOF
|
||||
#!/usr/bin/env bash
|
||||
${openocd}/bin/openocd \
|
||||
-f ${openocd}/share/openocd/scripts/interface/stlink-v2-1.cfg \
|
||||
-f ${openocd}/share/openocd/scripts/target/stm32f4x.cfg \
|
||||
-c "init" \
|
||||
"\$@"
|
||||
EOF
|
||||
chmod +x $out/bin/openocd-nucleo-f429zi
|
||||
|
||||
makeWrapper ${openocd}/bin/openocd $out/bin/openocd-nucleo-f429zi \
|
||||
--add-flags "${lib.escapeShellArgs openOcdFlags}"
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue