boards/common/stm32-link: add common place for stlink
- introduce common place for boards using stlink: same serial, all use openocd - apply this to nucleos
This commit is contained in:
parent
1c47f9074c
commit
de15af4c87
@ -8,34 +8,12 @@ INCLUDES += -I$(RIOTBOARD)/common/stm32/include
|
||||
# configure the serial terminal
|
||||
PORT_LINUX ?= /dev/ttyACM0
|
||||
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
||||
|
||||
# setup serial terminal
|
||||
include $(RIOTMAKE)/tools/serial.inc.mk
|
||||
|
||||
# all Nucleo boards have an on-board ST-link v2-1 adapter
|
||||
# all Nucleo boards have an on-board ST-link adapter
|
||||
export DEBUG_ADAPTER ?= stlink
|
||||
export STLINK_VERSION ?= 2-1
|
||||
|
||||
# select OpenOCD configuration depending on CPU type
|
||||
ifeq (,$(OPENOCD_CONFIG))
|
||||
ifeq ($(CPU),stm32f0)
|
||||
export OPENOCD_CONFIG := $(RIOTBOARD)/common/nucleo/dist/openocd-f0.cfg
|
||||
else ifeq ($(CPU),stm32f1)
|
||||
export OPENOCD_CONFIG := $(RIOTBOARD)/common/nucleo/dist/openocd-f1.cfg
|
||||
else ifeq ($(CPU),stm32f2)
|
||||
export OPENOCD_CONFIG := $(RIOTBOARD)/common/nucleo/dist/openocd-f2.cfg
|
||||
else ifeq ($(CPU),stm32f3)
|
||||
export OPENOCD_CONFIG := $(RIOTBOARD)/common/nucleo/dist/openocd-f3.cfg
|
||||
else ifeq ($(CPU),stm32f4)
|
||||
export OPENOCD_CONFIG := $(RIOTBOARD)/common/nucleo/dist/openocd-f4.cfg
|
||||
else ifeq ($(CPU),stm32f7)
|
||||
export OPENOCD_CONFIG := $(RIOTBOARD)/common/nucleo/dist/openocd-f7.cfg
|
||||
else ifeq ($(CPU),stm32l0)
|
||||
export OPENOCD_CONFIG := $(RIOTBOARD)/common/nucleo/dist/openocd-l0.cfg
|
||||
else ifeq ($(CPU),stm32l1)
|
||||
export OPENOCD_CONFIG := $(RIOTBOARD)/common/nucleo/dist/openocd-l1.cfg
|
||||
else ifeq ($(CPU),stm32l4)
|
||||
export OPENOCD_CONFIG := $(RIOTBOARD)/common/nucleo/dist/openocd-l4.cfg
|
||||
endif
|
||||
endif
|
||||
|
||||
# this board uses openocd
|
||||
# nucleo boards use openocd
|
||||
include $(RIOTMAKE)/tools/openocd.inc.mk
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
# ST-Link debug adapter
|
||||
# Use st-link v2-1 by default
|
||||
STLINK_VERSION ?= 2-1
|
||||
|
||||
# Use STLINK_VERSION to select which stlink version is used
|
||||
OPENOCD_ADAPTER_INIT ?= \
|
||||
-c 'source [find interface/stlink-v$(STLINK_VERSION).cfg]' \
|
||||
@ -8,3 +11,14 @@ ifneq (,$(DEBUG_ADAPTER_ID))
|
||||
OPENOCD_ADAPTER_INIT += -c 'hla_serial $(DEBUG_ADAPTER_ID)'
|
||||
endif
|
||||
export OPENOCD_ADAPTER_INIT
|
||||
|
||||
# if no openocd specific configuration file, check for default locations:
|
||||
# 1. Using the default dist/openocd.cfg (automatically set by openocd.sh)
|
||||
# 2. Using the common cpu specific config file
|
||||
ifeq (,$(OPENOCD_CONFIG))
|
||||
# if no openocd default configuration is provided by the board,
|
||||
# use the STM32 common one
|
||||
ifeq (0,$(words $(wildcard $(RIOTBOARD)/$(BOARD)/dist/openocd.cfg)))
|
||||
export OPENOCD_CONFIG := $(RIOTBASE)/boards/common/stm32/dist/$(CPU).cfg
|
||||
endif
|
||||
endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user