Assigning The Spc To A Symbol - Texas Instruments TMS320C54x User Manual

Digital signal processors
Hide thumbs Also See for TMS320C54x:
Table of Contents

Advertisement

Assigning Symbols at Link Time

7.14.2 Assigning the SPC to a Symbol

7.14.3 Assignment Expressions
7-58
A special symbol, denoted by a dot ( . ), represents the current value of the SPC
during allocation. The linker's "." symbol is analogous to the assembler's $
symbol. The "." symbol can be used only in assignment statements within a
SECTIONS directive because "." is meaningful only during allocation, and
SECTIONS controls the allocation process.
The "." symbol refers to the current run address, not the current load address,
of the section.
For example, suppose a program needs to know the address of the beginning
of the .data section. By using the .global directive, you can create an external
undefined variable called Dstart in the program. Then assign the value of " . "
to Dstart:
SECTIONS
{
.text:
{}
.data:
{ Dstart = .; }
.bss:
{}
}
This defines Dstart to be the first linked address of the .data section. (Dstart
is assigned before .data is allocated.) The linker will relocate all references to
Dstart.
A special type of assignment assigns a value to the "." symbol. This adjusts
the SPC within an output section and creates a hole between two input sec-
tions. Any value assigned to "." to create a hole is relative to the beginning of
the section, not to the address actually represented by ".". Assignments to "."
and holes are described in Section 7.15, Creating and Filling Holes , on page
7-61.
These rules apply to linker expressions:
-
Expressions can contain global symbols, constants, and the C language
operators listed in Table 7–1.
-
All numbers are treated as long (32-bit) integers.
-
Constants are identified by the linker in the same way as by the assembler.
That is, numbers are recognized as decimal unless they have a suffix (H
or h for hexadecimal and Q or q for octal). C language prefixes are also
recognized (0 for octal and 0x for hex). Hexadecimal constants must begin
with a digit. No binary constants are allowed.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the TMS320C54x and is the answer not in the manual?

Table of Contents