Go Down

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


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()
     pinMode(13, OUTPUT);

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


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


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)


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


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

Go Up