diff --git a/hardware/euro-yesman/.cargo/config b/hardware/euro-yesman/.cargo/config index 1b501a87c97..3ef0ed72b2c 100644 --- a/hardware/euro-yesman/.cargo/config +++ b/hardware/euro-yesman/.cargo/config @@ -1,6 +1,8 @@ +[target.thumbv7m-none-eabi] + +[target.'cfg(all(target_arch = "arm", target_os = "none"))'] +runner = "arm-none-eabi-gdb -tui -q -x openocd.gdb" +rustflags = [ "-C", "link-arg=-Tlink.x" ] + [build] -# Always compile for the instruction set of the STM32F1 target = "thumbv7m-none-eabi" - -# use the Tlink.x scrip from the cortex-m-rt crate -rustflags = [ "-C", "link-arg=-Tlink.x"] diff --git a/hardware/euro-yesman/default.nix b/hardware/euro-yesman/default.nix deleted file mode 100644 index d448589189b..00000000000 --- a/hardware/euro-yesman/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -with (import {}); - -stdenv.mkDerivation { - name = "bad-rust-env"; - buildInputs = with pkgs; [ rustup clangStdenv cargo-flash openocd ]; -} diff --git a/hardware/euro-yesman/flash.sh b/hardware/euro-yesman/flash.sh new file mode 100644 index 00000000000..829303ea5b2 --- /dev/null +++ b/hardware/euro-yesman/flash.sh @@ -0,0 +1,3 @@ +#!/bin/sh + + diff --git a/hardware/euro-yesman/openocd.cfg b/hardware/euro-yesman/openocd.cfg new file mode 100644 index 00000000000..c2364d979d8 --- /dev/null +++ b/hardware/euro-yesman/openocd.cfg @@ -0,0 +1,6 @@ +# This is required to make it work with my fake stm32 +set CPUTAPID 0x2ba01477 +source [find interface/stlink.cfg] + +source [find target/stm32f1x.cfg] + diff --git a/hardware/euro-yesman/openocd.gdb b/hardware/euro-yesman/openocd.gdb new file mode 100644 index 00000000000..99b46764512 --- /dev/null +++ b/hardware/euro-yesman/openocd.gdb @@ -0,0 +1,19 @@ +target remote :3333 + +# print demangled symbols +set print asm-demangle on + +# detect unhandled exceptions, hard faults and panics +break DefaultHandler +break UserHardFault +break rust_begin_unwind + +# *try* to stop at the user entry point (it might be gone due to inlining) +break main + +monitor arm semihosting enable + +load + +# start the process but immediately halt the processor +stepi diff --git a/hardware/euro-yesman/shell.nix b/hardware/euro-yesman/shell.nix new file mode 100644 index 00000000000..6ae1195b3c2 --- /dev/null +++ b/hardware/euro-yesman/shell.nix @@ -0,0 +1,9 @@ +with (import {}); + +stdenv.mkDerivation { + name = "bad-rust-env"; + buildInputs = with pkgs; [ + rustup clangStdenv gcc-arm-embedded + cargo-flash cargo-binutils openocd + ]; +}