Skip to content

Commit

Permalink
Merge pull request #13452 from aabadie/pr/tools/openocd_config_export
Browse files Browse the repository at this point in the history
tools/openocd: only export OPENOCD_CONFIG to required targets
  • Loading branch information
kaspar030 authored Feb 25, 2020
2 parents ab333f3 + 99d1404 commit f451eb6
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion boards/blackpill-128kib/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export OPENOCD_CONFIG ?= $(RIOTBOARD)/common/blxxxpill/dist/openocd-128kib.cfg
OPENOCD_CONFIG ?= $(RIOTBOARD)/common/blxxxpill/dist/openocd-128kib.cfg

include $(RIOTBOARD)/common/blxxxpill/Makefile.include
2 changes: 1 addition & 1 deletion boards/blackpill/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export OPENOCD_CONFIG ?= $(RIOTBOARD)/common/blxxxpill/dist/openocd.cfg
OPENOCD_CONFIG ?= $(RIOTBOARD)/common/blxxxpill/dist/openocd.cfg

include $(RIOTBOARD)/common/blxxxpill/Makefile.include
2 changes: 1 addition & 1 deletion boards/bluepill-128kib/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export OPENOCD_CONFIG ?= $(RIOTBOARD)/common/blxxxpill/dist/openocd-128kib.cfg
OPENOCD_CONFIG ?= $(RIOTBOARD)/common/blxxxpill/dist/openocd-128kib.cfg

include $(RIOTBOARD)/common/blxxxpill/Makefile.include
2 changes: 1 addition & 1 deletion boards/bluepill/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export OPENOCD_CONFIG ?= $(RIOTBOARD)/common/blxxxpill/dist/openocd.cfg
OPENOCD_CONFIG ?= $(RIOTBOARD)/common/blxxxpill/dist/openocd.cfg

include $(RIOTBOARD)/common/blxxxpill/Makefile.include
2 changes: 1 addition & 1 deletion boards/common/frdm/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DEBUG_ADAPTER ?= dap
# For KW41Z, an OpenOCD version built from source is required. The support for
# kw41z was introduced in
# https://github.com/ntfreak/openocd/2c8602ed9f084d6680cec7d0ca1d5dc71c865a5f
export OPENOCD_CONFIG ?= $(RIOTBOARD)/common/frdm/dist/openocd-$(CPU_FAMILY).cfg
OPENOCD_CONFIG ?= $(RIOTBOARD)/common/frdm/dist/openocd-$(CPU_FAMILY).cfg

# Check the flash configuration field before flashing
export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield.sh
Expand Down
2 changes: 1 addition & 1 deletion boards/common/iotlab/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1

DEBUG_ADAPTER ?= iotlab

export OPENOCD_CONFIG ?= $(RIOTBOARD)/common/iotlab/dist/openocd.cfg
OPENOCD_CONFIG ?= $(RIOTBOARD)/common/iotlab/dist/openocd.cfg

# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk
Expand Down
2 changes: 1 addition & 1 deletion boards/common/nrf51/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endif

ifeq ($(PROGRAMMER),openocd)
# use common openocd configuration for nrf51
export OPENOCD_CONFIG = $(RIOTBOARD)/common/nrf51/dist/openocd.cfg
OPENOCD_CONFIG = $(RIOTBOARD)/common/nrf51/dist/openocd.cfg
include $(RIOTMAKE)/tools/openocd.inc.mk
else ifeq ($(PROGRAMMER),jlink)
# setup JLink for flashing
Expand Down
2 changes: 1 addition & 1 deletion boards/common/nrf52/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ else ifeq (openocd,$(PROGRAMMER))
$(BINDIR)/softdevice.hex: | $(ELFFILE)
endif
DEBUG_ADAPTER ?= jlink
export OPENOCD_CONFIG := $(RIOTBOARD)/common/nrf52/dist/openocd.cfg
OPENOCD_CONFIG = $(RIOTBOARD)/common/nrf52/dist/openocd.cfg
include $(RIOTMAKE)/tools/openocd.inc.mk
endif
2 changes: 0 additions & 2 deletions boards/hifive1/dist/flasher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
# @author Hauke Peteresen <hauke.petersen@fu-berlin.de>
# @author Joakim Nohlgård <joakim.nohlgard@eistec.se>

# Default path to OpenOCD configuration file
: ${OPENOCD_CONFIG:=${RIOTBOARD}/${BOARD}/dist/openocd.cfg}
# Default OpenOCD command
: ${OPENOCD:=openocd}
# This is an optional offset to the base address that can be used to flash an
Expand Down
1 change: 1 addition & 0 deletions dist/tools/buildsystem_sanity_check/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ UNEXPORTED_VARIABLES+=('PORT_LINUX' 'PORT_DARWIN')
UNEXPORTED_VARIABLES+=('PORT[ ?=:]' 'PORT$')
UNEXPORTED_VARIABLES+=('LINKFLAGS' 'LINKER_SCRIPT')
UNEXPORTED_VARIABLES+=('USEMODULE_INCLUDES')
UNEXPORTED_VARIABLES+=('OPENOCD_CONFIG')

EXPORTED_VARIABLES_ONLY_IN_VARS=()
EXPORTED_VARIABLES_ONLY_IN_VARS+=('CPU_ARCH')
Expand Down
2 changes: 0 additions & 2 deletions dist/tools/openocd/openocd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@
: ${TELNET_PORT:=4444}
# Default TCL port, set to 0 to disable
: ${TCL_PORT:=6333}
# Default path to OpenOCD configuration file
: ${OPENOCD_CONFIG:=${BOARDSDIR}/${BOARD}/dist/openocd.cfg}
# Default OpenOCD command
: ${OPENOCD:=openocd}
# Extra board initialization commands to pass to OpenOCD
Expand Down
2 changes: 1 addition & 1 deletion makefiles/tools/openocd-adapters/stlink.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ ifeq (,$(OPENOCD_CONFIG))
# if no openocd default configuration is provided by the board,
# use the STM32 common one
ifeq (0,$(words $(wildcard $(BOARDSDIR)/$(BOARD)/dist/openocd.cfg)))
export OPENOCD_CONFIG := $(RIOTBASE)/boards/common/stm32/dist/$(CPU).cfg
OPENOCD_CONFIG = $(RIOTBASE)/boards/common/stm32/dist/$(CPU).cfg
endif
endif
6 changes: 6 additions & 0 deletions makefiles/tools/openocd.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ RESET_FLAGS ?= reset
ifneq (,$(DEBUG_ADAPTER))
include $(RIOTMAKE)/tools/openocd-adapters/$(DEBUG_ADAPTER).inc.mk
endif

OPENOCD_CONFIG ?= $(BOARDSDIR)/$(BOARD)/dist/openocd.cfg

# Export OPENOCD_CONFIG to required targets
OPENOCD_TARGETS = debug% flash% reset
$(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_CONFIG)

0 comments on commit f451eb6

Please sign in to comment.