Pages: [1] 2   Go Down
Author Topic: Eclipse large HEX file size  (Read 6944 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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);
      }
}

Logged

Portugal
Offline Offline
God Member
*****
Karma: 6
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

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

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

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

Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

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

now down to:

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

Program:   10468 bytes (31.9% Full)

but still around 7000 bytes too large.
Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How about -fno-rtti

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

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

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
Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

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

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You can post it at pastebin.com

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

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

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

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

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

Pages: [1] 2   Go Up
Jump to: