diff --git a/cpu/esp32/Makefile.include b/cpu/esp32/Makefile.include index f8dd0b2fcb..229687157f 100644 --- a/cpu/esp32/Makefile.include +++ b/cpu/esp32/Makefile.include @@ -90,4 +90,6 @@ ifneq (,$(filter esp_jtag,$(USEMODULE))) IMAGE_OFFSET = 0x10000 # Flash checksumming not supported on xtensa OPENOCD_SKIP_VERIFY = yes + # Without resets debug target fails with 'Target not examined yet' + OPENOCD_DBG_EXTRA_CMD += -c 'reset halt' endif diff --git a/makefiles/tools/openocd.inc.mk b/makefiles/tools/openocd.inc.mk index 2f23225e03..14c7cc1c60 100644 --- a/makefiles/tools/openocd.inc.mk +++ b/makefiles/tools/openocd.inc.mk @@ -49,7 +49,14 @@ ifneq (,$(OPENOCD_CMD_RESET_RUN)) $(call target-export-variables,reset,OPENOCD_CMD_RESET_RUN) endif -OPENOCD_FLASH_TARGETS = flash flash-only +OPENOCD_DEBUG_TARGETS = debug debugr debug-server + +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 ifneq (,$(IMAGE_OFFSET)) # Export IMAGE_OFFSET only to the flash/flash-only target