Put method in specific memory

Jun 08, 2004 8 Replies

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


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

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 (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.

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

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 (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.

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 ?

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

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

[...]

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

Probably not.

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 (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.

More

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

Ok, thanks for your reply.

Tom

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!! visi.com

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 visi.com the hors d'oeuvres.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required