Different code sizes in eclipse and avr studio

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello guys,

I have been using avr studio till now. I have to switch to eclipse now.

I am using external makefile (generated by avr studio) in eclipse. I have to do this for maintaining compatibility with prev projects.

Anyways, i am able to compile and generate similar hex files but the output of avr studio is

Quote:
----------------
Device: atmega88

Program: 3071 bytes (37.5% Full)
(.text + .data + .bootloader)

Data: 190 bytes (18.6% Full)
(.data + .bss + .noinit)

Build succeeded with 8 Warnings...

and that of eclipse is

Quote:

AVR Memory Usage
----------------
Device: atmega88

Program: 3935 bytes (48.0% Full)
(.text + .data + .bootloader)

Data: 190 bytes (18.6% Full)
(.data + .bss + .noinit)

The hex files are exactly similar.
Map files are almost same except for .debug_line and .debug_str.....i dont know why

Can any1 help as y this different program sizes???

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How could anyone answer this without you showing the compile and link options actually being used? It could be something as simple as Studio using -Os and Eclipse using -O0/-O1/-O2/-O3 but until you show us the build commands we can only conjecture.

(BTW you want to fix those 8 warnings - never ignore warnings - apart from anything else the build "noise" may obscure something really important)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using the same makefile for both....

I have mentioned some of the options used

Quote:

## Compile options common for all C compilation units.
CFLAGS = $(COMMON)
CFLAGS += -Wall -gdwarf-2 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d

## Assembly specific flags
ASMFLAGS = $(COMMON)
ASMFLAGS += $(CFLAGS)
ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2

## Build
all: $(TARGET) app.hex app.eep app.lss size

##Link
$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)

%.hex: $(TARGET)
avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@

%.eep: $(TARGET)
-avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0

%.lss: $(TARGET)
avr-objdump -h -S $< > $@

size: ${TARGET}
@echo
@avr-size -C --mcu=${MCU} ${TARGET}

## Clean target
.PHONY: clean
clean:
-rm -rf $(OBJECTS) app.elf dep/* app.hex app.eep app.lss app.map

## Other dependencies
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Then I can only guess that it's a different version of the compiler being used in each case. The same compiler, with the same Makefile and the same source files will produce the same code.