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: Tue, 15 Feb 2011 23:59:48 +1100
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

On Tue, Feb 15, 2011 at 12:51:51PM +0100, bob wrote:
> On 15/02/11 12:18, Erik Christiansen wrote:
> > 
> > $ make
> > avr-gcc -g -Wall -Wno-main --param inline-call-cost=2 -Os -mmcu=attiny13    
> > -c -o main.o main.c
> > avr-gcc -g -Wall -Wno-main --param inline-call-cost=2 -Os -mmcu=attiny13  
> > -Wl,-Map,main.map -Wl,--section-start=.testparms=0x880 -T 
> > tiny13-libc-1.7.0.ld -o main.elf main.o 
> > /usr/lib/gcc/avr/4.2.2/../../../../avr/bin/ld: region text is full 
> > (main.elf section .text)
> > /usr/lib/gcc/avr/4.2.2/../../../../avr/bin/ld: region text is full 
> > (main.elf section .text)
> > /usr/lib/gcc/avr/4.2.2/../../../../avr/bin/ld: section .init2 [00000000 -> 
> > 00000007] overlaps section .text [00000000 -> 00000453]
> > /usr/lib/gcc/avr/4.2.2/../../../../avr/bin/ld: main.elf: section .text lma 
> > 0x0 overlaps previous sections
> > 
> > Now that's flagging a memory region overflow, but is it due to some
> > .text plus some .data?
> > 
> > Ooooooooooh Yes! When I comment out your badvar, which _is_ in .data,
> > not PROGMEM, all's well. Well well well! :-)
> > 
> > I'll try making up a test case which replicates your successful error
> > messaging, without using any of your IP. With a little luck I'll have
> > something tomorrow.

It's not so simple. While ld is flagging "region text is full", just as
we want to hear, that won't necessarily be enough to make everyone
happy. On Massimiliano's example code, it appears to be an artifact of
the .init2 overlap which occurs because your linker script makes .init2
an orphan section, due to these two lines:

    /* *(.init2) */ /* Clear __zero_reg__, set up stack pointer.  */
    /* KEEP (*(.init2)) */

When I uncomment those lines, to restore linker normality to an example
with 972 bytes of .text + 60 bytes of .data = 1032 bytes of text region,
to overflow the 1024 bytes which your linker script allows, then the
errors go away.

Anyone using the standard crt0 stuff wouldn't be able to use a linker
script as customised as yours, but we are not yet lost. When I restore
normality to .init1 and .init2 in your linker script, your code example
still throws:

/usr/lib/gcc/avr/4.2.2/../../../../avr/bin/ld: region text is full
(main.elf section .text)
/usr/lib/gcc/avr/4.2.2/../../../../avr/bin/ld: region text is full
(main.elf section .text)

It is late. Tomorrow is another day.

Erik



reply via email to

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