Added Black Magic Probe support to the stm32 platform.

Just add BMP_PORT=/dev/ttyACM0 to the ap.upload make call. The script
will try to flash the device using GDB and the BMP.
This commit is contained in:
Piotr Esden-Tempski
2012-02-10 22:50:12 -08:00
parent f2fa4fb8da
commit 5f992174d3
+16 -2
View File
@@ -52,6 +52,7 @@ CP = $(GCC_BIN_PREFIX)-objcopy
DMP = $(GCC_BIN_PREFIX)-objdump DMP = $(GCC_BIN_PREFIX)-objdump
NM = $(GCC_BIN_PREFIX)-nm NM = $(GCC_BIN_PREFIX)-nm
SIZE = $(GCC_BIN_PREFIX)-size SIZE = $(GCC_BIN_PREFIX)-size
GDB = $(GCC_BIN_PREFIX)-gdb
RM = rm RM = rm
# If we can't find the toolchain then try picking up the compilers from the path # If we can't find the toolchain then try picking up the compilers from the path
@@ -62,8 +63,10 @@ CP = $(shell which arm-none-eabi-objcopy)
DMP = $(shell which arm-none-eabi-objdump) DMP = $(shell which arm-none-eabi-objdump)
NM = $(shell which arm-none-eabi-nm) NM = $(shell which arm-none-eabi-nm)
SIZE = $(shell which arm-none-eabi-size) SIZE = $(shell which arm-none-eabi-size)
GDB = $(shell which arm-none-eabi-gdb)
RM = rm RM = rm
GCC_LIB_DIR=$(shell dirname `which arm-none-eabi-gcc`)/../arm-none-eabi/lib TOOLCHAIN_DIR=$(shell dirname `which arm-none-eabi-gcc`)
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/../arm-none-eabi/lib
endif endif
# Detect if we are using the new libopencm3 or the old libopenstm32 # Detect if we are using the new libopencm3 or the old libopenstm32
@@ -250,7 +253,8 @@ ifeq ($(FLASH_MODE),SERIAL)
upload: $(OBJDIR)/$(TARGET).bin upload: $(OBJDIR)/$(TARGET).bin
$(LOADER) -p /dev/ttyUSB0 -b 115200 -e -w -v $^ $(LOADER) -p /dev/ttyUSB0 -b 115200 -e -w -v $^
else ifeq ($(FLASH_MODE),JTAG) else ifeq ($(FLASH_MODE),JTAG)
upload: $(OBJDIR)/$(TARGET).elf ifeq ($(BMP_PORT),)
upload: $(OBJDIR)/$(TARGET).elf
@echo "Using OOCD = $(OOCD)" @echo "Using OOCD = $(OOCD)"
@echo " OOCD\t$<" @echo " OOCD\t$<"
$(Q)$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \ $(Q)$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
@@ -263,6 +267,16 @@ upload: $(OBJDIR)/$(TARGET).elf
-c reset \ -c reset \
-c shutdown -c shutdown
else else
upload: $(OBJDIR)/$(TARGET).elf
@echo "Using Black Magic Probe"
@echo "Using GDB = $(GDB)"
@echo " BMP\t$<"
$(Q)$(GDB) --batch \
-ex 'target extended-remote $(BMP_PORT)' \
-x $(TOOLCHAIN_DIR)/arm-none-eabi/share/libopencm3/scripts/black_magic_probe_flash.scr \
$<
endif
else
upload: upload:
@echo unknown flash_mode $(FLASH_MODE) @echo unknown flash_mode $(FLASH_MODE)
endif endif