eclipse arduino - help [RESOLVED]

Hi,

I am currently moving my arduino development to eclipse and I have stumbled with a painful problem which I am struggling with and would like to see if anyone has experienced the same problem and sorted it out.

I have problems with the size of the executable image it generates.

Configuration:

  • eclipse indigo 64 for Mac OSX
  • AVR CrossPack - latest version 2010015
  • avrclipse plug-in - latest version downloaded from repository

Project setup:

  • core arduino library: core library from Arduino generating a static library.
  • main test project: small test project that blinks an LED and prints how much RAM is available on the UART.

Project, compilation and link flags:

  • both project are configured in release mode with, optimizations for size and no debug information
  • AVR C++ compiler avr-gcc.
  • AVR C++ compiler additional optimization flags: -ffunction-sections -fdata-sections -Wl,--gc-sections
  • AVR project target: atmega328p, F_CPU: 16000000 MHz
  • Addtional linker flags: ${COMMAND} --cref -s -Os ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} -lm ${FLAGS}

Both projects compile correctly (static arduino library and main test project) and generate a library and an executable image. I have also downloaded the image through the eclipse IDE fine onto the target and it works correctly on the target board.

avr-size --format=avr --mcu=atmega328p test.elf
AVR Memory Usage
----------------
Device: atmega328p

Program:   10732 bytes (32.8% Full)
(.text + .data + .bootloader)

Data:        223 bytes (10.9% Full)
(.data + .bss + .noinit)

10732 bytes!!! where the same "sketch" compiled with the arduino sdk is 2594 bytes. Any thoughts?

Any thoughts and help will be much appreciated?

Problem sorted out adding: -Wl,--gc-sections to linker flags.