EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Why use RAM mode

Started by topandurangs June 29, 2006
Hi all,

With MEMMAP we can select between Flash mode & RAM mode.
What is the use of RAM mode in ARM7.
When we boot the chip in RAM mode can we access FLASH.
Thanks in advance
Regards,
Pandurang S.

An Engineer's Guide to the LPC2100 Series

--- In l..., "topandurangs" wrote:
>
> Hi all,
>
> With MEMMAP we can select between Flash mode & RAM
mode.
> What is the use of RAM mode in ARM7.
> When we boot the chip in RAM mode can we access FLASH.
> Thanks in advance
> Regards,
> Pandurang S.
>

The ARM architecture defines a set of vectors (reset, IRQ etc.) at
address zero. This definition is fixed by the architecture and
cannot be changed.

The MEMMAP register provides a flexible mechanism to map different
areas of memory (boot block, internal flash memory base, SRAM base)
to address zero.

One reason for mapping RAM is to enable an application to
dynamically replace one or more of the vectors with a different one.
Another would be to use the vectors whilst the Flash is being re-
programmed.

Other (but not all) ARM7 ICs have similar mechanisms.

Brendan

--- In l..., "brendanmurphy37"
wrote:
>
> --- In l..., "topandurangs" wrote:
> >
> > Hi all,
> >
> > With MEMMAP we can select between Flash mode & RAM
> mode.
> > What is the use of RAM mode in ARM7.
> > When we boot the chip in RAM mode can we access FLASH.
> > Thanks in advance
> > Regards,
> > Pandurang S.
> > The ARM architecture defines a set of vectors (reset, IRQ etc.) at
> address zero. This definition is fixed by the architecture and
> cannot be changed.
>
> The MEMMAP register provides a flexible mechanism to map different
> areas of memory (boot block, internal flash memory base, SRAM
base)
> to address zero.
>
> One reason for mapping RAM is to enable an application to
> dynamically replace one or more of the vectors with a different
one.
> Another would be to use the vectors whilst the Flash is being re-
> programmed.
>
> Other (but not all) ARM7 ICs have similar mechanisms.
>
> Brendan
>

Hi Brendan,
Thank's for reply.
" The MEMMAP register provides a flexible mechanism to map different
areas of memory (boot block, internal flash memory base, SRAM base)
to address zero."
Is It mean that when i set MEMMAP to 2(i.e.is RAM MODE) whole
32kRAM(in case of LPC2136) will map to address zero.
"
" dynamically replace one or more of the vectors with a different
one.
"
can you please give me any example or need of dynamically replacing
vector.
Do you have any reference document for it.

Regards,
Pandurang S.

--- In l..., "topandurangs" wrote:
> Hi Brendan,
> Thank's for reply.
> " The MEMMAP register provides a flexible mechanism to map
different
> areas of memory (boot block, internal flash memory base, SRAM base)
> to address zero."
> Is It mean that when i set MEMMAP to 2(i.e.is RAM MODE) whole
> 32kRAM(in case of LPC2136) will map to address zero.

No: it's just the 1st 64 bytes that gets re-mapped.

> "
> " dynamically replace one or more of the vectors with a different
> one.
> "
> can you please give me any example or need of dynamically
replacing
> vector.
> Do you have any reference document for it.

The MEMMAP register is described in the relevant User Manual, which
can be downloaded from the Philips Web site. This can be a challenge
to find, but it's usually towards the end of the product description
page, e.g. at:

http://www.semiconductors.philips.com/pip/LPC2131_32_34_36_38_2.html

See the section on "System Control Block".

There's no examples shown. Normally, mapping to anything other than
flash probably isn't needed in most cases. You might need it however
if you needed to temporarily replace the vectors with different
locations if you were in some special mode: it's really down to the
application.

Brendan.

RAM mode is also used do run and test the code in debug mode, its faster than flash and you can use as many breakpoints you want.
----- Original Message -----
From: brendanmurphy37
To: l...
Sent: Thursday, June 29, 2006 7:48 AM
Subject: [lpc2000] Re: Why use RAM mode
--- In l..., "topandurangs" wrote:
> Hi Brendan,
> Thank's for reply.
> " The MEMMAP register provides a flexible mechanism to map
different
> areas of memory (boot block, internal flash memory base, SRAM base)
> to address zero."
> Is It mean that when i set MEMMAP to 2(i.e.is RAM MODE) whole
> 32kRAM(in case of LPC2136) will map to address zero.

No: it's just the 1st 64 bytes that gets re-mapped.

> "
> " dynamically replace one or more of the vectors with a different
> one.
> "
> can you please give me any example or need of dynamically
replacing
> vector.
> Do you have any reference document for it.

The MEMMAP register is described in the relevant User Manual, which
can be downloaded from the Philips Web site. This can be a challenge
to find, but it's usually towards the end of the product description
page, e.g. at:

http://www.semiconductors.philips.com/pip/LPC2131_32_34_36_38_2.html

See the section on "System Control Block".

There's no examples shown. Normally, mapping to anything other than
flash probably isn't needed in most cases. You might need it however
if you needed to temporarily replace the vectors with different
locations if you were in some special mode: it's really down to the
application.

Brendan.









--- In l..., "topandurangs" wrote:
>
> Hi all,
>
> With MEMMAP we can select between Flash mode & RAM mode.
> What is the use of RAM mode in ARM7.
> When we boot the chip in RAM mode can we access FLASH.
> Thanks in advance
> Regards,
> Pandurang S.

The RAM mode is used if you cannot afford to disable all (including
watchdog) interrupts for the 400 ms it takes to erase on-chip flash
sector and you do not have external memory to hold interrupt vectors.

Jaya

