diff --git a/boards/adafruit-clue/Makefile.include b/boards/adafruit-clue/Makefile.include index 50cd70b7ab..5bff4c0f44 100644 --- a/boards/adafruit-clue/Makefile.include +++ b/boards/adafruit-clue/Makefile.include @@ -8,18 +8,5 @@ ifeq ($(PROGRAMMER),adafruit-nrfutil) # The preinstalled bootloader must also be taken into account so # ROM_OFFSET skips the space taken by such bootloader. ROM_OFFSET = 0x26000 - - ifneq (,$(filter reset flash flash-only, $(MAKECMDGOALS))) - # Add 2 seconds delay before opening terminal: this is required when opening - # the terminal right after flashing. In this case, the stdio over USB needs - # some time after reset before being ready. - TERM_DELAY = 2 - TERMDEPS += term-delay - endif + include $(RIOTMAKE)/tools/usb_board_reset.mk endif - -term-delay: - sleep $(TERM_DELAY) - -TESTRUNNER_CONNECT_DELAY ?= $(TERM_DELAY) -$(call target-export-variables,test,TESTRUNNER_CONNECT_DELAY) diff --git a/makefiles/tools/usb_board_reset.mk b/makefiles/tools/usb_board_reset.mk index fbc6dd4bbe..be2e30ce12 100644 --- a/makefiles/tools/usb_board_reset.mk +++ b/makefiles/tools/usb_board_reset.mk @@ -28,8 +28,12 @@ RESET ?= $(PREFLASHER) $(RESETFFLASG) TESTRUNNER_CONNECT_DELAY ?= $(TERM_DELAY) $(call target-export-variables,test,TESTRUNNER_CONNECT_DELAY) +ifneq (,$(filter flash flash-only,$(MAKECMDGOALS))) preflash-delay: preflash sleep $(PREFLASH_DELAY) +endif +ifneq (,$(filter term,$(MAKECMDGOALS))) term-delay: $(TERMDELAYDEPS) sleep $(TERM_DELAY) +endif