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: Weddington, Eric
Subject: RE: [avr-chat] linker builds file too big, is it a bug?
Date: Fri, 11 Feb 2011 08:20:49 -0700

Please file a bug at the binutils project (where GNU ld resides).

http://www.gnu.org/software/binutils/

Eric

> -----Original Message-----
> From: address@hidden [mailto:avr-
> address@hidden On Behalf Of
> Massimiliano Cialdi
> Sent: Friday, February 11, 2011 5:26 AM
> To: address@hidden
> Subject: [avr-chat] linker builds file too big, is it a bug?
> 
> Hi,
> 
> Working on a project I have found a strange pitfall with avr-ld.
> 
> To reproduce I wrote a very simple project.
> Consider that I use avr-gcc 4.4.4 and binutils 2.20.1
> 
> I have a c file:
> 
> #include <stdint.h>
> 
> static uint8_t data[] =
> {
>       [0 ... 9] = 1,
>       [10 ... 99] = 2,
>       [100 ... 999] = 3,
>       [1000 ... 1499] = 4
> };
> 
> int main (void)
> {
>       while(1)
>       {
>               __asm__ __volatile__ ("nop"); // do nothing
>       }
>       return (0);
> }
> 
> 
> Suppose to have an avr micro with only 1K flash and 2K sram. the MEMORY
> command will be:
> 
> MEMORY
> {
>   text   (rx)   : ORIGIN = 0, LENGTH = 1K
>   data   (rw!x) : ORIGIN = 0x800060, LENGTH = 2K
>   eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 1K
> }
> 
> If I compile and link I would expect a linker error like:
> region `text' overflowed by xx bytes
> 
> none of this happens. avr-ld link the elf file without error.
> bin file extracted from elf is 1662, too big to fit the flash...
> 
> .text is about 160 bytes, and .data is 1500 bytes.
> here is the output of avr-size:
> 
> Program:    1662 bytes (5.1% Full)
> (.text + .data + .bootloader)
> 
> Data:       1500 bytes (73.2% Full)
> (.data + .bss + .noinit)
> 
> I know that .data is to be considered belonging to sram, but its initial
> image is hold in flash, and according to my opinion this fact must be
> take into account, otherwise the binary may not work (as happened to my
> real project)
> 
> 
> the sample project is here:
> http://dl.dropbox.com/u/7966431/test_avr-ld.tar.bz2
> 
> is this a bug?
> 
> best regards
> 
> 
> _______________________________________________
> AVR-chat mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-chat



reply via email to

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