--- In l..., "jayasooriah"
wrote:
>
> --- In l..., "topandurangs" wrote:
> >
> > Hi all,
> >
> > With MEMMAP we can select between Flash mode & RAM
mode.
> > What is the use of RAM mode in ARM7.
> > When we boot the chip in RAM mode can we access FLASH.
> > Thanks in advance
> > Regards,
> > Pandurang S.
>
> The RAM mode is used if you cannot afford to disable all (including
> watchdog) interrupts for the 400 ms it takes to erase on-chip flash
> sector and you do not have external memory to hold interrupt
vectors.
>
> Jaya
>

Hi,

Thanks for reply.
I am executing my code with MEMMAP setting to 1(Flash
mode),which is perfectly working.But when i execute it from RAM mode
it is not working.What step i should follow to execute it from RAM
mode.
MY CODE( Program memory) SIZE is 50Kb
DATA RAM used is approx 25Kb.

Regards,
Pandurang S.

--- In l..., "topandurangs" wrote:
> Hi,
>
> Thanks for reply.
> I am executing my code with MEMMAP setting to 1(Flash
> mode),which is perfectly working.But when i execute it from RAM mode
> it is not working.What step i should follow to execute it from RAM
> mode.
> MY CODE( Program memory) SIZE is 50Kb
> DATA RAM used is approx 25Kb.
>
> Regards,
> Pandurang S.
>

Can you explain what you mean by "RAM mode"? You do not have to do
anything special to execute code from RAM (other than ensure the code
is loaded there, of course).

All the MEMMAP register does is map a block of 64 bytes to address
zero.

Maybe someone could help more if you explained:

- what exact part you are using?
- if you are using external memory?
- what exactly you are trying to do?
- why you think you need to change MEMMAP?

Brendan.

--- In l..., "brendanmurphy37"
wrote:
>
> --- In l..., "topandurangs" pandurang@ wrote:
> > Hi,
> >
> > Thanks for reply.
> > I am executing my code with MEMMAP setting to 1(Flash
> > mode),which is perfectly working.But when i execute it from RAM mode
> > it is not working.What step i should follow to execute it from RAM
> > mode.
> > MY CODE( Program memory) SIZE is 50Kb
> > DATA RAM used is approx 25Kb.
> >
> > Regards,
> > Pandurang S.
> > Can you explain what you mean by "RAM mode"? You do not have to do
> anything special to execute code from RAM (other than ensure the code
> is loaded there, of course).
>
> All the MEMMAP register does is map a block of 64 bytes to address
> zero.
>
> Maybe someone could help more if you explained:
>
> - what exact part you are using?
> - if you are using external memory?
> - what exactly you are trying to do?
> - why you think you need to change MEMMAP?
>
> Brendan.
>

Hi,

" what exactly you are trying to do?
why you think you need to change MEMMAP? "
I am not having specific requirment to do these checking.I am trying
to understand the things that is given in datasheet of the device.

"what exact part you are using? "
I am using LPC2138 device without external memory.

As given in data sheet,
Table 12: Memory Mapping control register (MEMMAP - address 0xE01F
C040) bit description
Bit Symbol Value Description Reset
value
1:0 MAP
00 Boot Loader Mode. Interrupt vectors are
re-mapped to Boot Block.

01 User Flash Mode. Interrupt vectors are
not re-mapped and reside in Flash.

10 User RAM Mode. Interrupt vectors are
re-mapped to Static RAM.

11 Reserved. Do not use this option.

from above table,i understand that with RAM mode (MEMMAP = 2), i will
able to locate my all code with interrupt vector in RAM & it benifit me
to execute my code fast.
I am not sure that how much i am correct.Please correct me if i am in
wrong direction.
Thanks once again.

Regards,

Pandurang S.



--- In l..., "topandurangs" wrote:
> from above table,i understand that with RAM mode (MEMMAP = 2), i will
> able to locate my all code with interrupt vector in RAM & it benifit
me
> to execute my code fast.
> I am not sure that how much i am correct.Please correct me if i am
in
> wrong direction.
> Thanks once again.
>
> Regards,
>
> Pandurang S.
>

I think you need to get a better understanding of the device before
looking at specific registers.

Try http://www.hitex.co.uk/arm/lpc2000book/index.html for a good
introduction, particularly chapter 3, which covers memory. You should
also read the relevant sections of the LPC213x User Manual.

Very briefly:

- The LPC2000 series includes a memory accelerator module (MAM) that
speeds up access to Flash.

- As a consequence there is little speed advantage to running from
RAM. This is in contrast to other ARM7 MCUs (e.g. Oki).

- In general it is much easier to set up the MAM and run from flash:
easier because RAM is relatively small; you don't have to load the
code into RAM; you don't have to mess round with re-locating code etc.
etc.

- Running from RAM is however useful if you have a debugger attached
to the device: you can load small programs directly through the JTAG
in interface, and run them from there. This is faster than re-flashing
and you are not restricted in the number of breakpoints you can set.

- As I said before, the MEMMAP register has nothing to do with whether
or not you are running from flash or RAM. You can quite happily run
code from RAM with the MEMAP register set to flash. All it does is map
64-bytes from one of several different locations to address zero. You
will need to have an understanding of the ARM architecture and
exception mechanisms to understand why this is useful.

In other words, you probably don't need to run from RAM, except when
debugging small sections of code.

I hope this is of some use. One of the problems with non-proprietary
controllers is that information can be scattered over several sources.
I'd recommend reading at least the introductory material from:

- ARM ARM7TDMI Technical Reference (from ARM)
- Philips LPC213x User Manual (from Philips)
- Whatever tool vendor documentation is available (tool dependent)
- The Hitex book referred to above
- Examples in the Files section of this Group (in partciular the
gcc_and_ucosii.zip documentation)

Hopefully, this will be of some help.

Brendan.


Memfault Beyond the Launch