From 20ae600c43e1f18df168b688274748cfcdf7696c Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 23 Jan 2025 18:01:54 +0100 Subject: [PATCH] makefiles: add FAST_FLASH option - flash slot0-combined.bin instead of slot0-extended.bin - don't read back image after flashing --- dist/tools/edbg/edbg.sh | 17 ++++++++++++++++- makefiles/boot/riotboot.mk | 6 +++++- makefiles/tools/edbg.inc.mk | 6 +++++- makefiles/tools/openocd.inc.mk | 4 ++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/dist/tools/edbg/edbg.sh b/dist/tools/edbg/edbg.sh index f3e194ba36df..98ce5161e097 100755 --- a/dist/tools/edbg/edbg.sh +++ b/dist/tools/edbg/edbg.sh @@ -17,6 +17,17 @@ do_flash() { IMAGE_FILE=$1 test_imagefile + # Configure edbg flash flags + local _fflags="${EDBG_ARGS} --verbose --file ${IMAGE_FILE}" + + # flash device + sh -c "${EDBG} ${_fflags} --program" && echo 'Done flashing' +} + +do_flash_verify() { + IMAGE_FILE=$1 + test_imagefile + # Configure edbg flash flags local _fflags="${EDBG_ARGS} --verbose --file ${IMAGE_FILE} --verify" @@ -36,9 +47,13 @@ shift # pop $1 from $@ case "${ACTION}" in flash) - echo "### Flashing Target ###" + echo "### Flashing Target (quick) ###" do_flash "$@" ;; + flash_verify) + echo "### Flashing Target ###" + do_flash_verify "$@" + ;; reset) echo "### Resetting Target ###" do_reset diff --git a/makefiles/boot/riotboot.mk b/makefiles/boot/riotboot.mk index e973bfc5c66a..f493d9f2c53e 100644 --- a/makefiles/boot/riotboot.mk +++ b/makefiles/boot/riotboot.mk @@ -173,7 +173,11 @@ ifneq (,$(filter uf2conv,$(PROGRAMMER))) sleep $(PREFLASH_DELAY) flash: riotboot/flash-slot0-remount else - FLASHFILE = $(RIOTBOOT_EXTENDED_BIN) + ifeq (1, $(FAST_FLASH)) + FLASHFILE = $(RIOTBOOT_COMBINED_BIN) + else + FLASHFILE = $(RIOTBOOT_EXTENDED_BIN) + endif endif else diff --git a/makefiles/tools/edbg.inc.mk b/makefiles/tools/edbg.inc.mk index 75137f9c1497..dc270db7e58b 100644 --- a/makefiles/tools/edbg.inc.mk +++ b/makefiles/tools/edbg.inc.mk @@ -28,7 +28,11 @@ $(call target-export-variables,$(EDBG_TARGETS),EDBG_ARGS) # Set flasher and reset for the RIOT build system FLASHER ?= $(RIOTTOOLS)/edbg/edbg.sh -FFLAGS ?= flash $(FLASHFILE) +ifeq (1, $(FAST_FLASH)) + FFLAGS ?= flash $(FLASHFILE) +else + FFLAGS ?= flash_verify $(FLASHFILE) +endif RESET ?= $(RIOTTOOLS)/edbg/edbg.sh RESET_FLAGS ?= reset diff --git a/makefiles/tools/openocd.inc.mk b/makefiles/tools/openocd.inc.mk index f3b4599889d7..55defade84e6 100644 --- a/makefiles/tools/openocd.inc.mk +++ b/makefiles/tools/openocd.inc.mk @@ -18,6 +18,10 @@ ifneq (,$(OPENOCD_DEBUG_ADAPTER)) endif endif +ifeq (1, $(FAST_FLASH)) + OPENOCD_SKIP_VERIFY = 1 +endif + OPENOCD_CONFIG ?= $(BOARDDIR)/dist/openocd.cfg OPENOCD_TARGETS = debug% flash% reset