DSPRelated.com
Forums

Input segments, Output segments, etc

Started by Steve Holle June 5, 2003
I'm having trouble deciphering what I can and should put in extern
SDRAM. I'm trying to scale up a program I successfully built for one
channel to two. I built this using the talk through demo for the
ADSP-21161, which incidentally is the DSP I'm targeting. I have been
unable to scale this project up because I keep running out of space in
various internal segments. I am using the EZ-Lite kit so I have plenty of
external SDRAM. The project is written primarily in C++ and I have
elimination enabled and have included the KEEP instruction as per the AD ap
note.

My questions are :
1) What should I try to keep or need to keep in internal memory?
2) What items in a typical project would you recommend moving to external
memory?
3) What are the "$LIBRARIES and $OBJECTS items that show up in each(?)
segment and can they be safely moved to external memory?
4) How do I know when I'm out of Heap?
5) Do you recommend using the Expert Linker to manipulate segments or going
directly to the ldf file?
6) Can anyone point me to a good ap note or tutorial on the how and why of
the linker file? The AD "Linker and Utilities Manual" does a fair job of
how but stinks on why.

As Rosan Rosadanna used to say "You ask a lot of questions?"

Thanks for your help.



--On Thursday, June 05, 2003 4:27 PM -0600 Steve Holle <>
wrote:

> 1) What should I try to keep or need to keep in internal memory?

Things that are touched often go in internal memory. So does the runtime
header. So do any objects touched by the IOP system (eg. SPORT DMA), as their
DMA can't reach external memory. All else can spill to external memory.

> 2) What items in a typical project would you recommend moving to external
> memory?

Big buffers that don't use DMA. Infrequently-used code. User interface code
(since humans are slow in computer terms).

> 3) What are the "$LIBRARIES and $OBJECTS items that show up in each(?)
> segment and can they be safely moved to external memory?

OBJECTS is all .doj files. LIBRARIES is the .dlb files supplied by ADI.

With some care and awareness of what's in the libraries, you can move them to
external memory. There are some spots that use self-modifying code and have to
do with interrupt processing, and those need to stay in internal memory. You
can use elfar (the ELF archive utility) to extract those modules for
independent placement.

> 4) How do I know when I'm out of Heap?

You need 6 words, as I recall, minimum, just to provide an empty heap header.
I don't use a heap, only static allocation, to avoid out-of-memory and
fragmentation issues at runtime. (For C++ objects, you can use operator
placement new to lock them to specific addresses and still get dynamic
initialization.)

> 5) Do you recommend using the Expert Linker to manipulate segments or going
> directly to the ldf file?

Personal preference. I haven't played with the Expert Linker, but it looks
like it would be useful if you don't know LDF syntax and your needs are fairly
simple.

> 6) Can anyone point me to a good ap note or tutorial on the how and why of
> the linker file? The AD "Linker and Utilities Manual" does a fair job of
> how but stinks on why.

It's based on the same linker command language that the Gnu linker "ld" (part
of the binutils package) uses. Googling around turned up this link:

<http://www.gnu.org/manual/ld-2.9.1/html_chapter/ld_3.html>