mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Kaspar Schleiser
7a6849ca17
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 <gaetan.harter@fu-berlin.de>
35 lines
1.6 KiB
Makefile
35 lines
1.6 KiB
Makefile
# include module specific includes
|
|
INCLUDES += -I$(RIOTCPU)/cortexm_common/include
|
|
INCLUDES += -I$(RIOTCPU)/cortexm_common/include/vendor
|
|
|
|
# All variables must be defined in the CPU configuration when using the common
|
|
# `ldscripts/cortexm.ld`
|
|
ifneq (,$(ROM_START_ADDR)$(RAM_START_ADDR)$(ROM_LEN)$(RAM_LEN))
|
|
$(if $(ROM_START_ADDR),,$(error ROM_START_ADDR is not defined))
|
|
$(if $(RAM_START_ADDR),,$(error RAM_START_ADDR is not defined))
|
|
$(if $(ROM_LEN),,$(error ROM_LEN is not defined))
|
|
$(if $(RAM_LEN),,$(error RAM_LEN is not defined))
|
|
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_rom_start_addr=$(ROM_START_ADDR)
|
|
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ram_start_addr=$(RAM_START_ADDR)
|
|
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_rom_length=$(ROM_LEN)
|
|
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ram_length=$(RAM_LEN)
|
|
endif
|
|
|
|
TOOLCHAINS_SUPPORTED = gnu llvm
|
|
|
|
# Only define the linker symbol if the variable is set
|
|
# The variable can be set using target specific variable thanks to lazy evaluation
|
|
|
|
# ROM_OFFSET: offset in rom to start linking, allows supporting a bootloader
|
|
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)
|