2019-06-18 14:58:28 +02:00
|
|
|
# Indicate the reserved space for a header, 256B by default.
|
|
|
|
# The value must respect the cpu alignment requirements for the specific
|
|
|
|
# cpu, it can be re-defined in the cpu Makefile.include accordingly.
|
|
|
|
# e.g: `cortex-m` vector-table comes after `riotboot_hdr` and must be naturally
|
|
|
|
# aligned according to CPU_IRQ_NUMOF (ref: cpu/cortexm_common/Makefile.include)
|
2019-03-14 11:50:57 +01:00
|
|
|
RIOTBOOT_HDR_LEN ?= 0x100
|
|
|
|
|
2023-03-20 12:32:33 +01:00
|
|
|
# Currently 2 slots are supported by default, equals in length
|
|
|
|
NUM_SLOTS ?= 2
|
|
|
|
|
|
|
|
# Take the whole flash minus RIOTBOOT_LEN and divide it by NUM_SLOTS
|
2023-04-24 14:14:56 +02:00
|
|
|
SLOT0_LEN ?= $(shell printf "0x%x" $$((($(ROM_LEN:%K=%*1024)-$(RIOTBOOT_LEN)-$(SLOT_AUX_LEN)) / $(NUM_SLOTS))))
|
2023-03-20 12:32:33 +01:00
|
|
|
SLOT1_LEN ?= $(SLOT0_LEN)
|
|
|
|
SLOT0_LEN := $(SLOT0_LEN)
|
|
|
|
SLOT1_LEN := $(SLOT1_LEN)
|
|
|
|
|
2019-03-14 11:50:57 +01:00
|
|
|
# By default, slot 0 is found just after RIOTBOOT_LEN. Slot 1 after
|
|
|
|
# slot 0. The values might be overridden to add more or less offset
|
|
|
|
# if needed.
|
|
|
|
SLOT0_OFFSET ?= $(RIOTBOOT_LEN)
|
2023-03-20 13:37:56 +01:00
|
|
|
SLOT1_OFFSET ?= $(shell printf "0x%x" $$(($(SLOT0_OFFSET) + $(SLOT0_LEN))))
|
2019-03-14 11:50:57 +01:00
|
|
|
|
|
|
|
CFLAGS += -DSLOT0_LEN=$(SLOT0_LEN)
|
|
|
|
CFLAGS += -DSLOT0_OFFSET=$(SLOT0_OFFSET)
|
|
|
|
CFLAGS += -DSLOT1_LEN=$(SLOT1_LEN)
|
|
|
|
CFLAGS += -DSLOT1_OFFSET=$(SLOT1_OFFSET)
|
|
|
|
CFLAGS += -DNUM_SLOTS=$(NUM_SLOTS)
|