Commit 1254db5b authored by Astro's avatar Astro
Browse files

add shell.nix

parent 5f66324d
target remote :3333
# print demangled symbols by default
set print asm-demangle on
monitor arm semihosting enable
load
{ stdenv, makeWrapper, openocd, fetchFromGitHub, autoreconfHook, git, which }:
let
maxim-openocd = openocd.overrideAttrs (oa: {
name = "maxim-openocd";
src = fetchFromGitHub {
owner = "maximmbed";
repo = "openocd";
rev = "e71ac88c9dbfa4ee1405d7a86376119dcc887ed1";
sha256 = "18yc1wyclmjxqg6jilfcm60hi01pgqc4dilsmksqbhg23m6x4ycw";
fetchSubmodules = true;
};
nativeBuildInputs = oa.nativeBuildInputs ++ [
autoreconfHook
git
which
];
enableParallelBuilding = true;
});
in
stdenv.mkDerivation {
name = "openocd-card10";
src = maxim-openocd;
phases = [ "unpackPhase" "installPhase" ];
buildInputs = [ maxim-openocd makeWrapper ];
installPhase = ''
mkdir -p $out/bin
makeWrapper ${maxim-openocd}/bin/openocd $out/bin/openocd-card10 \
--add-flags "-f ${maxim-openocd}/share/openocd/scripts/interface/cmsis-dap.cfg" \
--add-flags "-f ${maxim-openocd}/share/openocd/scripts/target/max32665.cfg"
'';
}
let
mozillaOverlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
pkgs = import <nixpkgs> { overlays = [ mozillaOverlay ]; };
in
with pkgs;
let
openocd = callPackage ./openocd.nix {};
rust = rustChannelOfTargets "nightly" null [ "thumbv7em-none-eabihf" ];
in
stdenv.mkDerivation {
name = "env";
buildInputs = with rustPlatform.rust; [
gdb
rust
];
# Set Environment Variables
RUST_BACKTRACE = 1;
shellHook = ''
echo "Starting openocd…"
${openocd}/bin/openocd-card10 &
# Let openocd output scroll by
sleep 1
echo "Run 'cargo run --release'"
'';
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment