From 06426c41b0c1b4f82ba374ce692f3330680c0069 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 20 Mar 2023 12:32:33 +0100 Subject: [PATCH] sys/riotboot: common default NUM_SLOT, SLOT_* config --- cpu/cortexm_common/Makefile.include | 7 ------- cpu/gd32v/Makefile.include | 7 ------- sys/riotboot/Makefile.include | 9 +++++++++ 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/cpu/cortexm_common/Makefile.include b/cpu/cortexm_common/Makefile.include index 04789eaf5c..f719989272 100644 --- a/cpu/cortexm_common/Makefile.include +++ b/cpu/cortexm_common/Makefile.include @@ -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 diff --git a/cpu/gd32v/Makefile.include b/cpu/gd32v/Makefile.include index e4431c2e15..97dead6fab 100644 --- a/cpu/gd32v/Makefile.include +++ b/cpu/gd32v/Makefile.include @@ -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)) diff --git a/sys/riotboot/Makefile.include b/sys/riotboot/Makefile.include index 56e5aa9952..c9bb330e45 100644 --- a/sys/riotboot/Makefile.include +++ b/sys/riotboot/Makefile.include @@ -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.