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: Michael Hennebry
Subject: Re: [avr-chat] linker builds file too big, is it a bug?
Date: Fri, 11 Feb 2011 10:53:25 -0600 (CST)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

On Fri, 11 Feb 2011, Massimiliano Cialdi wrote:

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);
}


.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)

Does avr-gcc use the copy-from-flash method for your array?
If it does something more intelligent,
your program really would fit.
I note that the program size purports to include .data .

--
"Pessimist: The glass is half empty.
Optimist:   The glass is half full.
Engineer:   The glass is twice as big as it needs to be."



reply via email to

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