mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 14:03:55 +01:00
Define _rom_offset with a conditional evaluated at execution time to allow setting it in compilation rules and generate in the same make instance different elf files with different configurations.
24 lines
1.1 KiB
Makefile
24 lines
1.1 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
|
|
|
|
|
|
# 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))
|