2019-03-07 23:27:33 +08:00
|
|
|
{ rustChannel ? "nightly" }:
|
|
|
|
|
|
|
|
let
|
|
|
|
mozillaOverlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
|
|
|
|
in
|
|
|
|
with import <nixpkgs> { overlays = [ mozillaOverlay ]; };
|
|
|
|
let
|
2019-03-08 01:24:21 +08:00
|
|
|
rustPlatform = callPackage (import ./nix/rustPlatform.nix) { inherit rustChannel; };
|
|
|
|
openocd = callPackage (import ./nix/openocd.nix) {};
|
2019-03-07 23:27:33 +08:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "adc2tcp-env";
|
|
|
|
buildInputs = with rustPlatform.rust; [
|
|
|
|
rustc cargo
|
|
|
|
];
|
|
|
|
|
|
|
|
# Set Environment Variables
|
|
|
|
RUST_BACKTRACE = 1;
|
2019-03-08 01:24:21 +08:00
|
|
|
|
|
|
|
shellHook = ''
|
|
|
|
echo "Starting openocd…"
|
|
|
|
${openocd}/bin/openocd-nucleo-f429zi &
|
|
|
|
|
|
|
|
# Let openocd output scroll by
|
|
|
|
sleep 1
|
|
|
|
|
2019-03-15 02:58:41 +08:00
|
|
|
echo "Run 'cargo build --release --features=semihosting'"
|
2019-03-08 01:24:21 +08:00
|
|
|
echo "Then 'gdb target/thumbv7em-none-eabihf/release/adc2tcp'"
|
|
|
|
'';
|
2019-03-07 23:27:33 +08:00
|
|
|
}
|