Texas Instruments TMS320 User Manual page 44

Dsp/bios v5.40
Hide thumbs Also See for TMS320:
Table of Contents

Advertisement

Configuring DSP/BIOS Applications Statically
2-14
❏ Declare static objects with the far keyword. The DSP/BIOS compiler
supports this common extension to the C language. The far keyword in a
data declaration indicates that the data is not in the .bss section.
For example, to reference a PIP object called inputObj that was created
statically, declare the object as follows:
extern far PIP_Obj inputObj;
if (PIP_getReaderNumFrames(&inputObj)) {
. . .
}
❏ Create and initialize a global object pointer. You can create a global
variable that is initialized to the address of the object you want to
reference. All references to the object must be made using this pointer,
to avoid the need for the far keyword. For example:
extern PIP_Obj inputObj;
/* input MUST be a global variable */
PIP_Obj *input = &inputObj;
if (PIP_getReaderNumFrames(input)) {
. . .
}
Declaring and initializing the global pointer consumes an additional word
of data (to hold the 32-bit address of the object).
Also, if the pointer is a static or automatic variable this technique fails.
The following code does not operate as expected when compiled using
the small model:
extern PIP_Obj inputObj;
static PIP_Obj *input = &inputObj;
if (PIP_getReaderNumFrames(input)) {
. . .
}
❏ Place all objects adjacent to .bss. If all objects are placed at the end of
the .bss section, and the combined length of the objects and the .bss data
is less than 32K bytes, you can reference these objects as if they were
allocated within the .bss section:
extern PIP_Obj inputObj;
if (PIP_getReaderNumFrames(&inputObj)) {
. . .
}
You can guarantee this placement of objects by using the configuration
as follows:
/* ERROR!!!! */

Advertisement

Table of Contents
loading

Table of Contents