Assembler Significant Characters And Directives
Assembler Directives
6-92
DSP ASSEMBLER REFERENCE MANUAL
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
The division of a program into sections controls not only labels and symbols, but also mac-
ros and
DEFINE
directive symbols. Macros defined within a section are private to that
section and are distinct from macros defined in other sections even if they have the same
macro name. Macros defined outside of sections are considered global and may be used
within any section. Similarly,
DEFINE
directive symbols defined within a section are pri-
vate to that section and
DEFINE
directive symbols defined outside of any section are glo-
bally applied. There are no directives that correspond to
XDEF
for macros or
DEFINE
symbols, and therefore, macros and
DEFINE
symbols defined in a section can never be
accessed globally. If global accessibility is desired, the macros and
DEFINE
symbols
should be defined outside of any section.
Sections can be nested to any level. When the Assembler encounters a nested section,
the current section is stacked and the new section is used. When the
ENDSEC
directive
of the nested section is encountered, the Assembler restores the old section and uses it.
The
ENDSEC
directive always applies to the most previous
SECTION
directive. Nesting
sections provides a measure of scoping for symbol names, in that symbols defined within
a given section are visible to other sections nested within it. For example, if section B is
nested inside section A, then a symbol defined in section A can be used in section B with-
out
XDEF
ing in section A or
XREF
ing in section B. This scoping behavior can be turned
off and on with the
NONS
and
NS
options respectively (see the
OPT
directive, this chap-
ter).
Sections may also be split into separate parts. That is, <section name> can be used mul-
tiple times with
SECTION
and
ENDSEC
directive pairs. If this occurs, then these separate
(but identically named) sections can access each others symbols freely without the use of
the
XREF
and
XDEF
directives. If the
XDEF
and
XREF
directives are used within one
section, they apply to all sections with the same section name. The reuse of the section
name is allowed to permit the program source to be arranged in an arbitrary manner (for
example, all statements that reserve X space storage locations grouped together), but re-
tain the privacy of the symbols for each section.
When the Assembler operates in relative mode (the default), sections act as the basic
grouping for relocation of code and data blocks. For every section defined in the source
a set of location counters is allocated for each DSP memory space. These counters are
used to maintain offsets of data and instructions relative to the beginning of the section.
At link time sections can be relocated to an absolute address, loaded in a particular order,
or linked contiguously as specified by the programmer. Sections which are split into parts
or among files are logically recombined so that each section can be relocated as a unit.
Sections may be relocatable or absolute. In the Assembler absolute mode (command line
-A
option) all sections are considered absolute. A full set of locations counters is reserved
for each absolute section unless the
GS
option is given (see the
OPT
directive, this chap-
ter). In relative mode, all sections are initially relocatable. However, a section or a part of
F
Freescale Semiconductor, Inc.
n
.