Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code too big when compiled with gcc4.3.2 #3

Open
WestfW opened this issue Feb 21, 2012 · 1 comment
Open

Code too big when compiled with gcc4.3.2 #3

WestfW opened this issue Feb 21, 2012 · 1 comment

Comments

@WestfW
Copy link

WestfW commented Feb 21, 2012

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.)

@WestfW
Copy link
Author

WestfW commented May 6, 2012

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant