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

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

Re: [avr-gcc-list] avr-gcc internals and generation of object files


From: Erik Christiansen
Subject: Re: [avr-gcc-list] avr-gcc internals and generation of object files
Date: Fri, 23 Jan 2004 15:57:34 +1100
User-agent: Mutt/1.3.28i

On Thu, Jan 22, 2004 at 03:23:55PM +0100, Joerg Wunsch wrote:
> Torleif Sandnes <address@hidden> wrote:
> 
> > 1. How are the mapping to AVR specific segments performed in
> > avr-gcc?  (flash, eeprom, sram..)
> 
> GCC isn't really prepared to handle Harvard architecture CPUs, it
> basically can only handle a single address space.
> 
> AVR-GCC circumvents this problem by using offsets for the SRAM and
> EEPROM locations (0x800000 and 0x810000 resp.).

This is perhaps made most visibly explicit in the linker command script.
The following script excerpt establishes the resources for an ATmega64.
(Some may prefer not to make the boot segment explicit. Then text =
64K.)

MEMORY
{
  text   (rx)   : ORIGIN = 0, LENGTH = 62K
  boot   (rx)   : ORIGIN = 62K, LENGTH = 2K
  data   (rw!x) : ORIGIN = 0x800100, LENGTH = 4K
  eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 2K
}

> > 2. Will avr-gcc always produce sections in an object file, or can
> > this be avoided, just producing the program headers.
> 
> GCC will (IMHO) always produce sections, and people even tend to want
> to create additional sections of their own (e. g. in order to combine
> the bootloader and standard application code, or to create an
> additional memory section for variables located in external RAM).

Yep, and use things like the 10 handy little .init sections which precede the
body of code. (They are a godsend for object oriented assembler programming.)

Erik



reply via email to

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