Harmonise link rule for all cortex CPUs

This commit is contained in:
George Oikonomou 2018-09-23 17:57:47 +01:00
parent 3c7d9d3ad2
commit 386e528cc5
7 changed files with 19 additions and 22 deletions

View File

@ -1,3 +1,14 @@
CONTIKI_ARM_DIRS += cortex-m cortex-m/CMSIS CONTIKI_ARM_DIRS += cortex-m cortex-m/CMSIS
### Build syscalls for newlib
MODULES += os/lib/newlib
CUSTOM_RULE_LINK = 1
.SECONDEXPANSION:
%.elf: $(CPU_STARTFILES) $$(CONTIKI_OBJECTFILES) %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(LDSCRIPT) $(TARGET_LIBS)
$(TRACE_LD)
$(Q)$(LD) $(LDFLAGS) ${filter-out $(LDSCRIPT) %.a,$^} ${filter %.a,$^} $(TARGET_LIBFLAGS) -o $@
include $(CONTIKI)/arch/cpu/arm/Makefile.arm include $(CONTIKI)/arch/cpu/arm/Makefile.arm

View File

@ -9,22 +9,10 @@ LDFLAGS += -Wl,-Map=$(CONTIKI_NG_PROJECT_MAP),--cref,--no-warn-mismatch
OBJCOPY_FLAGS += --gap-fill 0xff OBJCOPY_FLAGS += --gap-fill 0xff
### Build syscalls for newlib
MODULES += os/lib/newlib
CPU_STARTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CPU_START_SOURCEFILES)}} CPU_STARTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CPU_START_SOURCEFILES)}}
### Compilation rules
CUSTOM_RULE_LINK = 1
### Resolve any potential circular dependencies between the linked libraries ### Resolve any potential circular dependencies between the linked libraries
### See: https://stackoverflow.com/questions/5651869/gcc-what-are-the-start-group-and-end-group-command-line-options/5651895 ### See: https://stackoverflow.com/questions/5651869/gcc-what-are-the-start-group-and-end-group-command-line-options/5651895
TARGET_LIBFLAGS := -Wl,--start-group $(TARGET_LIBFILES) -lm -Wl,--end-group TARGET_LIBFLAGS := -Wl,--start-group $(TARGET_LIBFILES) -lm -Wl,--end-group
.SECONDEXPANSION:
%.elf: $(CPU_STARTFILES) $$(CONTIKI_OBJECTFILES) %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(LDSCRIPT)
$(TRACE_LD)
$(Q)$(LD) $(LDFLAGS) ${filter-out $(LDSCRIPT) %.a,$^} ${filter %.a,$^} $(TARGET_LIBFLAGS) -o $@
include $(CONTIKI)/arch/cpu/arm/cortex-m/Makefile.cortex-m include $(CONTIKI)/arch/cpu/arm/cortex-m/Makefile.cortex-m

View File

@ -9,20 +9,10 @@ LDFLAGS += -Wl,-Map=$(CONTIKI_NG_PROJECT_MAP),--cref,--no-warn-mismatch
OBJCOPY_FLAGS += --gap-fill 0xff OBJCOPY_FLAGS += --gap-fill 0xff
### Build syscalls for newlib
MODULES += os/lib/newlib
CPU_STARTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CPU_START_SOURCEFILES)}} CPU_STARTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CPU_START_SOURCEFILES)}}
### Compilation rules
CUSTOM_RULE_LINK = 1
### Resolve any potential circular dependencies between the linked libraries ### Resolve any potential circular dependencies between the linked libraries
### See: https://stackoverflow.com/questions/5651869/gcc-what-are-the-start-group-and-end-group-command-line-options/5651895 ### See: https://stackoverflow.com/questions/5651869/gcc-what-are-the-start-group-and-end-group-command-line-options/5651895
TARGET_LIBFLAGS := -Wl,--start-group $(TARGET_LIBFILES) -Wl,--end-group TARGET_LIBFLAGS := -Wl,--start-group $(TARGET_LIBFILES) -Wl,--end-group
%.elf: $(CPU_STARTFILES) %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(CONTIKI_NG_TARGET_LIB) $(TARGET_LIBS)
$(TRACE_LD)
$(Q)$(LD) $(LDFLAGS) ${filter %.o %.a,$^} $(TARGET_LIBFLAGS) -o $@
include $(CONTIKI)/arch/cpu/arm/cortex-m/Makefile.cortex-m include $(CONTIKI)/arch/cpu/arm/cortex-m/Makefile.cortex-m

View File

@ -96,6 +96,8 @@ SECTIONS
/* These symbols are used by the stack check library. */ /* These symbols are used by the stack check library. */
_stack = .; _stack = .;
_stack_origin = ORIGIN(SRAM) + LENGTH(SRAM); _stack_origin = ORIGIN(SRAM) + LENGTH(SRAM);
_heap = _stack;
_eheap = _stack_origin;
.ccfg : .ccfg :
{ {

View File

@ -14,3 +14,5 @@ INCLUDE "nrf5x_common.ld"
/* These symbols are used by the stack check library. */ /* These symbols are used by the stack check library. */
_stack = end; _stack = end;
_stack_origin = ORIGIN(RAM) + LENGTH(RAM); _stack_origin = ORIGIN(RAM) + LENGTH(RAM);
_heap = _stack;
_eheap = _stack_origin;

View File

@ -14,3 +14,5 @@ INCLUDE "nrf5x_common.ld"
/* These symbols are used by the stack check library. */ /* These symbols are used by the stack check library. */
_stack = end; _stack = end;
_stack_origin = ORIGIN(RAM) + LENGTH(RAM); _stack_origin = ORIGIN(RAM) + LENGTH(RAM);
_heap = _stack;
_eheap = _stack_origin;

View File

@ -14,3 +14,5 @@ INCLUDE "nrf5x_common.ld"
/* These symbols are used by the stack check library. */ /* These symbols are used by the stack check library. */
_stack = end; _stack = end;
_stack_origin = ORIGIN(RAM) + LENGTH(RAM); _stack_origin = ORIGIN(RAM) + LENGTH(RAM);
_heap = _stack;
_eheap = _stack_origin;