aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPiotr Esden-Tempski2011-10-29 15:06:11 -0700
committerPiotr Esden-Tempski2011-10-29 15:29:12 -0700
commit8ba610e80a9fdd385b14cf3cc7002a56663afb5c (patch)
treefc11eff1f51cac81d7db4acf268bf595f09749ad /examples
parentffba9f84e03dae792190d6acbf218df7795da2b8 (diff)
Readded black magic probe support to example makefiles.
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32f1/Makefile.include13
-rw-r--r--examples/stm32f2/Makefile.include13
2 files changed, 26 insertions, 0 deletions
diff --git a/examples/stm32f1/Makefile.include b/examples/stm32f1/Makefile.include
index 2edd255..8420cc8 100644
--- a/examples/stm32f1/Makefile.include
+++ b/examples/stm32f1/Makefile.include
@@ -24,6 +24,7 @@ CC = $(PREFIX)-gcc
LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump
+GDB = $(PREFIX)-gdb
# Uncomment this line if you want to use the installed (not local) library.
#TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
TOOLCHAIN_DIR = ../../../..
@@ -38,6 +39,9 @@ OBJS += $(BINARY).o
OOCD ?= openocd
OOCD_INTERFACE ?= flossjtag
OOCD_BOARD ?= olimex_stm32_h103
+# Black magic probe specific variables
+# Set the BMP_PORT to a serial port and then BMP is used for flashing
+BMP_PORT ?=
# Be silent per default, but 'make V=1' will show all compiler calls.
ifneq ($(V),1)
@@ -92,6 +96,7 @@ clean:
$(Q)rm -f *.srec
$(Q)rm -f *.list
+ifeq ($(BMP_PORT),)
ifeq ($(OOCD_SERIAL),)
%.flash: %.hex
@printf " FLASH $<\n"
@@ -116,6 +121,14 @@ else
-c "reset" \
-c "shutdown" $(NULL)
endif
+else
+%.flash: %.elf
+ @echo " GDB $(*).elf (flash)"
+ $(Q)$(GDB) --batch \
+ -ex 'target extended-remote $(BMP_PORT)' \
+ -x $(TOOLCHAIN_DIR)/scripts/black_magic_probe_flash.scr \
+ $(*).elf
+endif
.PHONY: images clean
diff --git a/examples/stm32f2/Makefile.include b/examples/stm32f2/Makefile.include
index 3539cdd..3f5bf9d 100644
--- a/examples/stm32f2/Makefile.include
+++ b/examples/stm32f2/Makefile.include
@@ -25,6 +25,7 @@ CC = $(PREFIX)-gcc
LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump
+GDB = $(PREFIX)-gdb
# Uncomment this line if you want to use the installed (not local) library.
#TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
TOOLCHAIN_DIR = ../../../..
@@ -40,6 +41,9 @@ OBJS += $(BINARY).o
OOCD ?= openocd
OOCD_INTERFACE ?= flossjtag
OOCD_BOARD ?= olimex_stm32_h103
+# Black magic probe specific variables
+# Set the BMP_PORT to a serial port and then BMP is used for flashing
+BMP_PORT ?=
# Be silent per default, but 'make V=1' will show all compiler calls.
ifneq ($(V),1)
@@ -94,6 +98,7 @@ clean:
$(Q)rm -f *.srec
$(Q)rm -f *.list
+ifeq ($(BMP_PORT),)
ifeq ($(OOCD_SERIAL),)
%.flash: %.hex
@printf " FLASH $<\n"
@@ -118,6 +123,14 @@ else
-c "reset" \
-c "shutdown" $(NULL)
endif
+else
+%.flash: %.elf
+ @echo " GDB $(*).elf (flash)"
+ $(Q)$(GDB) --batch \
+ -ex 'target extended-remote $(BMP_PORT)' \
+ -x $(TOOLCHAIN_DIR)/scripts/black_magic_probe_flash.scr \
+ $(*).elf
+endif
.PHONY: images clean