Pragma Directives
5-7
TMS320C2x/C2xx/C5x C Language
5.4 Pragma Directives
Pragma directives tell the compiler’s preprocessor how to treat functions. The
TMS320C2x/C2xx/C5x C compiler supports the following pragmas:
-
CODE_SECTION
-
DATA_SECTION
-
FUNC_EXT_CALLED
Two of these pragmas use the arguments
func
and
symbol
. These arguments
must have file scope; that is, you cannot define or declare them inside the body
of a function. You must specify the pragma outside the body of a function, and
it must occur before any declaration, definition, or reference to the
func
or
sym-
bol
argument. If you do not follow these rules, the compiler issues a warning.
5.4.1 The CODE_SECTION Pragma
The CODE_SECTION pragma allocates space for the
symbol
in a section
named
section name
. The syntax of the pragma is:
#pragma CODE_SECTION (
symbol
,
”section name”
);
The CODE_SECTION pragma is useful if you have code objects that you want
to link into an area separate from the .text section.
1 demonstrates the use of the CODE_SECTION pragma.
Example 5
−
1. Using the CODE_SECTION Pragma
(a) C source file
#pragma CODE_SECTION(fn, ”my_sect”)
int fn(int x)
{
return c;
}
(b) Assembly source file
.file
”CODEN.c”
.sect
”my_sect”
.global _fn
.sym
_fn,_fn,36,2,0
.func
3
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...