From 5ba95ed8579005e85d24420217393cfa4db124db Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Mon, 24 Feb 2020 10:25:32 +0100 Subject: [PATCH 1/6] makefiles/openocd: export OPENOCD_RESET_USE... to required targets --- makefiles/tools/openocd.inc.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/makefiles/tools/openocd.inc.mk b/makefiles/tools/openocd.inc.mk index 62cf574da0..a3e0d12b07 100644 --- a/makefiles/tools/openocd.inc.mk +++ b/makefiles/tools/openocd.inc.mk @@ -18,3 +18,6 @@ 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_RESET_USE_CONNECT_ASSERT_SRST to required targets +$(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_RESET_USE_CONNECT_ASSERT_SRST) From f1ba22534a1bb1bd06e7f3019ff1733d8db68b20 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Mon, 24 Feb 2020 10:26:14 +0100 Subject: [PATCH 2/6] boards: don't export globally OPENOCD_RESET_USE... --- boards/b-l072z-lrwan1/Makefile.include | 2 +- boards/b-l475e-iot01a/Makefile.include | 2 +- boards/common/frdm/Makefile.include | 2 +- boards/common/iotlab/Makefile.include | 2 +- boards/i-nucleo-lrwan1/Makefile.include | 2 +- boards/lsn50/Makefile.include | 2 +- boards/pba-d-01-kw2x/Makefile.include | 2 +- boards/stm32f3discovery/Makefile.include | 2 +- makefiles/boards/stm32.inc.mk | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) 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 137b5946c0..4f3b32aa1e 100644 --- a/boards/common/iotlab/Makefile.include +++ b/boards/common/iotlab/Makefile.include @@ -7,7 +7,7 @@ export 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/makefiles/boards/stm32.inc.mk b/makefiles/boards/stm32.inc.mk index 1240568d88..d0326b4a17 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 From 39733a5c303b8238e904c68feb6e80ae70fa947c Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Mon, 24 Feb 2020 11:26:24 +0100 Subject: [PATCH 3/6] ci/buildsystem_check: ensure OPENOCD_RESET... is not exported --- dist/tools/buildsystem_sanity_check/check.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/tools/buildsystem_sanity_check/check.sh b/dist/tools/buildsystem_sanity_check/check.sh index 43841a986b..4672ae9d0a 100755 --- a/dist/tools/buildsystem_sanity_check/check.sh +++ b/dist/tools/buildsystem_sanity_check/check.sh @@ -82,6 +82,7 @@ UNEXPORTED_VARIABLES+=('PORT[ ?=:]' 'PORT$') UNEXPORTED_VARIABLES+=('LINKFLAGS' 'LINKER_SCRIPT') UNEXPORTED_VARIABLES+=('USEMODULE_INCLUDES') UNEXPORTED_VARIABLES+=('OPENOCD_CONFIG') +UNEXPORTED_VARIABLES+=('OPENOCD_RESET_USE_CONNECT_ASSERT_SRST') EXPORTED_VARIABLES_ONLY_IN_VARS=() EXPORTED_VARIABLES_ONLY_IN_VARS+=('CPU_ARCH') From 54dbb5fce0f34c3ee1ecdd1c18aa7100d0d6a1e4 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Mon, 24 Feb 2020 11:35:37 +0100 Subject: [PATCH 4/6] makefiles/openocd: export OPENOCD_ADAPTER_INIT to required target --- makefiles/tools/openocd.inc.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/makefiles/tools/openocd.inc.mk b/makefiles/tools/openocd.inc.mk index a3e0d12b07..a0d962ecbb 100644 --- a/makefiles/tools/openocd.inc.mk +++ b/makefiles/tools/openocd.inc.mk @@ -19,5 +19,8 @@ OPENOCD_CONFIG ?= $(BOARDSDIR)/$(BOARD)/dist/openocd.cfg 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) From 1df314d25e508e2b7a2dd245e8f10401dcbfe221 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Mon, 24 Feb 2020 11:35:59 +0100 Subject: [PATCH 5/6] makefiles/openocd-adapters: don't export OPENOCD_ADAPTER_INIT --- makefiles/tools/openocd-adapters/dap.inc.mk | 1 - makefiles/tools/openocd-adapters/iotlab.inc.mk | 1 - makefiles/tools/openocd-adapters/jlink.inc.mk | 1 - makefiles/tools/openocd-adapters/mulle.inc.mk | 1 - makefiles/tools/openocd-adapters/stlink.inc.mk | 1 - makefiles/tools/openocd-adapters/sysfs_gpio.inc.mk | 2 -- 6 files changed, 7 deletions(-) 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 From b27ae335af180ca0b2b3f3b44103e2b9dca0b9ac Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Mon, 24 Feb 2020 11:36:20 +0100 Subject: [PATCH 6/6] ci/buildsystem_check: ensure OPENOCD_ADAPTER_INIT is not exported --- dist/tools/buildsystem_sanity_check/check.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/tools/buildsystem_sanity_check/check.sh b/dist/tools/buildsystem_sanity_check/check.sh index 4672ae9d0a..594e93dd17 100755 --- a/dist/tools/buildsystem_sanity_check/check.sh +++ b/dist/tools/buildsystem_sanity_check/check.sh @@ -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_ADAPTER_INIT') UNEXPORTED_VARIABLES+=('OPENOCD_CONFIG') UNEXPORTED_VARIABLES+=('OPENOCD_RESET_USE_CONNECT_ASSERT_SRST')