From 7a6849ca17bb9118c35cd5b110e8edc7722f5787 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Thu, 15 Jun 2017 15:45:14 +0200 Subject: [PATCH] cpu/cortexm_common: add riotboot and slot support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RIOTBOOT_SLOT_LEN is calculated as an hexadecimal value and handles ROM_LEN defined as kilobytes like '512K' This enables support for all the cortex-m0+/3/4/7 arch, so most boards embedding these are potentially supported. One needs just to ensure that the CPU can be initialised at least twice. Co-authored-by: Gaƫtan Harter --- cpu/cortexm_common/Makefile.include | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cpu/cortexm_common/Makefile.include b/cpu/cortexm_common/Makefile.include index 60e5938bc4..f99c5b6cda 100644 --- a/cpu/cortexm_common/Makefile.include +++ b/cpu/cortexm_common/Makefile.include @@ -24,3 +24,11 @@ TOOLCHAINS_SUPPORTED = gnu llvm LINKFLAGS += $(if $(ROM_OFFSET),$(LINKFLAGPREFIX)--defsym=_rom_offset=$(ROM_OFFSET)) # FW_ROM_LEN: rom length to use for firmware linking. Allows linking only in a section of the rom. LINKFLAGS += $(if $(FW_ROM_LEN),$(LINKFLAGPREFIX)--defsym=_fw_rom_length=$(FW_ROM_LEN)) + + +# Configure riotboot bootloader and slot lengths +# 4KB are currently enough +RIOTBOOT_LEN ?= 0x1000 +# Take the whole flash minus RIOTBOOT_LEN +SLOT0_LEN ?= $(shell printf "0x%x" $$(($(ROM_LEN:%K=%*1024)-$(RIOTBOOT_LEN)))) +SLOT0_LEN := $(SLOT0_LEN)