Skip to content

Commit

Permalink
sys/riotboot: common default NUM_SLOT, SLOT_* config
Browse files Browse the repository at this point in the history
  • Loading branch information
gschorcht committed Mar 20, 2023
1 parent b899a08 commit a1b75ae
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
7 changes: 0 additions & 7 deletions cpu/cortexm_common/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ ifneq (,$(filter usbus_dfu tinyusb_dfu,$(USEMODULE)))
else
RIOTBOOT_LEN ?= 0x1000
endif
# 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)

# JLink is able to flash any ARM CPUs
PROGRAMMERS_SUPPORTED += jlink
7 changes: 0 additions & 7 deletions cpu/gd32v/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ else
RIOTBOOT_LEN ?= 0x1000
endif

NUM_SLOTS ?= 2

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)

LINKER_SCRIPT ?= riscv.ld

CFLAGS += -DCPU_MODEL_$(call uppercase_and_underscore,$(CPU_MODEL))
Expand Down
9 changes: 9 additions & 0 deletions sys/riotboot/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
# 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.
Expand Down

0 comments on commit a1b75ae

Please sign in to comment.