Go Down

Topic: Help: Arduino vs Commandline: Doubles code size (Read 409 times) previous topic - next topic

TTL

Hello,
I am trying to get the example code for the WebClient Compiled without the arduino GUI.
The good thing: It works.
The very bad thing: The code size jumps from 5486 Byte with the Arduino GUI up to 11058 Byes with a Makefile. Both resulting programs work as expected when uploaded. Note: I had to define
extern "C" void __cxa_pure_virtual(void);
void __cxa_pure_virtual(void) {};

because otherwise I get an error:
hardware/cores/arduino/Print.cpp:153: undefined reference to `__cxa_pure_virtual

I already tried to link the ready .o files from the arduino temporary directory, but this ends up in the linking error above. I already used strace to see what commands the GUI gives avr-gcc but there were nothing unusual. The only thing: If I do not add the -lm lib, the code size increases by an additional ~2KB.

It looks linke there is a lot of unused code removed, but I am really at the end of my knowledge whats going on in the magic GUI.

Any Ideas?

Coding Badly

Do either of these help...

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1234996426
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1240829167/all

- Brian

TTL

#2
Jul 08, 2009, 10:01 am Last Edit: Jul 08, 2009, 10:03 am by TTL12345678 Reason: 1
Thanks, -ffunction-sections -fdata-sections -Wl,--gc-sections helped.
My error was: I looked through the strace output and found the [glow]-Wl,--gc-sections[/glow] linker option. But I added it as two parameters [glow]-Wl --gc-sections[/glow], which did not changed anything.

Go Up