Skip to content
Snippets Groups Projects
Unverified Commit c84539fd authored by Gaëtan Harter's avatar Gaëtan Harter Committed by cladmi
Browse files

cortexm_common: allow defining ROM_OFFFSET in a compilation rule

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.
parent 9103dcae
No related branches found
No related tags found
No related merge requests found
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
INCLUDES += -I$(RIOTCPU)/cortexm_common/include INCLUDES += -I$(RIOTCPU)/cortexm_common/include
INCLUDES += -I$(RIOTCPU)/cortexm_common/include/vendor INCLUDES += -I$(RIOTCPU)/cortexm_common/include/vendor
ifneq (,$(ROM_OFFSET))
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_rom_offset=$(ROM_OFFSET)
endif
# All variables must be defined in the CPU configuration when using the common # All variables must be defined in the CPU configuration when using the common
# `ldscripts/cortexm.ld` # `ldscripts/cortexm.ld`
ifneq (,$(ROM_START_ADDR)$(RAM_START_ADDR)$(ROM_LEN)$(RAM_LEN)) ifneq (,$(ROM_START_ADDR)$(RAM_START_ADDR)$(ROM_LEN)$(RAM_LEN))
...@@ -18,3 +14,10 @@ ifneq (,$(ROM_START_ADDR)$(RAM_START_ADDR)$(ROM_LEN)$(RAM_LEN)) ...@@ -18,3 +14,10 @@ ifneq (,$(ROM_START_ADDR)$(RAM_START_ADDR)$(ROM_LEN)$(RAM_LEN))
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_rom_length=$(ROM_LEN) LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_rom_length=$(ROM_LEN)
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ram_length=$(RAM_LEN) LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ram_length=$(RAM_LEN)
endif 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))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment