avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Data in EEPROM


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] Data in EEPROM
Date: Fri, 13 Sep 2002 16:04:42 +0200 (MET DST)

gtoo <address@hidden> wrote:

> All of this works as it's supposed to, but I've noticed that
> whenever I add a new variable to the EEPROM section, the .data
> section is also increased with the same number of bytes as for the
> EEPROM.

avr-size, coming from the Unix size(1) command that basically only
knows about the three major sections .text, .data, and .bss, simply
cannot tell you the detail you want.  If you look into the object file
using avr-objdump -h, you'll notice that the actual .data section is
still 0 bytes, and only the .eeprom section gets accounted for your
EEPROM variables.  avr-size then `simplifies' this view:

static void
berkeley_sum (abfd, sec, ignore)
     bfd *abfd ATTRIBUTE_UNUSED;
     sec_ptr sec;
     PTR ignore ATTRIBUTE_UNUSED;
{
  flagword flags;
  bfd_size_type size;

  flags = bfd_get_section_flags (abfd, sec);
  if ((flags & SEC_ALLOC) == 0)
    return;

  size = bfd_get_section_size_before_reloc (sec);
  if ((flags & SEC_CODE) != 0 || (flags & SEC_READONLY) != 0)
    textsize += size;
  else if ((flags & SEC_HAS_CONTENTS) != 0)
    datasize += size;
  else
    bsssize += size;
}

Thus, basically any allocated section that has the `code' or
`readonly' flag set is summed up into the .text size, any other
allocated section that has data contents is summed up into .data, and
the remaining (non-contents) allocated sections are accounted for .bss.
Non-allocated sections (symbol tables, string tables etc.) are thrown
away for the purpose of this computation.

-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/
avr-gcc-list at http://avr1.org



reply via email to

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