User`s manual

126 digi.com Memory Management
If BIOS code runs from flash memory, the BIOS code starts in the root code section at address 0x00000
and fills upward. The rest of the root code will continue to fill upward immediately following the BIOS
code. If the BIOS code runs from SRAM, the root code section, along with root data and stack sections,
will start at address 0x80000.
9.1.1 Memory Mapping Control
The advanced user of Dynamic C can control how Dynamic C allocates and maps memory. For details on
memory mapping, refer to any of the Rabbit microprocessor users manuals or designers handbooks. You
can also refer to one of our technical notes: TN202, “Rabbit Memory Management in a Nutshell.” All of
these documents are available at:
www.digi.com/support
9.1.2 Macro to Use Second Flash for Code
The macro USE_2NDFLASH_CODE can be uncommented in the file sysconfig.lib to cause the
compiler to use a second available flash for xmem code.
9.2 Extended Memory Functions
A program can use many pages of extended memory (xmem). Under normal execution, code in xmem
maps to the logical address region 0xE000 to 0xFFFF. Use the Dynamic C functions root2xmem(),
xmem2root() and xmem2xmem()to move blocks of data between logical memory and physical mem-
ory.
9.3 Code Placement in Memory
Code runs just as quickly in extended memory as it does in root memory, but calls to and returns from the
functions in extended memory take a few extra machine cycles. Code placement in memory can be
changed by the keywords xmem and root, depending on the type of code:
Pure Assembly Routines
Pure assembly functions may be placed in root memory or extended memory. Prior to Dynamic C version
7.10, pure assembly routines had to be in root memory.
C Functions
C functions may be placed in root memory or extended memory. Access to variables in C statements is not
affected by the placement of the function. Dynamic C will automatically place C functions in extended
memory as root memory fills. Short, frequently used functions may be declared with the root keyword to
force Dynamic C to load them in root memory.