Skip to content
Snippets Groups Projects
Unverified Commit 4e1f07b8 authored by Alexandre Abadie's avatar Alexandre Abadie Committed by GitHub
Browse files

Merge pull request #8475 from aabadie/pr/common-stlink

boards/stm32: use common place of openocd config files for all boards using stlink
parents 77a8aee6 265c152e
No related branches found
No related tags found
No related merge requests found
Showing
with 21 additions and 41 deletions
...@@ -9,8 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) ...@@ -9,8 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
# setup serial terminal # setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk include $(RIOTMAKE)/tools/serial.inc.mk
# this board has an on-board ST-link adapter
export DEBUG_ADAPTER ?= stlink export DEBUG_ADAPTER ?= stlink
export STLINK_VERSION ?= 2-1
# call a 'reset halt' command before starting the debugger # call a 'reset halt' command before starting the debugger
export OPENOCD_DBG_START_CMD = -c 'reset halt' export OPENOCD_DBG_START_CMD = -c 'reset halt'
......
...@@ -9,8 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) ...@@ -9,8 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
# setup serial terminal # setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk include $(RIOTMAKE)/tools/serial.inc.mk
# this board has an on-board ST-link adapter
export DEBUG_ADAPTER ?= stlink export DEBUG_ADAPTER ?= stlink
export STLINK_VERSION ?= 2-1
# this board uses openocd # this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk include $(RIOTMAKE)/tools/openocd.inc.mk
source [find target/stm32l4x.cfg]
reset_config srst_only
...@@ -8,34 +8,12 @@ INCLUDES += -I$(RIOTBOARD)/common/stm32/include ...@@ -8,34 +8,12 @@ INCLUDES += -I$(RIOTBOARD)/common/stm32/include
# configure the serial terminal # configure the serial terminal
PORT_LINUX ?= /dev/ttyACM0 PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk 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 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 include $(RIOTMAKE)/tools/openocd.inc.mk
...@@ -10,7 +10,6 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) ...@@ -10,7 +10,6 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
include $(RIOTMAKE)/tools/serial.inc.mk include $(RIOTMAKE)/tools/serial.inc.mk
export DEBUG_ADAPTER ?= stlink export DEBUG_ADAPTER ?= stlink
export STLINK_VERSION ?= 2-1
# this board uses openocd # this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk include $(RIOTMAKE)/tools/openocd.inc.mk
source [find target/stm32f1x.cfg]
reset_config srst_only
source [find target/stm32f3x.cfg]
reset_config srst_only
$_TARGETNAME configure -rtos auto
...@@ -9,8 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) ...@@ -9,8 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# setup serial terminal # setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk include $(RIOTMAKE)/tools/serial.inc.mk
# this board has an on-board ST-link adapter
export DEBUG_ADAPTER ?= stlink export DEBUG_ADAPTER ?= stlink
export STLINK_VERSION ?= 2-1
# this board uses openocd # this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk include $(RIOTMAKE)/tools/openocd.inc.mk
# ST-Link debug adapter # 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 # Use STLINK_VERSION to select which stlink version is used
OPENOCD_ADAPTER_INIT ?= \ OPENOCD_ADAPTER_INIT ?= \
-c 'source [find interface/stlink-v$(STLINK_VERSION).cfg]' \ -c 'source [find interface/stlink-v$(STLINK_VERSION).cfg]' \
...@@ -8,3 +11,14 @@ ifneq (,$(DEBUG_ADAPTER_ID)) ...@@ -8,3 +11,14 @@ ifneq (,$(DEBUG_ADAPTER_ID))
OPENOCD_ADAPTER_INIT += -c 'hla_serial $(DEBUG_ADAPTER_ID)' OPENOCD_ADAPTER_INIT += -c 'hla_serial $(DEBUG_ADAPTER_ID)'
endif endif
export OPENOCD_ADAPTER_INIT 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment