1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 06:12:43 +01:00

riotboot: allow to overwrite slot 1

By erasing slot 1 header the slot gets invalidated.
This is very useful while debugging, since we can
force the bootloader to ignore anything on that
slot.
This commit is contained in:
Francisco Acosta 2019-01-02 13:49:18 +01:00
parent ec24ea49b1
commit 8a0a0be426

View File

@ -103,13 +103,27 @@ riotboot/combined-slot0: $(RIOTBOOT_COMBINED_BIN)
$(RIOTBOOT_COMBINED_BIN): $(BOOTLOADER_BIN)/riotboot.extended.bin $(SLOT0_RIOT_BIN)
$(Q)cat $^ > $@
# Flashing rule for edbg to flash combined binaries
RIOTBOOT_EXTENDED_BIN = $(BINDIR_APP)-slot0-extended.bin
# Generate a binary file from slot 0 which covers slot 1 riot_hdr
# in order to invalidate slot 1
$(RIOTBOOT_EXTENDED_BIN): $(RIOTBOOT_COMBINED_BIN)
$(Q)cp $^ $@.tmp
$(Q)truncate -s $$(($(SLOT0_OFFSET) + $(SLOT0_LEN) + $(RIOTBOOT_HDR_LEN))) $@.tmp
$(Q)mv $@.tmp $@
# Flashing rule for edbg to flash combined/extended binaries
riotboot/flash-combined-slot0: HEXFILE=$(RIOTBOOT_COMBINED_BIN)
# Flashing rule for openocd to flash combined binaries
riotboot/flash-extended-slot0: HEXFILE=$(RIOTBOOT_EXTENDED_BIN)
# Flashing rule for openocd to flash combined/extended binaries
riotboot/flash-combined-slot0: ELFFILE=$(RIOTBOOT_COMBINED_BIN)
riotboot/flash-extended-slot0: ELFFILE=$(RIOTBOOT_EXTENDED_BIN)
riotboot/flash-combined-slot0: $(RIOTBOOT_COMBINED_BIN) $(FLASHDEPS)
$(FLASHER) $(FFLAGS)
riotboot/flash-extended-slot0: $(RIOTBOOT_EXTENDED_BIN) $(FLASHDEPS)
$(FLASHER) $(FFLAGS)
# Flashing rule for slot 0
riotboot/flash-slot0: export IMAGE_OFFSET=$(SLOT0_OFFSET)
# Flashing rule for edbg to flash only slot 0