Section 2: Compiler
87
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
2.13. Sections
The TI-89 / TI-92 Plus SDK includes example invocations of the compiler. You
must use the sections as shown in those files when compiling applications. The
compiler places information into four different sections for TI-89 / TI-92 Plus
applications: .text, .data, .const, and .bss (blank static storage). Initialized static
data that has not been declared const is placed into .data. Uninitialized static
data is placed into .bss. The .bss section is set to zero during app initialization.
For more detailed information on application data storage and initialization, see
chapter 7. Flash Application Layout in the TI-89 / TI-92 Plus Developers Guide
supplied with the TI-89 / TI-92 Plus SDK.
2.14.
Static Storage Initialization
A data object with static storage duration can be assigned an initial value when it
is declared. The initializing value is placed directly into the .text, .const, or .data
section of the program by the compiler; the assignment is not made at run-time.
If a static data object is not initialized in a declaration, the data object is assigned
to the .bss section where it is set to zero at the start of program execution.
An initializer for an integer or floating-point data object must be an expression
that evaluates to a constant during compilation. A compile-time constant
expression may contain an arbitrary number of operators and subexpressions
and include both integer and floating-point constants. The same data type
conversions that apply across an assignment at run-time also apply to
compile-time initializations. The following are examples of legal compile-time
initializations:
int a = 50;
double b = 3.1415926;
int c = 2 * (5 + 7 / 3) - (122 && 15);
int *d = &c + 50;
char *e = (char *)0x80000;
When a scalar (pointer or arithmetic object) is initialized, a single expression
optionally enclosed in a single set of braces, is permitted in the declaration.
See section 2.12.2 Internal Floating-Point Functions for more information on
initializing floating-point data objects. An initializer for a pointer must be an
expression that evaluates to an integer constant at compile-time or the address
of a static object, plus or minus a constant expression. When the address of an
object appears in an initializer the object must have been declared previously in
the same file. When a nonzero constant expression is used to initialize a pointer,
the expression must be cast to the appropriate pointer type.