From e393828702b2813d37c8ceccdb3f9c68293d1396 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 16 Feb 2019 13:18:57 +1100 Subject: [PATCH] Tools: added files useful for hardware debugging --- Tools/debug/99-blackmagic.rules | 2 ++ Tools/debug/README.md | 3 +++ Tools/debug/gdb-black-magic.init | 18 ++++++++++++++++++ Tools/debug/gdb-openocd.init | 12 ++++++++++++ Tools/debug/openocd.cfg | 8 ++++++++ 5 files changed, 43 insertions(+) create mode 100644 Tools/debug/99-blackmagic.rules create mode 100644 Tools/debug/README.md create mode 100644 Tools/debug/gdb-black-magic.init create mode 100644 Tools/debug/gdb-openocd.init create mode 100644 Tools/debug/openocd.cfg diff --git a/Tools/debug/99-blackmagic.rules b/Tools/debug/99-blackmagic.rules new file mode 100644 index 0000000000..c42f5553f4 --- /dev/null +++ b/Tools/debug/99-blackmagic.rules @@ -0,0 +1,2 @@ +SUBSYSTEM=="tty", ATTRS{interface}=="Black Magic GDB Server", SYMLINK+="ttyBmpGdb" +SUBSYSTEM=="tty", ATTRS{interface}=="Black Magic UART Port", SYMLINK+="ttyBmpTarg" diff --git a/Tools/debug/README.md b/Tools/debug/README.md new file mode 100644 index 0000000000..82212b5418 --- /dev/null +++ b/Tools/debug/README.md @@ -0,0 +1,3 @@ +This directory contains files that are useful for setting up to debug +ArduPilot using either a black magic probe or a stlink-v2 with openocd + diff --git a/Tools/debug/gdb-black-magic.init b/Tools/debug/gdb-black-magic.init new file mode 100644 index 0000000000..27356974a3 --- /dev/null +++ b/Tools/debug/gdb-black-magic.init @@ -0,0 +1,18 @@ +# copy the file to .gdbinit in your Firmware tree, and adjust the path +# below to match your system + +# using ttyBmpGdb is appropriate if you have setup udev to +# automatically create a link when a black magic probe is +# inserted. See 99-blackmagic.rules in this directory +target extended /dev/ttyBmpGdb +monitor swdp_scan +attach 1 + +#monitor vector_catch disable hard +set mem inaccessible-by-default off +set print pretty + +b AP_HAL::panic +b HardFault_Handler +b chSysHalt +set confirm off diff --git a/Tools/debug/gdb-openocd.init b/Tools/debug/gdb-openocd.init new file mode 100644 index 0000000000..72cab041f8 --- /dev/null +++ b/Tools/debug/gdb-openocd.init @@ -0,0 +1,12 @@ +# copy this file to .gdbinit in your Firmware tree + +# this sets up gdb to use openocd. You must start openocd first +target extended-remote :3333 + +set mem inaccessible-by-default off +set print pretty + +b AP_HAL::panic +b HardFault_Handler +b chSysHalt +set confirm off diff --git a/Tools/debug/openocd.cfg b/Tools/debug/openocd.cfg new file mode 100644 index 0000000000..300db0a3de --- /dev/null +++ b/Tools/debug/openocd.cfg @@ -0,0 +1,8 @@ +# sample openocd config file for use with ArduPilot +# ChibiOS boards +source [find interface/stlink.cfg] +# replace the stm32f4x with the right value for +# your microcontroller +source [find target/stm32f4x.cfg] +init +$_TARGETNAME configure -rtos ChibiOS