EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

RCM2110, compile to flash, run in RAM

Started by Tecnowatt - Massimo Sala February 3, 2005
Hi

I have a program that
- already work in "compile and run in flash";
- doesn't need to store configuration data.

I want to use RAM, I read in the docs it is the fastest memory.

I tried with Dynamic C 8.61 "compile to flash, run in RAM"
but it complains:

"line 160 : ERROR BOARDTYPES.LIB : Compile mode 'Code and BIOS in flash,
run in RAM' not supported for this board."

I also select "code and BIOS in flash, run in RAM" in the menu "Project
options - compiler", but it doesn't work.
In the BOARDTYPES.LIB I found

#if ((_BOARD_TYPE_ != RCM3200) && (_BOARD_TYPE_ != RCM3220A) \
&& (_BOARD_TYPE_ != BL2500C) && (_BOARD_TYPE_ != EM1500A) \
&& (_BOARD_TYPE_ != RCM3300A) && (_BOARD_TYPE_ != RCM3350A) \
&& (_BOARD_TYPE_ != RCM3310A) \
&& (_BOARD_TYPE_ != BL2600A) && (_BOARD_TYPE_ != BL2600D))
// For now, only allow FAST_RAM_COMPILE for RCM3200 boards
#error "Compile mode 'Code and BIOS in flash, run in RAM' not supported for
this board."
#endif If this is the explanation, I don't understand why I have Flash and SRAM on
the RCM2110.

What is the usage of the RAM ?

Are there specific memory directives to use (#memmap, root, ...) ?

I appreciate anyone can answer or let me know available and clear
documentation about this... RTFM !

ciao, Massimo



Feature "compile to flash, run in ram" is useful for such board that
runs at speeds where no static flash chip would be fast enough to
keep the clock pace without additional wait states. The border is
somewhere ~30MHz, so you do not need to care about that with R2k.
All ZWorld's R2000-based boards can run at their top speeds using
just flash memory for program code.

Current flashes goes as fast as ~45ns read cycle, still not fast
enough for those boards with 44MHz clock, i.e. RCM3200, 3300.
Such board has an additional fast RAM (~10ns), which is used to
"shadow" the original Flash contents, so allowing the fastest
execution possible. You can think of it just how old PCs used to copy
BIOS into faster RAM to get better performance, its just the same
idea.

Jaroslav


From: "Jaroslav Nemec" <nemec@neme...>
> Feature "compile to flash, run in ram" is useful for such board that
> runs at speeds above 30 MHz.
> All ZWorld's R2000-based boards can run at their top speeds using
> just flash memory for program code.
> You can think of it just how old PCs used to copy
> BIOS into faster RAM to get better performance


Jaroslav, thank you.

Returning to the RCM2110, the code run in flash.
So the RAM is available for... ?

I read the manuals, the docs and many users' postings.
There are many hi-tech suggestions about memory usage, options, and so for,
but in a few words what I have understood is:
- you can have a RCM2110 with 128 Kb SRAM and 256 Kb flash, but your code
and data work within 64 Kb of memory

- code: to use the flash, you have to
- try with #memmap xmem
or
- put xmem before the function name

- data: to use the flash
- use xalloc, root2xmem and xmem2root and the other xmem APIs Is this right ?

ciao, Massimo



--- In rabbit-semi@rabb..., "Tecnowatt - Massimo Sala"
<massimo.sala@t...> wrote:
> but in a few words what I have understood is:
> - you can have a RCM2110 with 128 Kb SRAM and 256 Kb flash, but
your code
> and data work within 64 Kb of memory
>
> - code: to use the flash, you have to
> - try with #memmap xmem
> or
> - put xmem before the function name

No. All you have to do is choose "Code and BIOS in Flash" in the
compiler options. The only other option for that board is "Code and
BIOS in RAM," and that is only usable when debugging.

xmem merely determines whether the code will go in the root code
segment or be elsewhere in flash where it is only addressable with 20
bit physical addresses or 16 bit addresses in the 0xE000-0xFFFF range
which get mapped into 20 bit addresses using the XPC register. If a
function is in xmem, it means that lcall/lret instructions which
operate on 20 bit addresses are used instead of call/ret which
operate on 16 bit addresses to call the function and return from. But
your code will normally be in flash on the RCM2110.

> - data: to use the flash
> - use xalloc, root2xmem and xmem2root and the other xmem APIs

No. xalloc allocates RAM with 20 bit addresses. root2xmem can copy
from anywhere addressable with a root (16 bit) pointer to RAM using a
20 bit address for the destination. xmem2root can copy from anywhere
to a root data, where the destination is addressed with a 16 bit
pointer and the source with a 20 bit address.

"root" used in the context of data means RAM in the stack or data
segements. "root" used in the context of code means flash (usually)
in the root, or base segment.

Suggested reading: TN202 and TN238
>
> Is this right ?
>
> ciao, Massimo




The 2024 Embedded Online Conference