diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-08-25 13:40:36 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-08-25 13:40:36 +0000 |
commit | 01afd268a5f8bb48007b44e6c2aa7c0d3eafe757 (patch) | |
tree | 4de06c301351748340eb4e7f953825dc6b4a7cfa /demos | |
parent | 0284f0998d6975d1754c34c864b2946a5202d02e (diff) | |
download | ChibiOS-01afd268a5f8bb48007b44e6c2aa7c0d3eafe757.tar.gz ChibiOS-01afd268a5f8bb48007b44e6c2aa7c0d3eafe757.tar.bz2 ChibiOS-01afd268a5f8bb48007b44e6c2aa7c0d3eafe757.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@403 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos')
-rw-r--r-- | demos/ARM7-LPC214x-GCC/Makefile | 15 | ||||
-rw-r--r-- | demos/ARM7-LPC214x-GCC/Makefile.thumb | 15 | ||||
-rw-r--r-- | demos/ARM7-LPC214x-GCC/ch.ld | 13 |
3 files changed, 37 insertions, 6 deletions
diff --git a/demos/ARM7-LPC214x-GCC/Makefile b/demos/ARM7-LPC214x-GCC/Makefile index a2dd69afe..c10ff9d94 100644 --- a/demos/ARM7-LPC214x-GCC/Makefile +++ b/demos/ARM7-LPC214x-GCC/Makefile @@ -26,6 +26,9 @@ BIN = $(CP) -O binary 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
DDEFS =
@@ -108,6 +111,10 @@ OPT = -O2 -ggdb -fomit-frame-pointer -mabi=apcs-gnu #OPT += -ffixed-r7
OPT += -falign-functions=16
+ifeq ($(LINK_GC),yes)
+ OPT += -ffunction-sections -fdata-sections
+endif
+
# Define warning options here
WARN = -Wall -Wstrict-prototypes
@@ -126,10 +133,14 @@ ASMOBJS = $(ASMSRC:.s=.o) LIBS = $(DLIBS) $(ULIBS)
MCFLAGS = -mcpu=$(MCU)
+ODFLAGS = -x --syms
ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
CPFLAGS = $(MCFLAGS) $(OPT) $(WARN) -Wa,-alms=$(<:.c=.lst) $(DEFS)
-LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR)
-ODFLAGS = -x --syms
+ifeq ($(LINK_GC),yes)
+ 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.
ifneq ($(TSRC),)
diff --git a/demos/ARM7-LPC214x-GCC/Makefile.thumb b/demos/ARM7-LPC214x-GCC/Makefile.thumb index 0e426e5b7..b388e64d7 100644 --- a/demos/ARM7-LPC214x-GCC/Makefile.thumb +++ b/demos/ARM7-LPC214x-GCC/Makefile.thumb @@ -26,6 +26,9 @@ BIN = $(CP) -O binary 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
DDEFS =
@@ -108,6 +111,10 @@ OPT = -Os -ggdb -fomit-frame-pointer -mabi=apcs-gnu #OPT += -ffixed-r7
OPT += -falign-functions=16
+ifeq ($(LINK_GC),yes)
+ OPT += -ffunction-sections -fdata-sections
+endif
+
# Define warning options here
WARN = -Wall -Wstrict-prototypes
@@ -126,10 +133,14 @@ ASMOBJS = $(ASMSRC:.s=.o) LIBS = $(DLIBS) $(ULIBS)
MCFLAGS = -mcpu=$(MCU)
+ODFLAGS = -x --syms
ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
CPFLAGS = $(MCFLAGS) $(OPT) $(WARN) -Wa,-alms=$(<:.c=.lst) $(DEFS)
-LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR)
-ODFLAGS = -x --syms
+ifeq ($(LINK_GC),yes)
+ 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.
ifneq ($(TSRC),)
diff --git a/demos/ARM7-LPC214x-GCC/ch.ld b/demos/ARM7-LPC214x-GCC/ch.ld index a71fac21b..bb59cec1c 100644 --- a/demos/ARM7-LPC214x-GCC/ch.ld +++ b/demos/ARM7-LPC214x-GCC/ch.ld @@ -48,11 +48,16 @@ SECTIONS .text :
{
_text = .;
- *(.text);
+ KEEP(*(.startup))
+ *(.text)
+ *(.text.*);
*(.rodata);
- *(.rodata*);
+ *(.rodata.*);
*(.glue_7t);
*(.glue_7);
+ *(.gcc*);
+ *(.ctors);
+ *(.dtors);
. = ALIGN(4);
_etext = .;
} > flash
@@ -64,6 +69,8 @@ SECTIONS _data = .;
*(.data)
. = ALIGN(4);
+ *(.data.*)
+ . = ALIGN(4);
*(.ramtext)
. = ALIGN(4);
_edata = .;
@@ -74,6 +81,8 @@ SECTIONS _bss_start = .;
*(.bss)
. = ALIGN(4);
+ *(.bss.*)
+ . = ALIGN(4);
*(COMMON)
. = ALIGN(4);
_bss_end = .;
|