diff --git a/dist/tools/openocd/openocd.sh b/dist/tools/openocd/openocd.sh index ebe73da4f5..5ea5d40722 100755 --- a/dist/tools/openocd/openocd.sh +++ b/dist/tools/openocd/openocd.sh @@ -346,6 +346,7 @@ do_flash() { -c 'telnet_port 0' \ -c 'gdb_port 0' \ -c 'init' \ + ${OPENOCD_POST_INIT_CMDS} \ -c 'targets' \ ${OPENOCD_CMD_RESET_HALT} \ ${OPENOCD_PRE_FLASH_CMDS} \ diff --git a/makefiles/tools/openocd.inc.mk b/makefiles/tools/openocd.inc.mk index 4d01fb0174..f3b4599889 100644 --- a/makefiles/tools/openocd.inc.mk +++ b/makefiles/tools/openocd.inc.mk @@ -34,6 +34,12 @@ $(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_CORE) # Export OPENOCD_ADAPTER_INIT to required targets $(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_ADAPTER_INIT) +# Export OPENOCD_EXTRA_INIT to required targets +$(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_EXTRA_INIT) + +# Export OPENOCD_EXTRA_RESET_INIT to required targets +$(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_EXTRA_RESET_INIT) + # Export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST to required targets $(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_RESET_USE_CONNECT_ASSERT_SRST) @@ -67,6 +73,11 @@ ifneq (,$(IMAGE_OFFSET)) $(call target-export-variables,$(OPENOCD_FLASH_TARGETS),IMAGE_OFFSET) endif +ifneq (,$(OPENOCD_POST_INIT_CMDS)) + # Export OPENOCD_POST_INIT_CMDS only to the flash/flash-only target + $(call target-export-variables,$(OPENOCD_FLASH_TARGETS),OPENOCD_POST_INIT_CMDS) +endif + ifneq (,$(OPENOCD_PRE_VERIFY_CMDS)) # Export OPENOCD_PRE_VERIFY_CMDS only to the flash/flash-only target $(call target-export-variables,$(OPENOCD_FLASH_TARGETS),OPENOCD_PRE_VERIFY_CMDS)