Go Down

Topic: Eclipse large HEX file size (Read 8908 times) previous topic - next topic

Vude

I installed and configured Eclipse according to this cook book: http://www.arduino.cc/playground/Code/Eclipse. All works fine, however, if I am comparing the size of the generated HEX file between Arduino IDE and Eclipse I was shocked:
Arduino: 2664 byte
Eclipse: 13348 bytes !!!!

Can anybody advise which compiler/linker settings could bring the file size towards Arduino.

BTW, I used the following code:

Code: [Select]

byte state = HIGH;
long time = 0;

void setup()
{
     Serial.begin(115200);
     pinMode(13, OUTPUT);
}

void loop()
{
     if (millis() - time > 1000)
     {
           state = HIGH ^ state;
           digitalWrite(13, state);
           time = millis();
           Serial.println(time, DEC);
     }
}



Senso

Isn't Eclipse reporting the free space left, as it looks like it.

Vude

That is the msg from Eclipse:
AVR Memory Usage
----------------
Device: atmega328p

Program:   13348 bytes (40.7% Full)
(.text + .data + .bootloader)

Data:        487 bytes (23.8% Full)
(.data + .bss + .noinit)


and if I un-comment both Serial lines I get:

AVR Memory Usage
----------------
Device: atmega328p

Program:    1228 bytes (3.7% Full)
(.text + .data + .bootloader)

Data:         15 bytes (0.7% Full)
(.data + .bss + .noinit)

RuggedCircuits

Can you tell us what the compiler command is from Eclipse? Perhaps it doesn't turn optimization on? And what GCC version is installed with it?

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

Vude

Cannot figure out the avr-gcc version, but the the avr-gcc.exe has a date modified 01/19/2010.

Here my compiler properties:

AVR Compiler
* Debugging:             Generate Debugging Info: No debugging info
* Optimization:       Optimization Level: to Size Optimizations
* All options:      -Wall -Os -fpack-struct -fshort-enums -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega328p -DF_CPU=16000000UL
       
AVR C++ Compiler
* Debugging:             'Generate Debugging Info': No debugging info.
* Optimization:       'Optimization Level': Size Optimizations
* All options:      -Wall -Os -fpack-struct -fshort-enums -funsigned-char -funsigned-bitfields -fno-exceptions -mmcu=atmega328p -DF_CPU=16000000UL
             
AVR C++ Linker
* Command:                         avr-gcc
* Command line pattern: ${COMMAND} --cref -s -Os ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} -lm ${FLAGS}
* All options:                  -Wl,-Map,Test.map,--cref -L"H:\Users\rxklein\Development\Eclipse\libraries" -mmcu=atmega328p


RuggedCircuits

Try adding -ffunction-sections and -fdata-sections to the compile flags.

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

Vude

now down to:

AVR Memory Usage
----------------
Device: atmega328p

Program:   10468 bytes (31.9% Full)

but still around 7000 bytes too large.

RuggedCircuits

How about -fno-rtti

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

Vude

no, did not work, re-compiled "clean" the ArduinoCore lib and project, entered your proposed settings. I hope I am not doing anything wrong, I enter the settings under
AVR C++ Linker -> General -> Other Arguments

RuggedCircuits

Can we see the Test.map file?  It might be pretty big so maybe post it somewhere like pastebin.

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

Vude

sure you can see it, it's 120kB or 9kB-zipped, but how can I attach or paste it ?

RuggedCircuits

You can post it at pastebin.com

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

Vude

it is here: http://pastebin.com/zetFw5EM

RuggedCircuits

Looks like a large part of the code is due to floating-point support being linked in though your code doesn't do any floating point math. That's a bit of a mystery to me.

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

Vude

for completeness the source and header: http://pastebin.com/NFL1iLZg

I followed the cook book according to first post to compile the ArduinoCore lib
copied the lib file into my Eclipse/libraries folder
linked the lib into my project.

While compiling the ArduinoCore I got 20 warning messages but nothing to worry about: something like comparison between signed and un-signed int.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy