[Top][All Lists]

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

Re: [avr-gcc-list] memory organization

From: Joerg Wunsch
Subject: Re: [avr-gcc-list] memory organization
Date: Tue, 18 Dec 2001 18:14:02 +0100 (MET)

Torsten Hahn <address@hidden> wrote:

> im using an atmega103. I need to "reserve" 3kb of the internal sram
> for datas comming from an ad-converter. Where does avr-gcc place the
> global vars in the sram (beginning or end) ?

It's actually the linker, not the compiler.  They are filled up from
the beginning, while the stack is by default set to the top of RAM.
You need to make sure both parts will never overlap, since there's no
chance the compiler can test this, and no runtime support (like the
MMU you might be used to from a more complex CPU) that could issue a
trap or something else when the stack overflows.  It'll just destroy
the last of your variables then.

> What is the best way,
> to reserve such a large data segment ?

#define BUFSIZE 3*1024
uint8_t buffer[BUFSIZE];

(at the global level)

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

reply via email to

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