EmbeddedRelated.com
Forums

How to Execute Flash Code in RAM (LPC2888)

Started by Sait Izmit June 3, 2008
Ah, OK, I understand now, the code can run _only_ from RAM. Thanks.

On Wed, Jun 4, 2008 at 11:59 AM, Paul Curtis wrote:
> Hi,
>
>> I assume you mean "there is no PIC requirement in this particular
>> case", right? Because in general I assume that you need some sort of
>> PIC if you're moving code around.
>
> You only need PIC if you don't know, in advance, where the code will
> execute. In this case there is no PIC requirement because you know the code
> will run from a known place in RAM (the linker chooses it), it's just a
> matter of getting the RAM filled with the right instructions--that's what
> the startup code does for you.
>
> --
> Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors

An Engineer's Guide to the LPC2100 Series

Paul,

I understand that but as I told earlier I am using uVision with Keil
compiler and I am defining the startup.s file. Do you or anyone else
knows how to do the copying with the keil compiler or in the
startup.s file?

By the way, I am new to this memory re-mapping bussiness therefore
please excuse me if i am asking some newbie questions:-)

Thanks,

Sait
--- In l..., "Paul Curtis" wrote:
>
> Hi,
>
> > Thanks for the input so far!
> >
> > Herbert, I can not see much difference about the way we define the
> > scatter files.
> >
> > Jim and Paul, I tried to define the attribute however the code
runs
> > from FLASH. But Paul's reply made me curious if I am doing
something
> > wrong with my startup.s file. Because I just use an example
startup.s
> > file I never changed it. So my question is if startup.s is
> > responsible for copying the code from flash to RAM? Because I
believe
> > that my scatter file is ok. Here is the startup.s file I have:
>
> Code copying is done by the CrossWorks startup code; sorry if
Jim's/my
> comments did not make the context clear.
>
> --
> Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors
>

Dear all,

After reading the compilation manual I found the problem. The C-
library module that is responsible for copying the code according to
the scatter file is called __main.o . Therefore at the end of the
startup code this module has to be called. Instead of __main I was
calling main, that is why the code wasn't copied.

--- In l..., "Sait Izmit" wrote:
>
> Paul,
>
> I understand that but as I told earlier I am using uVision with
Keil
> compiler and I am defining the startup.s file. Do you or anyone
else
> knows how to do the copying with the keil compiler or in the
> startup.s file?
>
> By the way, I am new to this memory re-mapping bussiness therefore
> please excuse me if i am asking some newbie questions:-)
>
> Thanks,
>
> Sait
> --- In l..., "Paul Curtis" wrote:
> >
> > Hi,
> >
> > > Thanks for the input so far!
> > >
> > > Herbert, I can not see much difference about the way we define
the
> > > scatter files.
> > >
> > > Jim and Paul, I tried to define the attribute however the code
> runs
> > > from FLASH. But Paul's reply made me curious if I am doing
> something
> > > wrong with my startup.s file. Because I just use an example
> startup.s
> > > file I never changed it. So my question is if startup.s is
> > > responsible for copying the code from flash to RAM? Because I
> believe
> > > that my scatter file is ok. Here is the startup.s file I have:
> >
> > Code copying is done by the CrossWorks startup code; sorry if
> Jim's/my
> > comments did not make the context clear.
> >
> > --
> > Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> > CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3
processors
>