Added black magic probe flashing support to the example code makefile.

This commit is contained in:
Piotr Esden-Tempski
2011-10-02 01:20:44 -07:00
parent 0a66d52ec8
commit 5d97653163
4 changed files with 25 additions and 0 deletions

View File

@@ -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 = `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