2015-05-18 18:47:17 +02:00
|
|
|
# include module specific includes
|
2017-03-06 16:28:11 +01:00
|
|
|
INCLUDES += -I$(RIOTCPU)/cortexm_common/include
|
|
|
|
INCLUDES += -I$(RIOTCPU)/cortexm_common/include/vendor
|
2017-10-16 16:10:49 +02:00
|
|
|
|
2018-06-05 13:32:51 +02:00
|
|
|
# All variables must be defined in the CPU configuration when using the common
|
|
|
|
# `ldscripts/cortexm.ld`
|
2017-10-16 16:10:49 +02:00
|
|
|
ifneq (,$(ROM_START_ADDR)$(RAM_START_ADDR)$(ROM_LEN)$(RAM_LEN))
|
2018-06-05 13:32:51 +02:00
|
|
|
$(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))
|
2017-10-16 16:10:49 +02:00
|
|
|
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
|
2018-06-05 13:43:40 +02:00
|
|
|
|
2018-08-07 16:24:38 +02:00
|
|
|
TOOLCHAINS_SUPPORTED = gnu llvm
|
2018-06-05 13:43:40 +02:00
|
|
|
|
|
|
|
# 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))
|
2018-06-13 17:31:32 +02:00
|
|
|
# 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))
|
2017-06-15 15:45:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Configure riotboot bootloader and slot lengths
|
|
|
|
# 4KB are currently enough
|
|
|
|
RIOTBOOT_LEN ?= 0x1000
|
2018-10-19 22:25:12 +02:00
|
|
|
# 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)
|
2017-06-15 15:45:14 +02:00
|
|
|
SLOT0_LEN := $(SLOT0_LEN)
|
2018-10-19 22:25:12 +02:00
|
|
|
SLOT1_LEN := $(SLOT1_LEN)
|