
21
The XPC segment at the top of the memory can also be used as a data segment by pro-
grams that are compiled into root memory. This is handy for small programs that need to
access a lot of data.
3.2.3 Practical Memory Considerations
The simplest Rabbit configurations have one flash memory chip interfaced using /CS0 and
one RAM memory chip interfaced using /CS1. Typical Rabbit-based systems use 256K of
flash and 128 K of RAM, but smaller or larger memories may be used.
Although the Rabbit can support code size approaching a megabyte, it is anticipated that
the great majority of applications will use less then 250K of code, equivalent to approxi-
mately 10,000–20,000 C statements. This reflects both the compact nature of Rabbit code
and the typical size of embedded applications.
Directly accessible C variables are limited to approximately 44K of memory, split
between data stored in flash and RAM. This will be more than adequate for many embed-
ded applications. Some applications may require large data arrays or tables that will
require additional data memory. For this purpose Dynamic C supports a type of extended
data memory that allows the use of additional data memory, even extending far beyond a
megabyte.
Requirements for stack memory depend on the type of application and particularly
whether preemptive multitasking is used. If preemptive multitasking is used, then each
task requires its own stack. Since the stack has its own segment in 16-bit address space, it
is easy to use available RAM memory to support a large number of stacks. When a pre-
emptive change of context takes place, the STACKSEG register can be changed to map
the stack segment to the portion of RAM memory that contains the stack associated with
the new task that is to be run. Normally the stack segment is 4K, which is typically large
enough to provide space for several (typically four) stacks. It is possible to enlarge the
stack segment if stacks larger than 4K are needed. If only one stack is needed, then it is
possible to eliminate the stack segment entirely and place the single stack in the data seg-
ment. This option is attractive for systems with only 32K of RAM that don’t need multiple
stacks.