1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 01:05:27 +03:00

Merge pull request #3627 from fishpepper/openocd

adding openocd-gdb command to makefile
This commit is contained in:
Martin Budden 2017-07-26 06:29:26 +01:00 committed by GitHub
commit b3270111a9
2 changed files with 27 additions and 0 deletions

View file

@ -131,6 +131,9 @@ VPATH := $(VPATH):$(ROOT)/make
# start specific includes
include $(ROOT)/make/mcu/$(TARGET_MCU).mk
# openocd specific includes
include $(ROOT)/make/openocd.mk
# Configure default flash sizes for the targets (largest size specified gets hit first) if flash not specified already.
ifeq ($(FLASH_SIZE),)
ifneq ($(TARGET_FLASH),)
@ -180,6 +183,7 @@ endif
# Tool names
CROSS_CC := $(CCACHE) $(ARM_SDK_PREFIX)gcc
CROSS_CXX := $(CCACHE) $(ARM_SDK_PREFIX)g++
CROSS_GDB := $(ARM_SDK_PREFIX)gdb
OBJCOPY := $(ARM_SDK_PREFIX)objcopy
OBJDUMP := $(ARM_SDK_PREFIX)objdump
SIZE := $(ARM_SDK_PREFIX)size
@ -383,6 +387,11 @@ st-flash_$(TARGET): $(TARGET_BIN)
## st-flash : flash firmware (.bin) onto flight controller
st-flash: st-flash_$(TARGET)
ifneq ($(OPENOCD_COMMAND),)
openocd-gdb: $(TARGET_ELF)
$(V0) $(OPENOCD_COMMAND) & $(CROSS_GDB) $(TARGET_ELF) -ex "target remote localhost:3333" -ex "load"
endif
binary:
$(V0) $(MAKE) -j $(TARGET_BIN)

18
make/openocd.mk Normal file
View file

@ -0,0 +1,18 @@
OPENOCD ?= openocd
OPENOCD_IF ?= interface/stlink-v2.cfg
ifeq ($(TARGET_MCU),STM32F3)
OPENOCD_CFG := target/stm32f3x.cfg
else ifeq ($(TARGET_MCU),STM32F4)
OPENOCD_CFG := target/stm32f34.cfg
else ifeq ($(TARGET_MCU),STM32F7)
OPENOCD_CFG := target/stm32f7x.cfg
else
endif
ifneq ($(OPENOCD_CFG),)
OPENOCD_COMMAND = $(OPENOCD) -f $(OPENOCD_IF) -f $(OPENOCD_CFG)
endif