How to Save On-Chip Memory by Placing RTS Off-Chip
4-6
4.2
How to Save On-Chip Memory by Placing RTS Off-Chip
One of many techniques you might use to save valuable on-chip space is to
place the code and data needed by the runtime-support (RTS) functions in off-
chip memory.
Placing the RTS in off-chip memory has the advantage of saving valuable on-
chip space. However, it comes at a cost. The RTS functions will run much slow-
er. Depending on your application, this may or may not be acceptable. It is also
possible your application doesn’t use the RTS library much, and placing the
RTS off-chip saves very little on-chip memory.
Table 4–1. Definitions
Term
Means
Normal RTS
functions
Ordinary RTS functions. Example: strcpy
Internal RTS
functions
Functions which implement atomic C operations such as divide or floating point math on the
C62x and C64x. Example: _divu performs 32-bit unsigned divide.
near calls
Function calls performed with a ordinary PC-relative branch instruction. The destination of
such branches must be within 1 048 576 (0x100000) words of the branch. Such calls use 1
instruction word and 1 cycle.
far calls
Function calls performed by loading the address of the function into a register and then
branching to the address in the register. There is no limit on the range of the call. Such calls
use 3 instruction words and 3 cycles.
4.2.1
How to Compile
Make use of shell (cl6x) options for controlling how RTS functions are called:
Table 4–2. Command Line Options for RTS Calls
Option
Internal RTS calls
Normal RTS calls
Default
Same as user
Same as user
–mr0
Near
Near
–mr1
Far
Far
By default, RTS functions are called with the same convention as ordinary
user-coded functions. If you do not use a –ml
n option to enable one of large-
memory models, then these calls will be near. The option –mr0 causes calls