Designer’s
Handbook
13
to
flash memory. It may be mapped to RAM for debugging, or if it is decided to copy code
to
RAM to take advantage of faster access time offered by RAM. The root segment holds
a
mixture of code and constants. C functions or assembly language programs that are com-
piled
to the root segment are interspersed with data constants. Data constants are inserted
between
blocks of code. Data constants defined inside a C function are emitted after the
end
of the code belonging to the function. Data constants defined outside of C functions
are
emitted as encountered in the source code.
Except
in small programs, the bulk of the code is executed using the extended memory
window.
But the root segment has special properties that make it better for some types of
code.
The types of subroutines and functions that are best placed in the root segment are
as
follows.
1. Short
subroutines of about 20 instructions or less that are frequently called will use sig-
nificantly
less execution time if placed in the root because of the faster calling linkage
for
16-bit versus 20-bit addresses. A call and return using 16-bit addressing requires 20
clocks,
compared to 32 clocks for 20-bit addressing.
2. Interrupt
routines. Interrupts use 16-bit addressing so the entry to an interrupt routine
must
be in root.
3. Functions
called indirectly using traditional C pointers.
4. The
BIOS core. A certain part of the BIOS must be at the start of the root segment.
Figure
3.
Typical
Layout
of
Root
Segment
4.1.2
The Data Segment
The
data segment is mapped to RAM and contains C variables. Typically it starts at 8K or
above
and ends at 52K. Data allocation starts at or near the top and proceeds in a down-
ward
direction. It is also possible to place executable code in the data segment if it is cop-
ied
from flash to the data segment. This can be desirable for code that is self modifying,
code
to implement debugging aids or code that controls write to the flash memory and
0K
System
Constants
BIOS
Start
System
ID (256 bytes)
BIOS
Functions
Constant
defs
Max
48K
Summary of Contents for 2000
Page 1: ...Rabbit 2000 Microprocessor Designers Handbook Revision C...
Page 4: ...Rabbit 2000 Microprocessor...
Page 6: ...2 Rabbit 2000 Microprocesssor...
Page 12: ...8 Rabbit 2000 Microprocessor...
Page 34: ...344 Dynamic C User s Manual...
Page 36: ...34 Rabbit 2000 Microprocessor...
Page 44: ...42 Rabbit 2000 Microprocessor...