Pages: [1]   Go Down
Author Topic: Help: Arduino vs Commandline: Doubles code size  (Read 337 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: July 08, 2009, 03:03:05 am by TTL12345678 » Logged

Pages: [1]   Go Up
Jump to: