git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@403 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2008-08-25 13:40:36 +00:00
parent 0284f0998d
commit 01afd268a5
3 changed files with 37 additions and 6 deletions

View File

@ -26,6 +26,9 @@ BIN = $(CP) -O binary
MCU = arm7tdmi MCU = arm7tdmi
# Enable this if you want the linker to remove unused code and data
LINK_GC = yes
# List all default C defines here, like -D_DEBUG=1 # List all default C defines here, like -D_DEBUG=1
DDEFS = DDEFS =
@ -108,6 +111,10 @@ OPT = -O2 -ggdb -fomit-frame-pointer -mabi=apcs-gnu
#OPT += -ffixed-r7 #OPT += -ffixed-r7
OPT += -falign-functions=16 OPT += -falign-functions=16
ifeq ($(LINK_GC),yes)
OPT += -ffunction-sections -fdata-sections
endif
# Define warning options here # Define warning options here
WARN = -Wall -Wstrict-prototypes WARN = -Wall -Wstrict-prototypes
@ -126,10 +133,14 @@ ASMOBJS = $(ASMSRC:.s=.o)
LIBS = $(DLIBS) $(ULIBS) LIBS = $(DLIBS) $(ULIBS)
MCFLAGS = -mcpu=$(MCU) MCFLAGS = -mcpu=$(MCU)
ODFLAGS = -x --syms
ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(<:.s=.lst) $(ADEFS) ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
CPFLAGS = $(MCFLAGS) $(OPT) $(WARN) -Wa,-alms=$(<:.c=.lst) $(DEFS) CPFLAGS = $(MCFLAGS) $(OPT) $(WARN) -Wa,-alms=$(<:.c=.lst) $(DEFS)
LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR) ifeq ($(LINK_GC),yes)
ODFLAGS = -x --syms LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LIBDIR)
else
LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR)
endif
# Thumb interwork enabled only if needed because it kills performance. # Thumb interwork enabled only if needed because it kills performance.
ifneq ($(TSRC),) ifneq ($(TSRC),)

View File

@ -26,6 +26,9 @@ BIN = $(CP) -O binary
MCU = arm7tdmi MCU = arm7tdmi
# Enable this if you want the linker to remove unused code and data
LINK_GC = yes
# List all default C defines here, like -D_DEBUG=1 # List all default C defines here, like -D_DEBUG=1
DDEFS = DDEFS =
@ -108,6 +111,10 @@ OPT = -Os -ggdb -fomit-frame-pointer -mabi=apcs-gnu
#OPT += -ffixed-r7 #OPT += -ffixed-r7
OPT += -falign-functions=16 OPT += -falign-functions=16
ifeq ($(LINK_GC),yes)
OPT += -ffunction-sections -fdata-sections
endif
# Define warning options here # Define warning options here
WARN = -Wall -Wstrict-prototypes WARN = -Wall -Wstrict-prototypes
@ -126,10 +133,14 @@ ASMOBJS = $(ASMSRC:.s=.o)
LIBS = $(DLIBS) $(ULIBS) LIBS = $(DLIBS) $(ULIBS)
MCFLAGS = -mcpu=$(MCU) MCFLAGS = -mcpu=$(MCU)
ODFLAGS = -x --syms
ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(<:.s=.lst) $(ADEFS) ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
CPFLAGS = $(MCFLAGS) $(OPT) $(WARN) -Wa,-alms=$(<:.c=.lst) $(DEFS) CPFLAGS = $(MCFLAGS) $(OPT) $(WARN) -Wa,-alms=$(<:.c=.lst) $(DEFS)
LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR) ifeq ($(LINK_GC),yes)
ODFLAGS = -x --syms LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LIBDIR)
else
LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR)
endif
# Thumb interwork enabled only if needed because it kills performance. # Thumb interwork enabled only if needed because it kills performance.
ifneq ($(TSRC),) ifneq ($(TSRC),)

View File

@ -48,11 +48,16 @@ SECTIONS
.text : .text :
{ {
_text = .; _text = .;
*(.text); KEEP(*(.startup))
*(.text)
*(.text.*);
*(.rodata); *(.rodata);
*(.rodata*); *(.rodata.*);
*(.glue_7t); *(.glue_7t);
*(.glue_7); *(.glue_7);
*(.gcc*);
*(.ctors);
*(.dtors);
. = ALIGN(4); . = ALIGN(4);
_etext = .; _etext = .;
} > flash } > flash
@ -64,6 +69,8 @@ SECTIONS
_data = .; _data = .;
*(.data) *(.data)
. = ALIGN(4); . = ALIGN(4);
*(.data.*)
. = ALIGN(4);
*(.ramtext) *(.ramtext)
. = ALIGN(4); . = ALIGN(4);
_edata = .; _edata = .;
@ -74,6 +81,8 @@ SECTIONS
_bss_start = .; _bss_start = .;
*(.bss) *(.bss)
. = ALIGN(4); . = ALIGN(4);
*(.bss.*)
. = ALIGN(4);
*(COMMON) *(COMMON)
. = ALIGN(4); . = ALIGN(4);
_bss_end = .; _bss_end = .;