Merge pull request #73 from malvira/lds-cpp
run the linker script through CPP so that the stack sizes can be
This commit is contained in:
commit
d0052ff652
|
@ -40,7 +40,7 @@ PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)}
|
||||||
|
|
||||||
TEXT_BASE = 0x00400000
|
TEXT_BASE = 0x00400000
|
||||||
export TEXT_BASE
|
export TEXT_BASE
|
||||||
LINKERSCRIPT = $(CONTIKI_CPU)/mc1322x.lds
|
LINKERSCRIPT = $(OBJECTDIR)/mc1322x.lds
|
||||||
|
|
||||||
STARTUP=$(OBJECTDIR)/start.o
|
STARTUP=$(OBJECTDIR)/start.o
|
||||||
|
|
||||||
|
@ -70,6 +70,8 @@ CUSTOM_RULE_C_TO_OBJECTDIR_O=yes
|
||||||
CUSTOM_RULE_C_TO_O=yes
|
CUSTOM_RULE_C_TO_O=yes
|
||||||
|
|
||||||
CFLAGS += -I$(OBJECTDIR) -I$(CONTIKI_CPU)/board -DBOARD=$(TARGET)
|
CFLAGS += -I$(OBJECTDIR) -I$(CONTIKI_CPU)/board -DBOARD=$(TARGET)
|
||||||
|
CPPFLAGS += -P -C ${addprefix -D,${subst $(COMMA), ,$(DEFINES)}}
|
||||||
|
|
||||||
|
|
||||||
$(OBJECTDIR)/board.h: $(OBJECTDIR)
|
$(OBJECTDIR)/board.h: $(OBJECTDIR)
|
||||||
ifeq ($(HOST_OS),Windows)
|
ifeq ($(HOST_OS),Windows)
|
||||||
|
@ -78,6 +80,8 @@ else
|
||||||
ln -sf ../$(CONTIKI_CPU)/board/board.h $(OBJECTDIR)/board.h
|
ln -sf ../$(CONTIKI_CPU)/board/board.h $(OBJECTDIR)/board.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
$(OBJECTDIR)/%.lds: $(CONTIKI_CPU)/%.lds.S
|
||||||
|
$(CPP) $(CPPFLAGS) $< > $@
|
||||||
|
|
||||||
$(OBJECTDIR)/isr.o: $(CONTIKI_CPU)/src/isr.c
|
$(OBJECTDIR)/isr.o: $(CONTIKI_CPU)/src/isr.c
|
||||||
$(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@
|
$(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@
|
||||||
|
@ -109,7 +113,7 @@ CUSTOM_RULE_C_TO_CO=yes
|
||||||
%.$(TARGET): %_$(TARGET).bin
|
%.$(TARGET): %_$(TARGET).bin
|
||||||
@
|
@
|
||||||
|
|
||||||
%.elf: $(OBJECTDIR)/board.h %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a $(STARTUP)
|
%.elf: $(OBJECTDIR)/board.h %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a $(STARTUP) $(OBJECTDIR)/mc1322x.lds
|
||||||
$(CC) $(LDFLAGS) $(CFLAGS) -nostartfiles -o $@ $(filter-out %.a,$^) $(filter %.a,$^) $(filter %.a,$^)
|
$(CC) $(LDFLAGS) $(CFLAGS) -nostartfiles -o $@ $(filter-out %.a %.lds,$^) $(filter %.a,$^) $(filter %.a,$^)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,45 @@
|
||||||
|
#ifndef SYS_CONF_STACK_SIZE
|
||||||
|
#define SYS_STACK_SIZE 2048
|
||||||
|
#else
|
||||||
|
#define SYS_STACK_SIZE SYS_CONF_STACK_SIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef IRQ_CONF_STACK_SIZE
|
||||||
|
#define IRQ_STACK_SIZE 128
|
||||||
|
#else
|
||||||
|
#define IRQ_STACK_SIZE IRQ_CONF_STACK_SIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FIQ_CONF_STACK_SIZE
|
||||||
|
#define FIQ_STACK_SIZE 128
|
||||||
|
#else
|
||||||
|
#define FIQ_STACK_SIZE FIQ_CONF_STACK_SIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SVC_CONF_STACK_SIZE
|
||||||
|
#define SVC_STACK_SIZE 16
|
||||||
|
#else
|
||||||
|
#define SVC_STACK_SIZE SVC_CONF_STACK_SIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ABT_CONF_STACK_SIZE
|
||||||
|
#define ABT_STACK_SIZE 16
|
||||||
|
#else
|
||||||
|
#define ABT_STACK_SIZE ABT_CONF_STACK_SIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UND_CONF_STACK_SIZE
|
||||||
|
#define UND_STACK_SIZE 16
|
||||||
|
#else
|
||||||
|
#define UND_STACK_SIZE UND_CONF_STACK_SIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HEAP_CONF_SIZE
|
||||||
|
#define HEAP_SIZE 16
|
||||||
|
#else
|
||||||
|
#define HEAP_SIZE HEAP_CONF_SIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Script for -z combreloc: combine and sort reloc sections */
|
/* Script for -z combreloc: combine and sort reloc sections */
|
||||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
|
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
|
||||||
"elf32-littlearm")
|
"elf32-littlearm")
|
||||||
|
@ -12,14 +54,6 @@ MEMORY
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
|
|
||||||
SYS_STACK_SIZE = 1024;
|
|
||||||
IRQ_STACK_SIZE = 256;
|
|
||||||
FIQ_STACK_SIZE = 256;
|
|
||||||
SVC_STACK_SIZE = 256;
|
|
||||||
ABT_STACK_SIZE = 16;
|
|
||||||
UND_STACK_SIZE = 16;
|
|
||||||
HEAP_SIZE = 4096;
|
|
||||||
|
|
||||||
/* Read-only sections, merged into text segment: */
|
/* Read-only sections, merged into text segment: */
|
||||||
PROVIDE (__executable_start = 0x00400000); . = 0x00400000;
|
PROVIDE (__executable_start = 0x00400000); . = 0x00400000;
|
||||||
.text :
|
.text :
|
||||||
|
@ -169,26 +203,32 @@ HEAP_SIZE = 4096;
|
||||||
.stack : {
|
.stack : {
|
||||||
__stack_start__ = . ;
|
__stack_start__ = . ;
|
||||||
|
|
||||||
|
/* IRQ_STACK */
|
||||||
. += IRQ_STACK_SIZE;
|
. += IRQ_STACK_SIZE;
|
||||||
. = ALIGN (4);
|
. = ALIGN (4);
|
||||||
__irq_stack_top__ = . ;
|
__irq_stack_top__ = . ;
|
||||||
|
|
||||||
|
/* FIQ_STACK */
|
||||||
. += FIQ_STACK_SIZE;
|
. += FIQ_STACK_SIZE;
|
||||||
. = ALIGN (4);
|
. = ALIGN (4);
|
||||||
__fiq_stack_top__ = . ;
|
__fiq_stack_top__ = . ;
|
||||||
|
|
||||||
|
/* SVC_STACK */
|
||||||
. += SVC_STACK_SIZE;
|
. += SVC_STACK_SIZE;
|
||||||
. = ALIGN (4);
|
. = ALIGN (4);
|
||||||
__svc_stack_top__ = . ;
|
__svc_stack_top__ = . ;
|
||||||
|
|
||||||
|
/* ABT_STACK */
|
||||||
. += ABT_STACK_SIZE;
|
. += ABT_STACK_SIZE;
|
||||||
. = ALIGN (4);
|
. = ALIGN (4);
|
||||||
__abt_stack_top__ = . ;
|
__abt_stack_top__ = . ;
|
||||||
|
|
||||||
|
/* UND_STACK */
|
||||||
. += UND_STACK_SIZE;
|
. += UND_STACK_SIZE;
|
||||||
. = ALIGN (4);
|
. = ALIGN (4);
|
||||||
__und_stack_top__ = . ;
|
__und_stack_top__ = . ;
|
||||||
|
|
||||||
|
/* SYS_STACK */
|
||||||
. += SYS_STACK_SIZE;
|
. += SYS_STACK_SIZE;
|
||||||
. = ALIGN (4);
|
. = ALIGN (4);
|
||||||
__sys_stack_top__ = . ;
|
__sys_stack_top__ = . ;
|
Loading…
Reference in a new issue