Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,11 @@ ELFFILE ?= $(BINDIR)/$(APPLICATION).elf
HEXFILE ?= $(ELFFILE:.elf=.hex)
BINFILE ?= $(ELFFILE:.elf=.bin)

# include bootloaders support. It should be included early to allow using
# variables defined in `riotboot.mk` for `FLASHFILE` before it is evaluated.
# It should be included after defining 'BINFILE' for 'riotboot.bin' handling.
include $(RIOTMAKE)/boot/riotboot.mk

# Targets to get given file
elffile: $(ELFFILE)
hexfile: $(HEXFILE)
Expand Down Expand Up @@ -442,11 +447,6 @@ else
_LINK = $(if $(CPPMIX),$(LINKXX),$(LINK)) $(UNDEF) $(LINKFLAGPREFIX)--start-group $(BASELIBS) -lm $(LINKFLAGPREFIX)--end-group $(LINKFLAGS) $(LINKFLAGPREFIX)-Map=$(BINDIR)/$(APPLICATION).map
endif # BUILDOSXNATIVE

# include bootloaders support. When trying to overwrite one variable
# like HEXFILE, the value will already have been evaluated when declaring
# the link target. Therefore, it must be placed before `link`.
include $(RIOTMAKE)/boot/riotboot.mk

ifeq ($(BUILD_IN_DOCKER),1)
link: ..in-docker-container
else
Expand Down
8 changes: 6 additions & 2 deletions makefiles/boot/riotboot.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ SLOT0_RIOT_BIN = $(BINDIR_APP)-slot0.riot.bin
SLOT1_RIOT_BIN = $(BINDIR_APP)-slot1.riot.bin
SLOT_RIOT_BINS = $(SLOT0_RIOT_BIN) $(SLOT1_RIOT_BIN)

# For slot generation only link is needed
$(BINDIR_APP)-%.elf: link
$(BINDIR_APP)-%.elf: $(BASELIBS)
$(Q)$(_LINK) -o $@

# Slot 0 and 1 firmware offset, after header
Expand Down Expand Up @@ -118,9 +117,12 @@ 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: FLASHFILE=$(RIOTBOOT_COMBINED_BIN)
riotboot/flash-combined-slot0: $(RIOTBOOT_COMBINED_BIN) $(FLASHDEPS)
$(FLASHER) $(FFLAGS)

riotboot/flash-extended-slot0: FLASHFILE=$(RIOTBOOT_EXTENDED_BIN)
riotboot/flash-extended-slot0: $(RIOTBOOT_EXTENDED_BIN) $(FLASHDEPS)
$(FLASHER) $(FFLAGS)

Expand All @@ -130,6 +132,7 @@ riotboot/flash-slot0: export IMAGE_OFFSET=$(SLOT0_OFFSET)
riotboot/flash-slot0: HEXFILE=$(SLOT0_RIOT_BIN)
# openocd
riotboot/flash-slot0: ELFFILE=$(SLOT0_RIOT_BIN)
riotboot/flash-slot0: FLASHFILE=$(SLOT0_RIOT_BIN)
riotboot/flash-slot0: $(SLOT0_RIOT_BIN) $(FLASHDEPS)
$(FLASHER) $(FFLAGS)

Expand All @@ -139,6 +142,7 @@ riotboot/flash-slot1: export IMAGE_OFFSET=$(SLOT1_OFFSET)
riotboot/flash-slot1: HEXFILE=$(SLOT1_RIOT_BIN)
# openocd
riotboot/flash-slot1: ELFFILE=$(SLOT1_RIOT_BIN)
riotboot/flash-slot1: FLASHFILE=$(SLOT1_RIOT_BIN)
riotboot/flash-slot1: $(SLOT1_RIOT_BIN) $(FLASHDEPS)
$(FLASHER) $(FFLAGS)

Expand Down
14 changes: 6 additions & 8 deletions tests/riotboot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ DEVELHELP ?= 1
# Change this to 0 show compiler invocation lines by default:
QUIET ?= 1

all: riotboot
# Target 'all' will generate the combined file directly.
# It also makes 'flash' and 'flash-only' work without specific command.
FLASHFILE = $(RIOTBOOT_COMBINED_BIN)

include ../Makefile.tests_common
include $(RIOTBASE)/Makefile.include

# Make 'flash' and 'flash-only' work without specific command.
# This is currently hacky as there is no way of specifiying a FLASHFILE
all: riotboot/combined-slot0
# This is currently hacky as the flasher are not using 'FLASHFILE'
# openocd
ELFFILE = $(BINDIR_APP)-slot0-combined.bin
ELFFILE = $(FLASHFILE)
# edbg
HEXFILE = $(BINDIR_APP)-slot0-combined.bin
# murdock uses ':=' to get the flashfile variable so should also be overwritten
FLASHFILE = $(BINDIR_APP)-slot0-combined.bin
HEXFILE = $(FLASHFILE)