User`s guide
ELF Linker and Command Language
Linker Command File Syntax
293Targeting MC56F83xx/DSP5685x Controllers
Listing 10.11 Accessing a Global Symbol From C Program Sources
extern unsigned long _foot;
void main( void ) {
unsigned long i;
// ...
i = _foot; // _foot value determined in LCF
// ...
}
Expressions and Assignments
You can create symbols and assign addresses to those symbols by using the standard
assignment operator. An assignment may only be used at the start of an expression,
and a semicolon is required at the end of an assignment statement. An example of
standard assignment operator usage is shown in Listing 10.12
.
Listing 10.12 Standard Assignment Operator Usage
_symbolicname = some_expression; # Legal
_sym1 + _sym2 = _sym3; # ILLEGAL!
When an expression is evaluated and assigned to a variable, it is given either an
absolute or a relocatable type. An absolute expression type is one in which the symbol
contains the value that it will have in the output file. A relocatable expression is one in
which the value is expressed as a fixed offset from the base of a section.
Integral Types
The syntax for linker command file expressions is very similar to the syntax of the C
programming language. All integer types are long or unsigned long.
Octal integers (commonly know as base eight integers) are specified with a leading
zero, followed by numeral in the range of zero through seven. Listing 10.13
shows
valid octal patterns that you can put into your linker command file.
Listing 10.13 Sample Octal Patterns
_octal_number = 012;
_octal_number2 = 03245;