2019-05-17 13:52:34 +02:00
|
|
|
FLASHER ?= $(RIOTTOOLS)/openocd/openocd.sh
|
2020-11-21 22:31:03 +01:00
|
|
|
DEBUGGER ?= $(RIOTTOOLS)/openocd/openocd.sh
|
|
|
|
DEBUGSERVER ?= $(RIOTTOOLS)/openocd/openocd.sh
|
2023-06-10 00:05:35 +02:00
|
|
|
DEBUGCLIENT ?= $(RIOTTOOLS)/openocd/openocd.sh
|
2019-05-17 13:52:34 +02:00
|
|
|
RESET ?= $(RIOTTOOLS)/openocd/openocd.sh
|
2015-05-28 15:08:21 +02:00
|
|
|
|
2018-12-19 19:32:19 +01:00
|
|
|
FLASHFILE ?= $(ELFFILE)
|
2019-05-17 13:52:34 +02:00
|
|
|
FFLAGS ?= flash $(FLASHFILE)
|
2022-05-31 12:39:16 +02:00
|
|
|
DEBUGGER_FLAGS ?= debug $(DEBUG_ELFFILE)
|
2019-05-17 13:52:34 +02:00
|
|
|
DEBUGSERVER_FLAGS ?= debug-server
|
2023-06-10 00:05:35 +02:00
|
|
|
DEBUGCLIENT_FLAGS ?= debug-client $(DEBUG_ELFFILE)
|
2019-05-17 13:52:34 +02:00
|
|
|
RESET_FLAGS ?= reset
|
2017-10-06 14:53:26 +02:00
|
|
|
|
2021-02-18 17:15:55 +01:00
|
|
|
ifneq (,$(OPENOCD_DEBUG_ADAPTER))
|
|
|
|
include $(RIOTMAKE)/tools/openocd-adapters/$(OPENOCD_DEBUG_ADAPTER).inc.mk
|
2024-01-17 09:14:38 +01:00
|
|
|
ifneq (default,$(OPENOCD_TRANSPORT))
|
|
|
|
OPENOCD_ADAPTER_INIT += -c 'transport select $(OPENOCD_TRANSPORT)'
|
|
|
|
endif
|
2017-10-06 14:53:26 +02:00
|
|
|
endif
|
2020-02-22 11:31:39 +01:00
|
|
|
|
2020-04-14 15:23:23 +02:00
|
|
|
OPENOCD_CONFIG ?= $(BOARDDIR)/dist/openocd.cfg
|
2020-02-22 11:31:39 +01:00
|
|
|
|
|
|
|
OPENOCD_TARGETS = debug% flash% reset
|
2020-09-21 18:16:18 +02:00
|
|
|
|
|
|
|
# Export GDB_PORT_CORE_OFFSET to required targets
|
|
|
|
$(call target-export-variables,$(OPENOCD_TARGETS),GDB_PORT_CORE_OFFSET)
|
|
|
|
|
|
|
|
# Export OPENOCD_CONFIG to required targets
|
2020-02-22 11:31:39 +01:00
|
|
|
$(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_CONFIG)
|
2020-02-24 10:25:32 +01:00
|
|
|
|
2020-08-02 23:28:10 +02:00
|
|
|
# Export OPENOCD_CORE to required targets
|
|
|
|
$(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_CORE)
|
|
|
|
|
2020-02-24 11:35:37 +01:00
|
|
|
# Export OPENOCD_ADAPTER_INIT to required targets
|
|
|
|
$(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_ADAPTER_INIT)
|
|
|
|
|
2024-11-08 16:03:17 +01:00
|
|
|
# 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)
|
|
|
|
|
2020-02-24 10:25:32 +01:00
|
|
|
# Export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST to required targets
|
|
|
|
$(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_RESET_USE_CONNECT_ASSERT_SRST)
|
2020-03-26 09:17:04 +01:00
|
|
|
|
2023-06-09 23:52:01 +02:00
|
|
|
ifneq (,$(OPENOCD_SERVER_ADDRESS))
|
|
|
|
# Export OPENOCD_SERVER_ADDRESS to required targets
|
|
|
|
$(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_SERVER_ADDRESS)
|
|
|
|
endif
|
|
|
|
|
2020-03-26 10:00:05 +01:00
|
|
|
ifneq (,$(OPENOCD_CMD_RESET_RUN))
|
|
|
|
# Export OPENOCD_CMD_RESET_RUN only to the reset target
|
|
|
|
$(call target-export-variables,reset,OPENOCD_CMD_RESET_RUN)
|
|
|
|
endif
|
|
|
|
|
2022-12-21 23:17:13 +01:00
|
|
|
ifneq (,$(OPENOCD_CMD_RESET_HALT))
|
|
|
|
# Export OPENOCD_CMD_RESET_HALT only to the flash targets
|
2023-04-25 15:58:34 +02:00
|
|
|
$(call target-export-variables,flash,OPENOCD_CMD_RESET_HALT)
|
|
|
|
$(call target-export-variables,flash-only,OPENOCD_CMD_RESET_HALT)
|
2022-12-21 23:17:13 +01:00
|
|
|
endif
|
|
|
|
|
2023-06-10 00:05:35 +02:00
|
|
|
OPENOCD_DEBUG_TARGETS = debug debugr debug-server debug-client
|
2021-09-28 22:32:18 +02:00
|
|
|
|
|
|
|
ifneq (,$(OPENOCD_DBG_EXTRA_CMD))
|
|
|
|
# Export OPENOCD_DBG_EXTRA_CMD only to the flash/flash-only target
|
|
|
|
$(call target-export-variables,$(OPENOCD_DEBUG_TARGETS),OPENOCD_DBG_EXTRA_CMD)
|
|
|
|
endif
|
|
|
|
|
|
|
|
OPENOCD_FLASH_TARGETS = flash flash-only flashr
|
2020-04-07 11:38:10 +02:00
|
|
|
|
2021-09-28 01:13:45 +02:00
|
|
|
ifneq (,$(IMAGE_OFFSET))
|
|
|
|
# Export IMAGE_OFFSET only to the flash/flash-only target
|
|
|
|
$(call target-export-variables,$(OPENOCD_FLASH_TARGETS),IMAGE_OFFSET)
|
|
|
|
endif
|
|
|
|
|
2024-11-08 16:03:17 +01:00
|
|
|
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
|
|
|
|
|
2020-03-26 09:17:04 +01:00
|
|
|
ifneq (,$(OPENOCD_PRE_VERIFY_CMDS))
|
|
|
|
# Export OPENOCD_PRE_VERIFY_CMDS only to the flash/flash-only target
|
2020-04-07 11:38:10 +02:00
|
|
|
$(call target-export-variables,$(OPENOCD_FLASH_TARGETS),OPENOCD_PRE_VERIFY_CMDS)
|
2020-03-26 09:17:04 +01:00
|
|
|
endif
|
2020-03-26 09:30:23 +01:00
|
|
|
|
2021-09-28 01:26:07 +02:00
|
|
|
ifneq (,$(OPENOCD_SKIP_VERIFY))
|
|
|
|
# Export OPENOCD_SKIP_VERIFY only to the flash/flash-only target
|
|
|
|
$(call target-export-variables,$(OPENOCD_FLASH_TARGETS),OPENOCD_SKIP_VERIFY)
|
|
|
|
endif
|
|
|
|
|
2020-03-26 09:30:23 +01:00
|
|
|
ifneq (,$(OPENOCD_PRE_FLASH_CMDS))
|
|
|
|
# Export OPENOCD_PRE_FLASH_CMDS only to the flash/flash-only targets
|
2020-04-07 11:38:10 +02:00
|
|
|
$(call target-export-variables,$(OPENOCD_FLASH_TARGETS),OPENOCD_PRE_FLASH_CMDS)
|
2020-03-26 09:30:23 +01:00
|
|
|
endif
|
2020-03-26 09:37:05 +01:00
|
|
|
|
2021-02-18 18:18:54 +01:00
|
|
|
ifneq (,$(OPENOCD_PRE_FLASH_CHECK_SCRIPT))
|
|
|
|
# Export OPENOCD_PRE_FLASH_CHECK_SCRIPT only to the flash/flash-only targets
|
|
|
|
$(call target-export-variables,$(OPENOCD_FLASH_TARGETS),OPENOCD_PRE_FLASH_CHECK_SCRIPT)
|
2020-03-26 09:37:05 +01:00
|
|
|
endif
|