1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/slot_aux: add build system integration for AUX slot

This commit is contained in:
Benjamin Valentin 2023-04-24 14:14:56 +02:00 committed by Benjamin Valentin
parent 2a0b915790
commit 1f1d7082a5
3 changed files with 19 additions and 1 deletions

View File

@ -110,6 +110,9 @@ ifneq (,$(filter scanf_float,$(USEMODULE)))
endif
endif
# we need to include this before the riotboot include
include $(RIOTBASE)/sys/slot_aux/Makefile.include
ifneq (,$(filter riotboot,$(FEATURES_USED)))
include $(RIOTBASE)/sys/riotboot/Makefile.include
endif

View File

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

View File

@ -0,0 +1,15 @@
# This adds an optional AUX slot to flash that can be used to store persistent data.
# It will work with and without riotboot, but the size of the slot must remain fixed across
# firmware versions.
# Size of the AUX slot in Bytes - must align with flash page size
SLOT_AUX_LEN ?= 0
SLOT_AUX_OFFSET ?= $(shell echo $$(($(ROM_LEN:%K=%*1024)-$(SLOT_AUX_LEN))))
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_slot_aux_offset=$(SLOT_AUX_OFFSET)
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_slot_aux_len=$(SLOT_AUX_LEN)
ifneq (0, $(SLOT_AUX_LEN))
CFLAGS += -DCONFIG_SLOT_AUX_OFFSET=$(SLOT_AUX_OFFSET)
CFLAGS += -DCONFIG_SLOT_AUX_LEN=$(SLOT_AUX_LEN)
endif