User`s manual

Dynamic C Users Manual digi.com 333
17.4 Root Memory Reduction Tips
Customers with programs that are near the limits of root code and/or root data space usage will be inter-
ested in these tips for saving root space. For more help, see Technical Note TN238 “Rabbit Memory Usage
Tips.” This document is available at: digi.com, or by choosing Online Documentation from within the
Help menu of Dynamic C.
17.4.1 Increasing Root Code Space
Increasing the available amount of root code space may be done in the following ways:
Enable Separate Instruction and Data Space
A hardware memory management scheme that uses address line inversion to double the amount of logi-
cal address space in the base and data segments is enabled on the Compiler tab of the
Options | Project
Options
dialog. Enabling separate I&D space doubles the amount of root cod and root data available for
an application program.
Use #memmap xmem
This will cause C functions that are not explicitly declared as “root” to be placed in xmem. Note that the
only reason to locate a C function in root is because it modifies the XPC register (in embedded assembly
code), or it is an ISR. The only performance difference in running code in xmem is in getting there and
returning. It takes a total of 12 additional machine cycles because of the differences between
call/lcall, and ret/lret.
Increase DATAORG
The macro DATAORG is the beginning logical address for the data segment.
Root code space can be increased by increasing DATAORG in the BIOS (in RabbitBios.c prior to
Dynamic C version 9.30 or in StdBIOS.c thereafter) in increments of 0x1000. The default is 0x3000
when separate I&D space is on, and 0x6000 otherwise. It can be as high as 0xB000.
When separate I&D space is on, DATAORG defines the boundary between root variable data and root
constant data. In this case, increasing DATAORG increases root constant space and decreases root vari-
able space.
When separate I&D space is off, DATAORG defines the boundary between root variable data and the
combination of root code and root constant data. Note that root constants are in the base segment with
root code. In this case, increasing DATAORG increases root code and root constant space and decreases
root data space.
Compile out floating point support
Floating point support can be conditionally compiled out of stdio.lib by adding #define
STDIO_DISABLE_FLOATS to either a user program or the Defines tab page in the Project Options
dialog. This can save several thousand bytes of code space.