--- In lpc2000@yahoogroups.com, "Ake Hedman, eurosource" <akhe@b...>
wrote:
>
>> Sometimes you want some functions in RAM. Those functions count
>> as initialized global/static variables.
>
> How do one make a function go into ram?
With gcc, the easiest way is like this:
static void ramfunc (int i) __attribute__ ((section(".data")));
static void ramfunc (int i)
{
/* ... */
}
This means that the compiler puts the function in section .data
instead of .text, and the linker and startup code then locates and
processes it like initialized data, i.e. stores an initial copy in
flash, and lets the startup code copy it to RAM. The final RAM
address is then used when you reference the function.
Note that flash and RAM functions cannot call each other directly
since flash and RAM are more than 32 MB apart in the memory map, out
of reach by the BL instruction. You then have to use indirect calls
through function pointers.
Karl OlsenMessage
Re: Flash Versus RAM
2005-11-14 by Karl Olsen
Attachments
- No local attachments were found for this message.