> 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