run the linker script through CPP so that the stack sizes can be
changed using CONF parameters via DEFINES (e.g. SYS_CONF_STACK_SIZE 4096)
This commit is contained in:
parent
56ce9247c3
commit
64ded5aecc
@ -40,7 +40,7 @@ PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)}
|
||||
|
||||
TEXT_BASE = 0x00400000
|
||||
export TEXT_BASE
|
||||
LINKERSCRIPT = $(CONTIKI_CPU)/mc1322x.lds
|
||||
LINKERSCRIPT = $(OBJECTDIR)/mc1322x.lds
|
||||
|
||||
STARTUP=$(OBJECTDIR)/start.o
|
||||
|
||||
@ -70,6 +70,8 @@ CUSTOM_RULE_C_TO_OBJECTDIR_O=yes
|
||||
CUSTOM_RULE_C_TO_O=yes
|
||||
|
||||
CFLAGS += -I$(OBJECTDIR) -I$(CONTIKI_CPU)/board -DBOARD=$(TARGET)
|
||||
CPPFLAGS += -P -C ${addprefix -D,${subst $(COMMA), ,$(DEFINES)}}
|
||||
|
||||
|
||||
$(OBJECTDIR)/board.h: $(OBJECTDIR)
|
||||
ifeq ($(HOST_OS),Windows)
|
||||
@ -78,6 +80,8 @@ else
|
||||
ln -sf ../$(CONTIKI_CPU)/board/board.h $(OBJECTDIR)/board.h
|
||||
endif
|
||||
|
||||
$(OBJECTDIR)/%.lds: $(CONTIKI_CPU)/%.lds.S
|
||||
$(CPP) $(CPPFLAGS) $< > $@
|
||||
|
||||
$(OBJECTDIR)/isr.o: $(CONTIKI_CPU)/src/isr.c
|
||||
$(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@
|
||||
@ -109,7 +113,7 @@ CUSTOM_RULE_C_TO_CO=yes
|
||||
%.$(TARGET): %_$(TARGET).bin
|
||||
@
|
||||
|
||||
%.elf: $(OBJECTDIR)/board.h %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a $(STARTUP)
|
||||
$(CC) $(LDFLAGS) $(CFLAGS) -nostartfiles -o $@ $(filter-out %.a,$^) $(filter %.a,$^) $(filter %.a,$^)
|
||||
%.elf: $(OBJECTDIR)/board.h %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a $(STARTUP) $(OBJECTDIR)/mc1322x.lds
|
||||
$(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 */
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
|
||||
"elf32-littlearm")
|
||||
@ -12,14 +54,6 @@ MEMORY
|
||||
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: */
|
||||
PROVIDE (__executable_start = 0x00400000); . = 0x00400000;
|
||||
.text :
|
||||
@ -169,26 +203,32 @@ HEAP_SIZE = 4096;
|
||||
.stack : {
|
||||
__stack_start__ = . ;
|
||||
|
||||
/* IRQ_STACK */
|
||||
. += IRQ_STACK_SIZE;
|
||||
. = ALIGN (4);
|
||||
__irq_stack_top__ = . ;
|
||||
|
||||
/* FIQ_STACK */
|
||||
. += FIQ_STACK_SIZE;
|
||||
. = ALIGN (4);
|
||||
__fiq_stack_top__ = . ;
|
||||
|
||||
/* SVC_STACK */
|
||||
. += SVC_STACK_SIZE;
|
||||
. = ALIGN (4);
|
||||
__svc_stack_top__ = . ;
|
||||
|
||||
/* ABT_STACK */
|
||||
. += ABT_STACK_SIZE;
|
||||
. = ALIGN (4);
|
||||
__abt_stack_top__ = . ;
|
||||
|
||||
/* UND_STACK */
|
||||
. += UND_STACK_SIZE;
|
||||
. = ALIGN (4);
|
||||
__und_stack_top__ = . ;
|
||||
|
||||
/* SYS_STACK */
|
||||
. += SYS_STACK_SIZE;
|
||||
. = ALIGN (4);
|
||||
__sys_stack_top__ = . ;
|
Loading…
Reference in New Issue
Block a user