DSPRelated.com
Forums

Re: circular buffers using C/C++/ absolute adresses

Started by Michael Haertl March 9, 2001
hello,

if I use circular buffers on the sharc, I dont' access them
from the C environment. If something is so time-critical, that
I need to use specific hardware features of a processor, I
almost every time go down to assembly.

regarding the macros in macros.h, the ones I've found are
plain C. the older toolset had some inline assembler at
this place which did not work for VDSP any more. obviously
these macros are still provided for compatibility reasons
only, but I suspect they work.

an absolute adress for a variable in C can be achieved by
placing it in a separate segment (which can be placed
absolutely in the LDF). Another way is to use a pointer
pointing at the absolute adress instead.

e.g.
static segment("myseg") int var1; // in *.c
myseg { TYPE(DM RAM) START(0x00030000) END(0x0003ffff) WIDTH(32) } // memory
section of *.ldf
myseg { INPUT_SECTIONS($OBJECTS(myseg)) } >myseg // processor
section of *.ldf

or

int absadr_var_content = *((int*)0x030000);

hth
michael nagaraj cs wrote:
> Hi,
> I had posted the same question long back,two three
> times. Nobody replied. Even I suspect ADSP tools
> supporting circular buffer declaration in C. One more
> similar problem is declaring a variable at absolute
> address.
> Could anyone in the group look into these issues ?
>
> Regards,
> Nagaraj CS
>
> --- wrote:
> > Is there a way to declare and use circular buffers
> > in C/C++ for the
> > Sharc? I tried searching for some clues with no luck
> > other than
> > finding a few macros in macros.h. I remember someone
> > telling me that
> > these were buggy. I saw a few old posts on the
> > subject but they
> > didn't quite enlighten me :-(
> >
> > I suspect there is no way to use the native support
> > of the processor.
> >
> > I'd appreciate examples or pointers to examples/docs
> > that come with
> > the VisualDSP tools.
> >
> > Cheers
> > Bhaskar

--
/* Michael Haertl */



On Fri, 09 Mar 2001 19:47:34 +0100, Michael Haertl wrote:

> an absolute adress for a variable in C can be achieved by
> placing it in a separate segment (which can be placed
> absolutely in the LDF). Another way is to use a pointer
> pointing at the absolute adress instead.

Note that if you use the LDF technique, the symbol will be available in
the debugger. If you use a pointer cast (possibly hidden in a macro),
the debugger won't see it.