avr-chat
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-chat] linker builds file too big, is it a bug?


From: Erik Christiansen
Subject: Re: [avr-chat] linker builds file too big, is it a bug?
Date: Sat, 12 Feb 2011 12:55:10 +1100
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

On Fri, Feb 11, 2011 at 04:56:08PM +0100, Massimiliano Cialdi wrote:
> No, Is not right.
> You haven't specified linker script.
> 
> Just run make in the same directory.
> 
> here is the results:
> 
> lab7:/home/max/prog/test_avr-ld$ make
> avr-gcc -g -Wall -O0 -Wa,-anhlmsd=test.lst -mmcu=atmega32 -c test.c
> test.c:4: warning: 'data' defined but not used
> avr-gcc -g -O0 -Wall -mmcu=atmega32 -Wl,-Tavr5_mega32.x
> -Wl,-Map=test.map -o test.elf test.o
> avr-objcopy -O binary -R .eeprom -R .fuse -R .lock test.elf test.bin

OK, after finding the link to avr5_mega32.x on a separate thread [1],
we seem to have there:

MEMORY
{
  text   (rx)   : ORIGIN = 0, LENGTH = 32K
  data   (rw!x) : ORIGIN = 0x800060, LENGTH = 2K 
  eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 1K 
}

But Massimiliano's OP showed code which generated only:

> Program:    1662 bytes (5.1% Full)
> (.text + .data + .bootloader)

Clearly, that won't overflow 32K, so it is correct for no error to be
seen when using -Wl,-Tavr5_mega32.x. (And 1662/(32*1024) = 5.07%)

AIUI, there is only a problem if no error is shown with:

MEMORY
{
  text   (rx)   : ORIGIN = 0, LENGTH = 1K
  data   (rw!x) : ORIGIN = 0x800060, LENGTH = 2K
  eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 1K
}

as was stated to be the content of the linker script, in the OP.

Has some confusion about the linker script being used perhaps crept in
somewhere?

Erik

[1] I'll have to look at tweaking mutt to display posts with similar
    subject lines as one thread, even if the headers don't formally make
    that the case, to avoid being caught out again.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]