Skip to content

Commit

Permalink
makefiles/tools/uf2conv.inc.mk: partial riotboot support
Browse files Browse the repository at this point in the history
Individual files need to be converted to uf2 format, targets
flashing individual slots or the bootloader will work:

- riotboot/flash-slot%
- riotboot/flash-bootloader

'flash' also works by flashing both the bootloader and slot0
independently.

But not targets flashing combined/extended versions since conversion
of the blob is not possible with the uf2conv.py script.
  • Loading branch information
fjmolinas committed Jun 1, 2022
1 parent c4e202a commit a945ea1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
19 changes: 17 additions & 2 deletions makefiles/boot/riotboot.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion makefiles/tools/uf2conv.inc.mk
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit a945ea1

Please sign in to comment.