Reply by Ewout Boks May 27, 20062006-05-27
> Message 1
> From: "sgimin.tw" s...@yahoo.com.tw
> Date: Thu May 25, 2006 4:44am(PDT)
> Subject: About the keyword "ramfunc"
>
> Dear sirs,
>
> I am the new user for the GCC. When I use the GCC to compile the code,
> there will show the error message because it can't parse the
> keyword "__ramfunc". Could you tell me why the code use this keyword ?
> And if I remove all these keywords in codes, will any problem happen ?
> Or please tell me how to prevent this error message.
>
> Thanks for your help.
>
>

When using GCC, this IAR keyword does not work.

For a similar effect with GCC, use the __attribute__ compiler
instruction to construct a the following define:

#define RAMFUNC __attribute__ ((long_call, section (".ramsection")))
Then, when you declare a function you can instructthe linker to place
the code in RAM:

void foo() RAMFUNC;

void foo()
{

......... your code ...........

}

Also, in your linker map you need to indicate where .ramsection resides:

.data : AT (_etext)
{
_data = . ;
KEEP(*(.vectram)) /* added by mthomas */
*(.data)
SORT(CONSTRUCTORS)
. = ALIGN(4);
*(.ramsection) /* here your ramsection will be located */
} >DATA
. = ALIGN(4);
When you remove all RAMFUNC keywords, not much more wil happen than that
the linker will place your code in the default section (flash or sram,
depends on your linker map.

Placing code in SRAM has the benefit of speed. For example, putting your
interrupt handlers there is a good idea.

Ewout





Reply by Microbit May 26, 20062006-05-26
Hi,

__ramfunc is an intrinsic of IAR.
Using this places a function in RAM instead of Flash.
Code that for example reprograms flash at runtime can't execute from Flash, since the
flash controller takes flash off-line, causing the program to crash.
In that case you must run that function from RAM.
With CrossWorks for ARM I use the attribute "fast".
As CWARM is GCC based, I assume you can use that.
Look in your documentation how to set the attribute for a function to fast.
(syntax is same as eg. attribute "IRQ")

You can also use this to run code at maximum speed, as RAM is zero-wait state on SAM7
at max. clock speed.

HTH
B rgds
Kris

-----Original Message-----
From: A... [mailto:A...] On Behalf Of sgimin.tw
Sent: Thursday, 25 May 2006 9:07 PM
To: A...
Subject: [AT91SAM] About the keyword "ramfunc"

Dear sirs,

I am the new user for the GCC. When I use the GCC to compile the code,
there will show the error message because it can't parse the
keyword "__ramfunc". Could you tell me why the code use this keyword ?
And if I remove all these keywords in codes, will any problem happen ?
Or please tell me how to prevent this error message.

Thanks for your help.
Reply by "sgimin.tw" May 25, 20062006-05-25
Dear sirs,

I am the new user for the GCC. When I use the GCC to compile the code,
there will show the error message because it can't parse the
keyword "__ramfunc". Could you tell me why the code use this keyword ?
And if I remove all these keywords in codes, will any problem happen ?
Or please tell me how to prevent this error message.

Thanks for your help.