Arduino-stk500v2-bootloader
Arduino-stk500v2-bootloader copied to clipboard
Code too big when compiled with gcc4.3.2
Arduino ships with gcc4.3.2, but when you compile the stk500v2 with this version, the resulting image exceeds the max bootloader size.
Suggest adding "-fno-inline-small-functions", which reduces the compile code size for all compiler versions. See also http://code.google.com/p/arduino/issues/detail?id=822 (where there is a patch.)
diff --git a/Makefile b/Makefile
index 65eafb3..3eb65d7 100644
--- a/Makefile
+++ b/Makefile
@@ -80,7 +80,7 @@ ASRC =
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-OPT = s
+OPT := -Os -fno-inline-small-functions
# Debugging format.
@@ -123,7 +123,7 @@ CINCS =
# -adhlns...: create assembler listing
CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS) $(CINCS)
-CFLAGS += -O$(OPT)
+CFLAGS += $(OPT)
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -mno-tablejump
CFLAGS += -Wall -Wstrict-prototypes
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)