diff --git a/boards/b-l072z-lrwan1/Makefile.include b/boards/b-l072z-lrwan1/Makefile.include index 4d4531fcd9..3333b64820 100644 --- a/boards/b-l072z-lrwan1/Makefile.include +++ b/boards/b-l072z-lrwan1/Makefile.include @@ -13,7 +13,7 @@ DEBUG_ADAPTER ?= stlink # this board can become un-flashable after a hardfault, # use connect_assert_srst to always be able to flash or reset the board. -export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 +OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/b-l475e-iot01a/Makefile.include b/boards/b-l475e-iot01a/Makefile.include index ee66454f48..8c301d1b74 100644 --- a/boards/b-l475e-iot01a/Makefile.include +++ b/boards/b-l475e-iot01a/Makefile.include @@ -13,7 +13,7 @@ DEBUG_ADAPTER ?= stlink # The board can become un-flashable after some execution, # use connect_assert_srst to always be able to flash or reset the board. -export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 +OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/common/frdm/Makefile.include b/boards/common/frdm/Makefile.include index d220f82f98..8c528f6f2b 100644 --- a/boards/common/frdm/Makefile.include +++ b/boards/common/frdm/Makefile.include @@ -21,7 +21,7 @@ include $(RIOTMAKE)/tools/serial.inc.mk # The board can become un-flashable after some execution, # use connect_assert_srst to always be able to flash or reset the board. -export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 +OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/common/iotlab/Makefile.include b/boards/common/iotlab/Makefile.include index aa1afcaac1..3d87d4c73f 100644 --- a/boards/common/iotlab/Makefile.include +++ b/boards/common/iotlab/Makefile.include @@ -7,7 +7,7 @@ BAUD = 500000 include $(RIOTMAKE)/tools/serial.inc.mk # Using connect_assert_srst removes errors on flash from invalid state -export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 +OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 DEBUG_ADAPTER ?= iotlab diff --git a/boards/i-nucleo-lrwan1/Makefile.include b/boards/i-nucleo-lrwan1/Makefile.include index 02d5c8c0ca..75b3e98cd9 100644 --- a/boards/i-nucleo-lrwan1/Makefile.include +++ b/boards/i-nucleo-lrwan1/Makefile.include @@ -13,7 +13,7 @@ DEBUG_ADAPTER ?= stlink # this board can become un-flashable after a hardfault, # use connect_assert_srst to always be able to flash or reset the boards. -export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 +OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/lsn50/Makefile.include b/boards/lsn50/Makefile.include index d05c0d3417..3c735348ba 100644 --- a/boards/lsn50/Makefile.include +++ b/boards/lsn50/Makefile.include @@ -13,7 +13,7 @@ DEBUG_ADAPTER ?= stlink # this board can become un-flashable after a hardfault, # use connect_assert_srst to always be able to flash or reset the boards. -export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 +OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/pba-d-01-kw2x/Makefile.include b/boards/pba-d-01-kw2x/Makefile.include index bf50e6208b..99174d6d24 100644 --- a/boards/pba-d-01-kw2x/Makefile.include +++ b/boards/pba-d-01-kw2x/Makefile.include @@ -31,7 +31,7 @@ include $(RIOTMAKE)/tools/serial.inc.mk # The board can become un-flashable after some firmware, use connect_assert_srst # to always be able to flash or reset the board. -export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 +OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/stm32f3discovery/Makefile.include b/boards/stm32f3discovery/Makefile.include index 8db56d3fca..2c9ac5007b 100644 --- a/boards/stm32f3discovery/Makefile.include +++ b/boards/stm32f3discovery/Makefile.include @@ -10,7 +10,7 @@ STLINK_VERSION ?= 2 # The board can become un-flashable after some execution, # use connect_assert_srst to always be able to flash or reset the board. -export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 +OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/dist/tools/buildsystem_sanity_check/check.sh b/dist/tools/buildsystem_sanity_check/check.sh index 49265166ca..12798fe7ad 100755 --- a/dist/tools/buildsystem_sanity_check/check.sh +++ b/dist/tools/buildsystem_sanity_check/check.sh @@ -81,7 +81,9 @@ UNEXPORTED_VARIABLES+=('PORT_LINUX' 'PORT_DARWIN') UNEXPORTED_VARIABLES+=('PORT[ ?=:]' 'PORT$') UNEXPORTED_VARIABLES+=('LINKFLAGS' 'LINKER_SCRIPT') UNEXPORTED_VARIABLES+=('USEMODULE_INCLUDES') +UNEXPORTED_VARIABLES+=('OPENOCD_ADAPTER_INIT') UNEXPORTED_VARIABLES+=('OPENOCD_CONFIG') +UNEXPORTED_VARIABLES+=('OPENOCD_RESET_USE_CONNECT_ASSERT_SRST') EXPORTED_VARIABLES_ONLY_IN_VARS=() EXPORTED_VARIABLES_ONLY_IN_VARS+=('APPDEPS') diff --git a/makefiles/boards/stm32.inc.mk b/makefiles/boards/stm32.inc.mk index 57843b6580..c063daa2e3 100644 --- a/makefiles/boards/stm32.inc.mk +++ b/makefiles/boards/stm32.inc.mk @@ -23,7 +23,7 @@ include $(RIOTMAKE)/tools/serial.inc.mk ifeq (openocd,$(PROGRAMMER)) # STM32 boards can become un-flashable after a hardfault, # use connect_assert_srst to always be able to flash or reset the boards. - export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 + OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 # For STM32 boards the ST-link adapter is the default adapter, e.g. all # Nucleo boards have an on-board ST-link adapter diff --git a/makefiles/tools/openocd-adapters/dap.inc.mk b/makefiles/tools/openocd-adapters/dap.inc.mk index c93fc61a9f..e3a2c691a5 100644 --- a/makefiles/tools/openocd-adapters/dap.inc.mk +++ b/makefiles/tools/openocd-adapters/dap.inc.mk @@ -4,4 +4,3 @@ OPENOCD_ADAPTER_INIT ?= -c 'source [find interface/cmsis-dap.cfg]' ifneq (,$(DEBUG_ADAPTER_ID)) OPENOCD_ADAPTER_INIT += -c 'cmsis_dap_serial $(DEBUG_ADAPTER_ID)' endif -export OPENOCD_ADAPTER_INIT diff --git a/makefiles/tools/openocd-adapters/iotlab.inc.mk b/makefiles/tools/openocd-adapters/iotlab.inc.mk index f5d6e84cbf..dfd77d4e00 100644 --- a/makefiles/tools/openocd-adapters/iotlab.inc.mk +++ b/makefiles/tools/openocd-adapters/iotlab.inc.mk @@ -5,4 +5,3 @@ OPENOCD_ADAPTER_INIT ?= -c 'source [find interface/ftdi/iotlab-usb.cfg]' ifneq (,$(DEBUG_ADAPTER_ID)) OPENOCD_ADAPTER_INIT += -c 'ftdi_serial $(DEBUG_ADAPTER_ID)' endif -export OPENOCD_ADAPTER_INIT diff --git a/makefiles/tools/openocd-adapters/jlink.inc.mk b/makefiles/tools/openocd-adapters/jlink.inc.mk index c57e0119d7..ce7137fbc0 100644 --- a/makefiles/tools/openocd-adapters/jlink.inc.mk +++ b/makefiles/tools/openocd-adapters/jlink.inc.mk @@ -4,4 +4,3 @@ OPENOCD_ADAPTER_INIT ?= -c 'source [find interface/jlink.cfg]' ifneq (,$(DEBUG_ADAPTER_ID)) OPENOCD_ADAPTER_INIT += -c 'jlink serial $(DEBUG_ADAPTER_ID)' endif -export OPENOCD_ADAPTER_INIT diff --git a/makefiles/tools/openocd-adapters/mulle.inc.mk b/makefiles/tools/openocd-adapters/mulle.inc.mk index 4e1da73428..347d83a17c 100644 --- a/makefiles/tools/openocd-adapters/mulle.inc.mk +++ b/makefiles/tools/openocd-adapters/mulle.inc.mk @@ -30,4 +30,3 @@ OPENOCD_ADAPTER_INIT ?= -f '$(RIOTBASE)/boards/mulle/dist/openocd/mulle-programm ifneq (,$(DEBUG_ADAPTER_ID)) OPENOCD_ADAPTER_INIT += -c 'ftdi_serial $(DEBUG_ADAPTER_ID)' endif -export OPENOCD_ADAPTER_INIT diff --git a/makefiles/tools/openocd-adapters/stlink.inc.mk b/makefiles/tools/openocd-adapters/stlink.inc.mk index 4dc8a870b9..0e1fcaa1e6 100644 --- a/makefiles/tools/openocd-adapters/stlink.inc.mk +++ b/makefiles/tools/openocd-adapters/stlink.inc.mk @@ -10,7 +10,6 @@ OPENOCD_ADAPTER_INIT ?= \ 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) diff --git a/makefiles/tools/openocd-adapters/sysfs_gpio.inc.mk b/makefiles/tools/openocd-adapters/sysfs_gpio.inc.mk index eed5498bcf..8a221832a5 100644 --- a/makefiles/tools/openocd-adapters/sysfs_gpio.inc.mk +++ b/makefiles/tools/openocd-adapters/sysfs_gpio.inc.mk @@ -11,5 +11,3 @@ OPENOCD_ADAPTER_INIT ?= \ -c 'sysfsgpio_srst_num $(SRST_PIN)' \ -c 'adapter_nsrst_delay 100' \ -c 'adapter_nsrst_assert_width 100' - -export OPENOCD_ADAPTER_INIT diff --git a/makefiles/tools/openocd.inc.mk b/makefiles/tools/openocd.inc.mk index 62cf574da0..a0d962ecbb 100644 --- a/makefiles/tools/openocd.inc.mk +++ b/makefiles/tools/openocd.inc.mk @@ -18,3 +18,9 @@ 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) + +# Export OPENOCD_ADAPTER_INIT to required targets +$(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_ADAPTER_INIT) + +# Export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST to required targets +$(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_RESET_USE_CONNECT_ASSERT_SRST)