diff --git a/makefiles/boot/riotboot.mk b/makefiles/boot/riotboot.mk index 61ebef6fcc..b890760278 100644 --- a/makefiles/boot/riotboot.mk +++ b/makefiles/boot/riotboot.mk @@ -84,7 +84,7 @@ riotboot/flash-bootloader: riotboot/bootloader/flash # avoid circular dependency against clean riotboot/bootloader/%: $$(if $$(filter riotboot/bootloader/clean,$$@),,$$(BUILDDEPS) pkg-prepare) $(Q)/usr/bin/env -i \ - QUIET=$(QUIET) PATH="$(PATH)"\ + QUIET=$(QUIET) PATH="$(PATH)" USER="$(USER)"\ EXTERNAL_BOARD_DIRS="$(EXTERNAL_BOARD_DIRS)" BOARD=$(BOARD)\ DEBUG_ADAPTER_ID=$(DEBUG_ADAPTER_ID) \ IOTLAB_NODE=$(IOTLAB_NODE) \ @@ -155,7 +155,22 @@ riotboot/flash: riotboot/flash-slot0 riotboot/flash-bootloader # make applications that use the riotboot feature default to actually using it # Target 'all' will generate the combined file directly. # It also makes 'flash' and 'flash-only' work without specific command. -FLASHFILE = $(RIOTBOOT_EXTENDED_BIN) +# +# Special case for uf2conv where bootloader and slot0 are both flashed +# independently +ifneq (,$(filter uf2conv,$(PROGRAMMER))) + ifneq (,$(filter riotboot/flash-extended-slot0 riotboot/flash-combined-slot0,$(MAKECMDGOALS))) + $(error riotboot/flash-extended-slot0 riotboot/flash-combined-slot0 are not supported with uf2conv) + endif + FLASHFILE = $(BOOTLOADER_BIN)/riotboot.bin + riotboot/flash-slot0-remount: riotboot/flash-slot0 + sleep $(TERM_DELAY) + $(PREFLASHER_PREFIX)$(PREFLASHER) $(PREFFLAGS) + sleep $(PREFLASH_DELAY) + flash: riotboot/flash-slot0-remount +else + FLASHFILE = $(RIOTBOOT_EXTENDED_BIN) +endif else riotboot: diff --git a/makefiles/tools/uf2conv.inc.mk b/makefiles/tools/uf2conv.inc.mk index c2a952e939..5be8b45493 100644 --- a/makefiles/tools/uf2conv.inc.mk +++ b/makefiles/tools/uf2conv.inc.mk @@ -1,7 +1,9 @@ FLASHFILE ?= $(HEXFILE) +IMAGE_OFFSET ?= $(ROM_OFFSET) + FLASHER ?= $(RIOTTOOLS)/uf2/uf2conv.py -FFLAGS ?= $(UF2CONV_FLAGS) $(FLASHFILE) +FFLAGS ?= $(UF2CONV_FLAGS) $(FLASHFILE) --base $(IMAGE_OFFSET) PREFLASH_DELAY ?= 2