[Top][All Lists]

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

Re: [avr-libc-dev] FAQ addition?

From: Theodore A. Roth
Subject: Re: [avr-libc-dev] FAQ addition?
Date: Mon, 25 Nov 2002 11:06:17 -0800 (PST)

On Mon, 25 Nov 2002, E. Weddington wrote:

:) > It actually rather trivial:
:) >
:) >     MCUCR = _BV (SRE);          /* Enable External SRAM/XMEM */
:) >
:) > The only gotcha is that you need to set it up early on in the startup
:) > procedure.
:) Would one have to put it in an init section?

It really depends on the application. You would if you need it done
before the startup code. In some cases, you might be fine with just
enabling xmem in main().

:) And so one does not have to monkey around with link scripts and such
:) to add external RAM support?

I haven't. But if you need to put the heap in xmem, you might need to do
something. See the dox for malloc in the user manual for more info since I
think Joerg has nice discussion of that.

:) > One example would be wanting to put the stack in xmem (although is
:) > suboptimal performance wise). You would need to enable xmem before
:) > setting up the stack pointer (SP).
:) >
:) And would one have to manually set up the stack pointer? How is that
:) done?

You'd just need to tell the linker (I think) where you want the stack to
be and the startup code will init the SP for you. Looking at gcrt.S, the
__stack symbol is weakly bound, so you can over ride it in your program
(it default to RAMEND). So, if you set __stack in your code, that's what
the SP will be initialized to.

Ted Roth

reply via email to

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