EmbeddedRelated.com
Forums

__ram attribute in Keil CA compiler

Started by varuzhandanielyan December 9, 2004

I have written very simple code just to evaluate the LPC2129
speed for the Keil MCB2100 board:

void Meander(void)
{
unsigned int n;

n = 0x00010000;
while (1) {
IOSET1 = n;
IOCLR1 = n;
}
}

It works well and I can scope the meander pulses. But when I add
the __ram attribute:

void Meander(void) __ram

The program does not work. Should I make any other changes in the
program or compiler settings to force the code work from RAM?

Thanks,
Varuzhan



An Engineer's Guide to the LPC2100 Series


Ok,

I write ERAM(0x40003F00-0x40003FFF) in the mentioned place
and it works. But two more questions
1. Isn't it possible to force the system to automatically allocate
necessary space for ERAM segment?
2. Very strange, but the code (see below) runs from the RAM with the
same speed as from Flash. What mistake I do?

Thank you in advanca,
Varuzhan --- In , "beano040461" <paulbearne@b...> wrote:
>
> --- In , "varuzhandanielyan" <dan@x> wrote:
> >
> > I have written very simple code just to evaluate the LPC2129
> > speed for the Keil MCB2100 board:
> >
> > void Meander(void)
> > {
> > unsigned int n;
> >
> > n = 0x00010000;
> > while (1) {
> > IOSET1 = n;
> > IOCLR1 = n;
> > }
> > }
> >
> > It works well and I can scope the meander pulses. But when I add
> > the __ram attribute:
> >
> > void Meander(void) __ram
> >
> > The program does not work. Should I make any other changes in the
> > program or compiler settings to force the code work from RAM?
> >
> > Thanks,
> > Varuzhan
>
> You need at the location of ram you wish to use to run the code
> In the la locate user classes section of the target options use the
> ERAM directive
> i.e
> ERAM(0x0400-0x4FF)
> making sure that you allocate enough space for the function
> paul