summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDima Barsky <[email protected]>2021-04-16 14:23:27 +0100
committerGitHub <[email protected]>2021-04-16 20:23:27 +0700
commit9f925bc900d397461adafeff4a43dce6a74f68d0 (patch)
tree36e868e7413b22e27b4950ec0f7fc6b9e4b6737c
parentc611199632b9288eff76c1c4bfdce5d8cc024748 (diff)
Added support for Black Magic Probe (#787)
* Added flash-bmp and debug-bmp targets; added .gdb_history to .gitignore * Added the BMP variable, defaults to /dev/ttyBmpGdb The name of the BMP device is different on different systems. On Linux (after installing the recommended udev rules) it'll be /dev/ttyBmpGdb, but the user should be able to override it. * Update rules.mk
-rw-r--r--.gitignore1
-rw-r--r--examples/make.mk1
-rw-r--r--examples/rules.mk10
3 files changed, 12 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 093bcc579..f7adff4c9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@ latex
.env
.settings/
.idea/
+.gdb_history
/examples/*/*/build*
test_old/
tests_obsolete/
diff --git a/examples/make.mk b/examples/make.mk
index e04a2592a..6366d6cef 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -57,6 +57,7 @@ CROSS_COMPILE ?= arm-none-eabi-
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
+GDB = $(CROSS_COMPILE)gdb
OBJCOPY = $(CROSS_COMPILE)objcopy
SIZE = $(CROSS_COMPILE)size
MKDIR = mkdir
diff --git a/examples/rules.mk b/examples/rules.mk
index a19cd678e..e5fbee828 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -170,6 +170,16 @@ flash-pyocd: $(BUILD)/$(PROJECT).hex
pyocd flash -t $(PYOCD_TARGET) $<
pyocd reset -t $(PYOCD_TARGET)
+# flash with Black Magic Probe
+
+# This symlink is created by https://github.com/blacksphere/blackmagic/blob/master/driver/99-blackmagic.rules
+BMP ?= /dev/ttyBmpGdb
+
+flash-bmp: $(BUILD)/$(PROJECT).elf
+ $(GDB) --batch -ex 'target extended-remote $(BMP)' -ex 'monitor swdp_scan' -ex 'attach 1' -ex load $<
+
+debug-bmp: $(BUILD)/$(PROJECT).elf
+ $(GDB) -ex 'target extended-remote $(BMP)' -ex 'monitor swdp_scan' -ex 'attach 1' $<
#-------------- Artifacts --------------