aboutsummaryrefslogtreecommitdiffstats
path: root/demos/AVR/NIL-ARDUINOMEGA/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'demos/AVR/NIL-ARDUINOMEGA/Makefile')
-rw-r--r--demos/AVR/NIL-ARDUINOMEGA/Makefile6
1 files changed, 5 insertions, 1 deletions
diff --git a/demos/AVR/NIL-ARDUINOMEGA/Makefile b/demos/AVR/NIL-ARDUINOMEGA/Makefile
index f1c364509..48d4714f2 100644
--- a/demos/AVR/NIL-ARDUINOMEGA/Makefile
+++ b/demos/AVR/NIL-ARDUINOMEGA/Makefile
@@ -151,6 +151,8 @@ CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
CFLAGS += -mrelax
+CFLAGS += -fdata-sections
+CFLAGS += -ffunction-sections
#---------------- Compiler Options C++ ----------------
# -g*: generate debugging information
@@ -177,6 +179,8 @@ CFLAGS += -Wundef
CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
#CPPFLAGS += $(CSTANDARD)
+CPPFLAGS += -fdata-sections
+CPPFLAGS += -ffunction-sections
#---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler.
@@ -236,7 +240,7 @@ EXTMEMOPTS =
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
-LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
+LDFLAGS = -Wl,-Map=$(TARGET).map,--cref,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)