Rabbit 2000 Designers Handbook - page 15
Designer’s
Handbook
11
Static
RAM memory may or may not be battery-backed, which means it retains its data
when
power is off. Static RAM chips typically used for Rabbit systems are 32K, 64K.
128K,
256K, or 512K. When the memory is battery-backed, power is supplied at 2 V to
3 V
from a backup battery. The shutdown circuitry must keep the chip select line high
while
preserving memory contents with battery power.
A
basic Rabbit system has two static memory chips, one flash memory chip and one RAM
memory
chip. Additional static memory chips may be added. If the user’s application
requires
storing data in flash memory, particularly a lot of data, then it will often be pru-
dent
to add another flash memory chip for the user’s data, creating a system with three
memory
chips—two flash memory chips and one RAM chip. Trying to use a single flash
memory
chip to store both the user’s program and live data that most be frequently
changed
often creates software problems. When data are written to a small-sector flash
memory,
the memory becomes inoperative during the 5 ms or so that it takes to write a
sector.
If the same memory chip is used to hold data and the program, then the execution
of
code must cease during this write time. The 5 ms is timed out by a small routine execut-
ing
from RAM while system interrupts are disabled, effectively freezing the system for 5
ms.
The 5 ms lockup period can seriously affect real-time operation.
From
the point of view of a Dynamic C programmer, there are a number of different uses
of
memory. Each memory use occupies a different segment in the 16-bit address space.
The
four segments are shown in Figure 1 on page 12.
The
segments are named the root segment, the data segment, the stack segment, and the
extended
code segment.
Note:
Logical addresses above 0xDFFF are referred to as extended memory, and some-
times
all of the logical memory below that is sometimes referred to as “root” memory.
However
root in the following context refers to lowest segment in logical memory, which
usually
comprises only a part of the non-extended memory.
•
Root
Code—Instructions in the root segment. Instructions may also be stored in the
extended
code segment. Code in the root segment operates slightly faster and plays a
special
role for certain special uses. The root segment is normally mapped to flash
memory
since the code does not change except when the system is reprogrammed.
•
Root
Constants—C constants, such as quoted strings or data tables are stored in flash
memory
in the root segment. This constants intermixed with root code. The constants
only
change when the system is reprogrammed.
•
Root
Variables—Root variables are stored in the data segment which is mapped to
RAM.
Variables include C variables, including structures and arrays that are not initial-
ized
to a fixed value.
•
Stack
Memory—Stack is implemented in the stack segment. The stack segment is nor-
mally
4K long and is always mapped to RAM. Multiple stacks may be implemented by
defining
several stacks in the 4k space or by remapping the 4K space to different loca-
tions
in physical RAM memory, or by using both approaches.