Put method in specific memory

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi,

I was wondering if it is possible to put a certain method in your program in
a specific memory ?

For example,

I have a slow sdram and a fast ddr ram available.
I want the ddr ram to contain a fft method, all other code should be stored
in the sdram... Can this be done with linker scripts ?


Thanks,

Tom



Re: Put method in specific memory
Quoted text here. Click to load it


That depends entirely on the toolchain you're using, and your platform.
Neither of which you remembered telling us what they are.

Quoted text here. Click to load it

Where you store the "method", i.e. the code, is quite probably
irrelevant, because it'll be negligibly small compared to the amount
of data it's going through.  You should worry about where you keep the
*data*.  And even that only if they're consistently larger that your
CPU's cache.

--
Hans-Bernhard Broeker ( snipped-for-privacy@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Re: Put method in specific memory

Quoted text here. Click to load it
program in
stored

I am using the gnu gcc compiler for the powerpc405.

I was wondering if it could be done because the linker takes all the object
files as input and produces one big object file with for example a text
section which contains your code. The locator takes the text section and
places it in the memory section that you defined in your linker script. This
means that your code (text section in your relocatable) can only be
redirected to one specific memory and that it cannot be distributed to
different memories (because it is one section)...

Tom



Re: Put method in specific memory

Quoted text here. Click to load it

Still nowhere near precise enough.  GCC is not the entire toolchain,
nor is 'powerpc405' a self-sufficient moniker of a platform.  What
binutils? What OS (if any)?  What is that 'loader' you mentioned?

That said: if it can be done at all, then yes, a modification to the
linker script would have to be part of the trick.  And some pretty
nasty pragmas or __attribute__(()) settings, too, to control it.

But, again: you probably are worrying about the wrong end of the
problem.  Code memory speed is hardly the bottleneck in any modern
CPU, and quite certainly not for a an application as heavy on data
bandwidth usage and number-crunching as an FFT.

--
Hans-Bernhard Broeker ( snipped-for-privacy@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Re: Put method in specific memory

Quoted text here. Click to load it

Did I mention a loader ?

At the moment I am using a xilinx development board with a virtex II pro
fpga with a powerpc405 on it. I am using the ise and the embedded
development kit to configure the system. I am not using a OS, just
developing a simple system with a powerpc, some memory and peripherals. More
info needed ?

Quoted text here. Click to load it

Ok, that's what I want to know... can it be done ?

Quoted text here. Click to load it

Yes, probably I am but I was just wondering if it was possible..


Quoted text here. Click to load it



Re: Put method in specific memory

[...]

Quoted text here. Click to load it

Well, you originally called it 'locator'...

Quoted text here. Click to load it

Probably not.  

Quoted text here. Click to load it


Quite probably.  If you can control that locator, that is.

Others who know that particular platform will be able to help.  As
might a look into the manual.

--
Hans-Bernhard Broeker ( snipped-for-privacy@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Re: Put method in specific memory

Quoted text here. Click to load it
More

I'll check out the linker script manual...again..

Quoted text here. Click to load it

Ok, thanks for your reply.

Tom

Quoted text here. Click to load it



Re: Put method in specific memory

Quoted text here. Click to load it

You can probably do it in two ways:

1) Use __attribute__((section("secname"))) to place the
   function in a specific memory section.

2) Use -ffunction-sections to place all functions in their own
   sections.

Then add another output section to your linker file that
contains the specified section name "secname" or the function
you're worried about ".text.funcname".
  
--
Grant Edwards                   grante             Yow!  I want the presidency
                                  at               so bad I can already taste
We've slightly trimmed the long signature. Click to see the full one.
Re: Put method in specific memory

Quoted text here. Click to load it

Probably.


It's probably easiest in combination with a Pragma or other
compiler directive that places the function in a certain
section.

--
Grant Edwards                   grante             Yow!  I am having a
                                  at               pleasant time!!
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline