1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/riotboot/Makefile.include
Gunar Schorcht 2e32d4ee8b sys/riotboot: uses SLOT1_OFFSET in hex format
Using hex number for addresses and address offsets improves the readability.
2023-04-18 06:20:14 +02:00

28 lines
1.1 KiB
Makefile

# 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)
RIOTBOOT_HDR_LEN ?= 0x100
# 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
SLOT0_LEN ?= $(shell printf "0x%x" $$((($(ROM_LEN:%K=%*1024)-$(RIOTBOOT_LEN)) / $(NUM_SLOTS))))
SLOT1_LEN ?= $(SLOT0_LEN)
SLOT0_LEN := $(SLOT0_LEN)
SLOT1_LEN := $(SLOT1_LEN)
# 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)
SLOT1_OFFSET ?= $(shell printf "0x%x" $$(($(SLOT0_OFFSET) + $(SLOT0_LEN))))
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)