50 Asm MN Rev 3.4
50 Asm MN Rev 3.4
0
Assembler and Preprocessor Manual
(including the ADSP-BFxxx, ADSP-21xxx, ADSP-TSxxx)
a
Copyright Information
© 2010 Analog Devices, Inc., ALL RIGHTS RESERVED. This docu-
ment may not be reproduced in any form without prior, express written
consent from Analog Devices, Inc.
Printed in the USA.
Disclaimer
Analog Devices, Inc. reserves the right to change this product without
prior notice. Information furnished by Analog Devices is believed to be
accurate and reliable. However, no responsibility is assumed by Analog
Devices for its use; nor for any infringement of patents or other rights of
third parties which may result from its use. No license is granted by impli-
cation or otherwise under the patent rights of Analog Devices, Inc.
PREFACE
Purpose ........................................................................................ xiii
Intended Audience ....................................................................... xiii
Manual Contents ......................................................................... xiv
What’s New in this Manual .......................................................... xiv
Technical or Customer Support .................................................... xiv
Supported Processors ..................................................................... xv
Product Information .................................................................... xvi
Analog Devices Web Site ........................................................ xvi
VisualDSP++ Online Documentation ..................................... xvi
Technical Library CD ............................................................ xvii
EngineerZone ....................................................................... xviii
Social Networking Web Sites ................................................ xviii
Notation Conventions ................................................................ xviii
ASSEMBLER
Assembler Guide ........................................................................... 1-2
Assembler Overview ................................................................ 1-3
Writing Assembly Programs ..................................................... 1-3
PREPROCESSOR
Preprocessor Guide ....................................................................... 2-2
Writing Preprocessor Commands ............................................. 2-3
Header Files and #include Command ...................................... 2-4
System Header Files ............................................................ 2-5
User Header Files ............................................................... 2-5
Sequence of Tokens ............................................................ 2-5
Include Path Search ............................................................ 2-6
Writing Macros ....................................................................... 2-7
Macro Definition and Usage Guidelines .............................. 2-8
Examples of Multi-Line Code Macros with Arguments ...... 2-12
Debugging Macros ........................................................... 2-13
Using Predefined Preprocessor Macros ................................... 2-14
-D__VISUALDSPVERSION____ Predefined Macro ........ 2-16
Specifying Preprocessor Options ............................................ 2-16
Preprocessor Command Reference ............................................... 2-17
Preprocessor Commands and Operators ................................. 2-18
#define ............................................................................. 2-19
Variable-Length Argument Definitions .......................... 2-20
#elif ................................................................................. 2-22
INDEX
Thank you for purchasing Analog Devices, Inc. development software for
digital signal processing (DSP) applications.
Purpose
The VisualDSP++ 5.0 Assembler and Preprocessor Manual contains infor-
mation about the assembler and preprocessor utilities for the following
Analog Devices, Inc. processor families—Blackfin® (ADSP-BFxxx),
SHARC® (ADSP-21xxx), and TigerSHARC® (ADSP-TSxxx) processors.
The manual describes how to write assembly programs for these processors
and provides reference information about related development software.
It also provides information on new and legacy syntax for assembler and
preprocessor directives and comments, as well as command-line switches.
Intended Audience
The primary audience for this manual is a programmer who is familiar
with Analog Devices processors. This manual assumes that the audience
has a working knowledge of the appropriate processor architecture and
instruction set. Programmers who are unfamiliar with Analog Devices
processors can use this manual, but should supplement it with other texts
(such as the appropriate hardware reference and programming reference
manuals) that describe your target architecture.
Manual Contents
The manual consists of:
• Chapter 1, “Assembler”
Provides an overview of the process of writing and building
assembly programs. It also provides information about assembler
switches, expressions, keywords, and directives.
• Chapter 2, “Preprocessor”
Provides procedures for using preprocessor commands within
assembly source files as well as the preprocessor’s command-line
interface options and command sets.
Supported Processors
The assembler and preprocessor of VisualDSP++ 5.0 supports the follow-
ing Analog Devices, Inc. processors.
• Blackfin (ADSP-BFxxx)
• SHARC (ADSP-21xxx)
• TigerSHARC (ADSP-TSxxx)
The majority of the information in this manual applies to all processors.
For a complete list of processors supported by VisualDSP++ 5.0, refer to
the online Help.
Product Information
Product information can be obtained from the Analog Devices Web site,
VisualDSP++ online Help system, and a technical library CD.
can search easily across the entire VisualDSP++ documentation set for any
topic of interest.
For easy printing, supplementary Portable Documentation Format (.pdf)
files for all manuals are provided on the VisualDSP++ installation CD.
Each documentation file type is described as follows.
File Description
.htm or Dinkum Abridged C++ library and FLEXnet license tools software
.html documentation. Viewing and printing the .html files requires a browser, such as
Internet Explorer 6.0 (or higher).
.pdf VisualDSP++ and processor manuals in PDF format. Viewing and printing the
.pdf files requires a PDF reader, such as Adobe Acrobat Reader (4.0 or higher).
Technical Library CD
The technical library CD contains seminar materials, product highlights,
a selection guide, and documentation files of processor manuals, Visu-
alDSP++ software manuals, and hardware tools manuals for the following
processor families: Blackfin, SHARC, TigerSHARC, ADSP-218x, and
ADSP-219x.
To order the technical library CD, go to http://www.analog.com/proces-
sors/technical_library, navigate to the manuals page for your
processor, click the request CD check mark, and fill out the order form.
Data sheets, which can be downloaded from the Analog Devices Web site,
change rapidly, and therefore are not included on the technical library
CD. Technical manuals change periodically. Check the Web site for the
latest manual revisions and associated documentation errata.
EngineerZone
EngineerZone is a technical support forum from Analog Devices. It allows
you direct access to ADI technical support engineers. You can search
FAQs and technical information to get quick answers to your embedded
processing and DSP design questions.
Use EngineerZone to connect with other DSP developers who face similar
design challenges. You can also use this open forum to share knowledge
and collaborate with the ADI support team and your peers. Visit
http://ez.analog.com to sign up.
Notation Conventions
Text conventions used in this manual are identified and described as
follows.
Example Description
Close command Titles in bold style reference sections indicate the location of an item
(File menu) within the VisualDSP++ environment’s menu system (for example, the
Close command appears on the File menu).
{this | that} Alternative required items in syntax descriptions appear within curly
brackets and separated by vertical bars; read the example as this or
that. One or the other is required.
[this | that] Optional items in syntax descriptions appear within brackets and sep-
arated by vertical bars; read the example as an optional this or that.
a
Caution: Device damage may result if ...
A Caution identifies conditions or inappropriate usage of the product
that could lead to undesirable results or product damage. In the online
version of this book, the word Caution appears instead of this symbol.
[
A Warning identifies conditions or inappropriate usage of the product
that could lead to conditions that are potentially hazardous for devices
users. In the online version of this book, the word Warning appears
instead of this symbol.
Assembler Guide
In VisualDSP++ 5.0, you can run the assembler drivers for each processor
family from the VisualDSP++ integrated debugging and development
environment (IDDE) or from an operating system command line The
assembler processes assembly source, data, and header files to produce an
object file. Assembler operations depend on two types of controls:
assembler directives and assembler switches.
VisualDSP++ 5.0 supports the following assembler drivers.
• easm21k.exe (for SHARC processors)
• easmts.exe (for TigerSHARC processors)
• easmblkfn.exe (for Blackfin processors)
This section describes how to develop new programs in the Analog
Devices processor assembly language. It provides information on how to
assemble your programs from the operating system’s command line.
Software developers using the assembler should be familiar with these
topics:
• “Writing Assembly Programs” on page 1-3
• “Using Assembler Support for C Structs” on page 1-21
• “Preprocessing a Program” on page 1-24
• “Using Assembler Feature Macros” on page 1-25
• “Generating Make Dependencies” on page 1-37
• “Reading a Listing File” on page 1-38
Assembler Overview
The assembler processes data from assembly source (.asm), data (.dat),
and header (.h) files to generate object files in executable and linkable
format (ELF), an industry-standard format for binary object files. The
object file has a .doj extension.
In addition to the object file, the assembler can produce a listing file
(.lst) that shows the correspondence between the binary code and the
source.
Assembler switches are specified from the VisualDSP++ IDDE or from the
command line used to invoke the assembler. These switches allow you to
control the assembly process of source, data, and header files. Use these
switches to enable and configure assembly features, such as search paths,
output file names, and macro preprocessing. For more information, see
“Assembler Command-Line Reference” on page 1-144.
You can also set assembler options via the Assemble page of the Project
Options dialog box in VisualDSP++. For more information, see “Specify-
ing Assembler Options in VisualDSP++” on page 1-173.
gram sections for placement within processor memory. The assembler uses
directives for guidance as it translates a source program into object code.
Write assembly language programs using the VisualDSP++ editor or any
editor that produces text files. Do not use a word processor that embeds
special control codes in the text. Use an .asm extension to source file
names to identify them as assembly source files.
Figure 1-1 shows a graphical overview of the assembly process. The figure
shows the preprocessor processing the assembly source (.asm) and header
(.h) files.
Preprocessor
Intermediate
preprocessed
file (.is)
Assembler
Program Content
Assembly source file statements include assembly instructions, assembler
directives, and preprocessor commands.
Assembly Instructions
Assembler Directives
Assembler directives begin with a period (.) and end with a semicolon (;).
The assembler does not differentiate between directives in lowercase or
uppercase.
Preprocessor Commands
Preprocessor commands begin with a pound sign (#) and end with a
carriage return. The pound sign must be the first non-white space
character on the line containing the command. If the command is longer
than one line, use a backslash (\) and a carriage return to continue the
command onto the next line.
Do not put any characters between the backslash and the carriage return.
Unlike assembler directives, preprocessor commands are case sensitive and
must be lowercase. For example,
#include "string.h"
#define MAXIMUM 100
Program Structure
An assembly source file defines code (instructions) and data. It also
organizes the instructions and data to allow the use of the linker descrip-
tion file (.ldf) to describe how code and data are mapped into the
memory on your target processor. The way you structure your code and
data into memory should follow the memory architecture of the target
processor.
Use the .SECTION directive to organize the code and data in assembly
source files. The .SECTION directive defines a grouping of instructions and
data that occupies contiguous memory addresses in the processor. The
name given in a .SECTION directive corresponds to an input section name
in the linker description file.
Table 1-1, Table 1-2, and Table 1-3 show suggested input section names
for data and code that can be used in your assembly source for various
processors. Using these predefined names in your sources makes it easier
to take advantage of the default .ldf file included in your DSP system.
However, you may also define your own sections. For information on
.ldf files, refer to the VisualDSP++ 5.0 Linker and Utilities Manual.
Table 1-1. Suggested Input Section Names for a SHARC .ldf File
.SECTION Name Description
seg_pmco A section in program memory that holds code
seg_dmda A section in data memory that holds data
seg_pmda A section in program memory that holds data
seg_rth A section in program memory that holds system initialization code
and interrupt service routines
seg_swco A section in short word memory that holds instructions encoded for
execution from short word memory.
Note: Applies to the ADSP-2146x processors only.
Table 1-2. Suggested Input Section Names for a TigerSHARC .ldf File
.SECTION Name Description
data1 A section that holds data in memory block M1
data2 A section that holds data in memory block M2 (specified with the
PM memory qualifier)
program A section that holds code
Table 1-3. Suggested Input Section Names for a Blackfin .ldf File
.SECTION Name Description
data1 A section that holds data
program A section that holds code
constdata A section that holds global data (which is declared as constant) and
literal constants such as strings and array initializers
Figure 1-2, Figure 1-3 on page 1-13, and Figure 1-4 on page 1-17
describe assembly code file structure for each processor family. They show
how a program divides into sections that match the memory segmentation
Figure 1-2 describes assembly code file structure for SHARC processors.
.SECTION/DM seg_dmda;
.VAR fxd[10] = 1,2,3,4,5,6,7,8,9,0xA;
Data Section .VAR rad;
.SECTION/PM seg_pmda;
.VAR flt[5] = PI,PI/2,1.0,2.0,2.0/3.0;
.SECTION/PM seg_pmco;
/* instructions */
Assembler Label function1:
I0 = fxd;
M0 = 1;
I8 = flt;
Code Section M8 = 1;
R0 = LENGTH(flt);
LCNTR = R0, DO this_loop UNTIL LCE;
R0 = DM(I0,M0), R1 = PM(I8,M8);
R2 = FIX F1 BY R0;
this_loop:
R3 = R3 + R2;
DM(rad) = R3;
Listing 1-1 shows a sample user-defined .ldf file for SHARC processors.
Looking at the file’s SECTIONS{} command, notice that the INPUT_SECTION
commands map to the names of memory sections (such as program, data1,
data2, ctor, heaptab, and so on) used in the example assembly sample
program.
ARCHITECTURE(ADSP-21062)
SEARCH_DIR( $ADI_DSP\21k\lib )
$LIBRARIES = lib060.dlb, libc.dlb;
$OBJECTS = $COMMAND_LINE_OBJECTS, 060_hdr.doj;
MEMORY {
seg_rth {TYPE(PM RAM) START(0x20000) END(0x20fff) WIDTH(48)}
seg_init{TYPE(PM RAM) START(0x21000) END(0x2100f) WIDTH(48)}
seg_pmco{TYPE(PM RAM) START(0x21010) END(0x24fff) WIDTH(48)}
seg_pmda{TYPE(DM RAM) START(0x28000) END(0x28fff) WIDTH(32)}
seg_dmda{TYPE(DM RAM) START(0x29000) END(0x29fff) WIDTH(32)}
seg_stak{TYPE(DM RAM) START(0x2e000) END(0x2ffff) WIDTH(32)}
/* memory declarations for default heap */
seg_heap{TYPE(DM RAM) START(0x2a000) END(0x2bfff) WIDTH(32)}
/* memory declarations for custom heap */
seg_heaq{TYPE(DM RAM) START(0x2c000) END(0x2dfff) WIDTH(32)}
} // End MEMORY
PROCESSOR p0 {
LINK_AGAINST( $COMMAND_LINE_LINK_AGAINST)
OUTPUT( $COMMAND_LINE_OUTPUT_FILE )
SECTIONS {
.seg_rth {
INPUT_SECTIONS( $OBJECTS(seg_rth) $LIBRARIES(seg_rth))
} > seg_rth
.seg_init {
INPUT_SECTIONS( $OBJECTS(seg_init) $LIBRARIES(seg_init))
} > seg_init
.seg_pmco {
INPUT_SECTIONS( $OBJECTS(seg_pmco) $LIBRARIES(seg_pmco))
} > seg_pmco
.seg_pmda {
INPUT_SECTIONS( $OBJECTS(seg_pmda) $LIBRARIES(seg_pmda))
} > seg_pmda
.seg_dmda {
INPUT_SECTIONS( $OBJECTS(seg_dmda) $LIBRARIES(seg_dmda))
} > seg_dmda
.stackseg {
ldf_stack_space = .;
ldf_stack_length = 0x2000;
} > seg_stak
ARCHITECTURE(ADSP-TS101)
SEARCH_DIR( $ADI_DSP\TS\lib )
$OBJECTS = $COMMAND_LINE_OBJECTS;
MEMORY
{
M0Code { TYPE(RAM) START(0x00000000) END(0x0000FFFF) WIDTH(32)
}
M1Data { TYPE(RAM) START(0x00080000) END(0x0008BFFF) WIDTH(32)
}
M1Heap { TYPE(RAM) START(0x0008C000) END(0x0008C7FF) WIDTH(32)
}
M1Stack { TYPE(RAM) START(0x0008C800) END(0x0008FFFF) WIDTH(32)
}
M2Data { TYPE(RAM) START(0x00100000) END(0x0010BFFF) WIDTH(32)
}
M2Stack { TYPE(RAM) START(0x0010C000) END(0x0010FFFF) WIDTH(32)
}
SDRAM { TYPE(RAM) START(0x04000000) END(0x07FFFFFF) WIDTH(32)
}
MS0 { TYPE(RAM) START(0x08000000) END(0x0BFFFFFF) WIDTH(32)
}
SECTIONS
{ /* List of sections for processor P0 */
code
{
FILL(0xb3c00000)
INPUT_SECTION_ALIGN(4)
INPUT_SECTIONS( $OBJECTS(program) )
} >M0Code
data1
{
INPUT_SECTIONS( $OBJECTS(data1) )
} >M1Data
data2
{
INPUT_SECTIONS( $OBJECTS(data2) )
} >M2Data
INPUT_SECTIONS( $OBJECTS(ctor2) )
INPUT_SECTIONS( $OBJECTS(ctor3) )
INPUT_SECTIONS( $OBJECTS(ctor) )
} >M1Data
kstackseg
{
ldf_kstack_limit = .;
ldf_kstack_base = . + MEMORY_SIZEOF(M2Stack);
} >M2Stack
Figure 1-4 describes the Blackfin processor’s assembly code file structure
and shows how a program divides into sections that match the memory
segmentation of Blackfin processors.
begin_loop:
R1 *= R2;
R2 = [I0++];
end_loop:
R0= R0 + R1 (NS) || R1 = [P0++] || NOP;
R1 *= R2;
R0 = R0 + R1;
ARCHITECTURE(ADSP-BF535)
SEARCH_DIR($ADI_DSP\Blackfin\lib)
#define LIBS libc.dlb, libdsp.dlb
$LIBRARIES = LIBS, librt535.dlb;
$OBJECTS = $COMMAND_LINE_OBJECTS;
SECTIONS
{ /* List of sections for processor P0 */
program
{ /* Align all code sections on 2 byte boundary */
INPUT_SECTION_ALIGN(2)
INPUT_SECTIONS( $OBJECTS(program) $LIBRARIES(program))
INPUT_SECTION_ALIGN(1)
INPUT_SECTIONS( $OBJECTS(data1) $LIBRARIES(data1))
INPUT_SECTION_ALIGN(1)
INPUT_SECTIONS(
$OBJECTS(constdata)$LIBRARIES(constdata))
INPUT_SECTION_ALIGN(1)
INPUT_SECTIONS( $OBJECTS(ctor) $LIBRARIES(ctor))
INPUT_SECTION_ALIGN(2)
INPUT_SECTIONS( $OBJECTS(seg_rth))
} >MEM_PROGRAM
stack
{
ldf_stack_space = .;
ldf_stack_end = ldf_stack_space +
MEMORY_SIZEOF(MEM_STACK) - 4;
} >MEM_STACK
sysstack
{
ldf_sysstack_space = .;
ldf_sysstack_end = ldf_sysstack_space +
MEMORY_SIZEOF(MEM_SYSSTACK) - 4;
} >MEM_SYSSTACK
heap
{ /* Allocate a heap for the application */
ldf_heap_space = .;
ldf_heap_end = ldf_heap_space + MEMORY_SIZEOF(MEM_HEAP)
- 1;
argv
{ /* Allocate argv space for the application */
ldf_argv_space = .;
ldf_argv_end = ldf_argv_space + MEMORY_SIZEOF(MEM_ARGV)
- 1;
ldf_argv_length = ldf_argv_end - ldf_argv_space;
} >MEM_ARGV
}
}
C structs in assembly features accept the full set of legal C symbol names,
including those that are otherwise reserved in the appropriate assembler.
For example,
• In the SHARC assembler, I1, I2, and I3 are reserved keywords,
but it is legal to reference them in the context of the C struct in
assembly features.
• In the TigerSHARC assembler, J1, J2, and J3 are reserved
keywords, but it is legal to reference them in the context of the C
struct in assembly features.
• In the Blackfin assembler, as an example, “X” and “Z” are reserved
keywords, but it is legal to reference them in the context of the C
struct in assembly features.
The examples below show how to access the parts of the struct defined in
the header file, but they are not complete programs on their own. Refer to
your DSP project files for complete code examples.
Blackfin Example:
.IMPORT "Coordinate.h";
/* typedef struct Coordinate {
int X;
int Y;
int Z;
} Coordinate;*/
.SECTION data1;
.SECTION program;
P0.l = Coord1->X;
P0.h = Coord1->X;
P1.l = Coord1->Y;
P1.h = Coord1->Y;
P2.l = Coord1->Z;
P2.h = Coord1->Z;
P3.l = Coord1+OFFSETOF(Coordinate,Z);
P3.h = Coord1+OFFSETOF(Coordinate,Z);
SHARC Example:
.IMPORT "Samples.h";
/* typedef struct Samples {
int I1;
int I2;
int I3;
} Samples; */
.SECTION/DM seg_dmda;
.SECTION/PM seg_pmco;
doubleMe:
/* The code may look confusing, but I2 can be used both
as a register and a struct member name */
B2 = Sample1;
M2 = OFFSETOF(Sample1,I2);
R0 = DM(M2,I2);
R0 = R0+R0;
DM(M2,I2) = R0;
Preprocessing a Program
The assembler includes a preprocessor that allows the use of C-style
preprocessor commands in your assembly source files. The preprocessor
automatically runs before the assembler unless you use the assembler’s -sp
(skip preprocessor) switch. Table 2-2 on page 2-18 lists preprocessor
commands and provides a brief description of each command.
You can see the command line that the assembler uses to invoke the pre-
processor by adding the -v switch (on page 1-170) to the assembler
command line or by selecting the Generate verbose output option on the
Assemble page of the Project Options dialog box. See “Specifying Assem-
bler Options in VisualDSP++” on page 1-173.
Use preprocessor commands to modify assembly code. For example,
you can use the #include command to fill memory, load configuration
registers, or set up processor parameters. You can use the #define com-
mand to define constants and aliases for frequently used instruction
sequences. The preprocessor replaces each occurrence of the macro
reference with the corresponding value or series of instructions.
For example, the MAXIMUM macro from #define MAXIMUM 100 is replaced
with the number 100 during preprocessing.
#define MY_REG P0
MY_REG.1 = 14; /* MY_REG.1 is not expanded; */
/* "." is part of token */
page 1-29 lists the set of feature macros for SHARC processors. Table 1-8
on page 1-34 lists the set of feature macros for TigerSHARC processors.
For .IMPORT headers, the assembler calls the compiler driver with the
appropriate processor option, and the compiler sets the machine constants
accordingly (and defines -D_LANGUAGE_C=1). This macro is present when
used for C compiler calls to specify headers. It replaces -D_LANGUAGE_ASM.
For example,
easm21k -proc adsp-21262 assembly --> cc21K -proc adsp-21262
L
The
The macro applies to all Analog Devices processors.
predefined macro provides product version
-D__VISUALDSPVERSION__
information to VisualDSP++. The macro allows a preprocessing check to
be placed within code and is used to differentiate between VisualDSP++
releases and updates.
Syntax:
-D__VISUALDSPVERSION__=0xMMmmUUxx
For example,
.SECTION program;
.GLOBAL funk1;
funk1:
...
RTS;
funk1.end:
.GLOBAL funk2;
funk2:
...
RTS;
funk2.end:
.GLOBAL funk3;
funk3:
...
RTS;
[Warning ea1121] "test.asm":14 funk3: -g assembly with
global function without ending label. Use 'funk3.end' or
'funk3.END' to mark the ending boundary of the function for
debugging information for automated statistical profiling
of assembly functions.
A0 A1 ABORT ABS AC
EXPADJ EXTRACT
FU
GE GF GT
H HI HLT HWERRCAUSE
I0 I1 I2 I3 IDLE
ISS2 IU
LT1 LZ
M M0 M1 M2 M3
ONES OR OUTC
P0 P1 P2 P3 P4
PM PREFETCH PRNT
R R0 R1 R2 R3
R32 R4 R5 R6 R7
R1_COLON0 RETAIN_NAME
STT_TYPE SU SYSCFG
T TESTSET TFU TH TL
TST
V VIT_MAX
W W32 WEAK
X XB XH XOR Z
ZERO_INIT
_TIME_
.VAR .WEAK
ASHIFT ASTAT AV
B0 B1 B2 B3 B4
B5 B6 B7 B8 B9
BY
CA CACHE CALL CH CI
DO DOVL
EQ EX EXP EXP2
F0 F1 F2 F3 F4
F5 F6 F7 F8 F9
GCC_COMPILED GE GT
I0 I1 I2 I3 I4
I5 I6 I7 I8 I9
JUMP
L0 L1 L2 L3 L4
L5 L6 L7 L8 L9
LOOP LR LSHIFT LT
M0 M1 M2 M3 M4
M5 M6 M7 M8 M9
MROF
NOT NU NW
OFFSETOF OR
R0 R1 R2 R3 R4
RF5 R6 R7 R8 R9
SUFR SV SW SZ
UF UI UNPACK UNTIL UR
__TIME__
INC JC JUMP KC
OFFSETOF ONES OR
YDAB YSDAB
JK Register Group
J0 through J31
K0 through K31
JB0 JB1 JB2 JB3
RF Register Group
FR0 through FR31
MR3:0 MR3:2 MR1:0
R0 through R31
XSTAT YSTAT XYSTAT
EP Register Group
BMAX BMAXC BUSLK FLGPIN FLGPINCL
BTBCMD BTBDATA
CACMDALL
CADATAALL
CASTATALL
CCAIRALL
DCNTCL DCNTST
DSTAT DSTATC
OSPID
SQCTLCL SQSTAT
VIRPT
W2H W2L
If you use a symbol in more than one file, use the .GLOBAL assembly
directive to export the symbol from the file in which it is defined.
Then use the .EXTERN assembly directive to import the symbol into
other files.
• Begin symbols with alphabetic characters.
Symbols can use alphabetic characters (A—Z and a—z), digits (0—9),
and the special characters “$” and “_” (dollar sign and underscore)
as well as “.” (dot).
Symbols are case sensitive; so input_addr and INPUT_ADDR define
unique variables.
The dot, point, or period “.” as the first character of a symbol
triggers special behavior in the VisualDSP++ environment.
A symbol with a “.” as the first character cannot have a digit as the
second character. Such symbols will not appear in the symbol table,
which is accessible in the debugger. A symbol name in which the
first two characters are dots will not appear even in the symbol
table of the object.
Ensure that .SECTION name symbols do not begin with the “.”
(dot).
• Terminate the definition of address label symbols with a colon (:).
• The reserved word list for processors includes some keywords with
commonly used spellings; therefore, ensure correct syntax spelling.
Address label symbols may appear at the beginning of an instruction line
or stand-alone on the preceding line.
The following disassociated lines of code demonstrate symbol usage.
.BYTE2 xoperand; /* xoperand is a 16-bit variable */
.BYTE4 input_array[10]; /* input_array is a 32-bit wide */
/* data buffer with 10 elements */
sub_routine_1: /* sub_routine_1 is a label */
.SECTION kernel; /* kernel is a section name */
Assembler Expressions
The assembler can evaluate simple expressions in source code. The
assembler supports two types of expressions: constant expressions and
symbolic expressions.
Constant Expressions
A constant expression is acceptable where a numeric value is expected in
an assembly instruction or in a preprocessor command. Constant expres-
sions contain an arithmetic or logical operation on two or more numeric
constants. For example,
2.9e-5 + 1.29
(128 - 48) / 3
0x55&
0x0f7.6r – 0.8r
Symbols in this type of expression are data variables, data buffers, and
program labels. In the first three examples above, the symbol name repre-
sents the address of the symbol. The fourth example combines that
meaning of a symbol with a use of the length operator (see Table 1-14).
Assembler Operators
Table 1-13 lists the assembler’s numeric and bitwise operators used in
constant expressions and address expressions. These operators are listed in
group order from highest precedence to lowest precedence. Operators
with the highest precedence are evaluated first. When two operators have
the same precedence, the assembler evaluates the left-most operator first.
L Ifwhich
right-shifting a negative value, ones are shifted in from the MSB,
preserves the sign bit.
The assembler also supports special operators. Table 1-14 lists and
describes special operators used in constant and address expressions.
The ADDRESS and LENGTH operators can be used with external symbols—
apply them to symbols that are defined in other sections as .GLOBAL
symbols.
Blackfin Processor Example:
The following example demonstrates how Blackfin assembler operators are
used to load the length and address information into registers.
#define n 20
...
.SECTION data1; /* data section */
.VAR real_data [n]; /* n=number of input sampless */
LOOP_BEGIN loop1;
R0=[P0++]; /* get next sample */
...
LOOP_END loop1;
The code fragment above initializes P0 and P1 to the base address and
length, respectively, of the real_data buffer. The loop is executed 20
times.
The BITPOS() operator takes a bit constant (with one bit set) and returns
the position of the bit. Therefore, BITPOS(0x10) would return 4 and
BITPOS(0x80) would return 7. For example,
start:
XR0 = CB [J3 += 1];; /* Read data from the circular buffer */
if NLC0E, jump start;;
The code fragment above initializes JB3 and JL3 to the base address and
length, respectively, of the real_data circular buffer. The buffer length
value contained in JL3 determines when addressing wraps around the top
of the buffer. For further information on circular buffers, refer to the
Hardware Reference of the target processor.
SHARC Processor Example:
The following code example determines the base address and length of the
real_data circular buffer. The buffer’s length value (contained in L5)
determines when addressing wraps around to the top of the buffer (when
setting up circular buffers in SHARC processors). For further information
on circular buffers, refer to the Hardware Reference of the target processor.
.SECTION/DM seg_dmda; /* data segment */
.VAR real_data[n]; /* n=number of input samples */
...
Numeric Formats
Depending on the processor architectures, the assemblers support binary,
decimal, hexadecimal, floating-point, and fractional numeric formats
(bases) within expressions and assembly instructions. Table 1-15 describes
the notation conventions used by the assembler to distinguish between
numeric formats.
L In(inBlackfin processors,
or
.BYTE4/R32
fract 1.15 is a default. Use a qualifier
) to support 32-bit initialization for use
.VAR/R32
/R32
1.31 Fracts
Fractional Arithmetic
The assembler does not support arithmetic between fracts and integers.
For example,
.SECTION data1;
.VAR myFract = 1 - 0.5r;
[Error ea1998] "fract.asm":2 User Error: Illegal
mixing of types in expression.
Comment Conventions
The assemblers support C and C++ style formats for inserting comments
in assembly sources. The assemblers do not support nested comments.
Table 1-16 lists and describes assembler comment conventions.
• .ELIF constant-relational-expression;
• .ELSE;
• .ENDIF;
Conditional assembly blocks begin with an .IF directive and end with
an .ENDIF directive. Table 1-17 shows examples of conditional directives.
Optionally, any number of .ELIF and .ELSE directive pairs may appear
within a pair of .IF and .ENDIF directives. The conditional directives are
each terminated with a semi-colon “;”, just like all existing assembler
directives. Conditional directives do not have to appear alone on a line.
These directives are in addition to the C-style #if, #elif, #else, and
#endif preprocessing directives.
.IF tryit == 2;
<some code>
.ELIF tryit >= 3;
<some more code>
.ELSE;
<some more code>
.ENDIF;
If you have “#define tryit 2”, the code <some code> is assembled,
and <some more code> is not assembled.
• There are no parallel assembler directives for C-style directives
#define, #include, #ifdef, #if defined(name), #ifndef, and so
on.
where:
struct/typedef – a struct VAR or a typedef can be supplied as the first
argument
memberName – a member name within the struct or typedef (second
argument)
L words.
For SHARC and TigerSHARC processors,
For Blackfin processors,
units are in
OFFSETOF()
units are in bytes.
OFFSETOF()
where:
The SIZEOF() function takes a symbolic reference as its single argument.
A symbolic reference is a name followed by none or several qualifiers
to members.
Struct References
A reference to a struct VAR provides an absolute address. For a fully
qualified reference to a member, the address is offset to the correct loca-
tion within the struct. The assembler syntax for struct references is “->”.
The following example references the address of Member5 located within
myStruct.
myStruct->Member5
L Unlike members in C,
struct
->
members in the assembler
struct
are always referenced with “ ” (not “ ”) because “ ” is a legal
. .
character in identifiers in assembly and is not available as a struct
reference.
References within nested structures are permitted. A nested struct
definition can be provided in a single reference in assembly code, and a
nested struct via a pointer type requires more than one instruction.
Use the OFFSETOF() built-in function to avoid hard-coded offsets that may
become invalid if the struct layout changes in the future.
Following are two nested struct examples for .IMPORT "CHeaderFile.h".
Example 1:
Nested Reference Within the Struct Definition with
Appropriate C Declarations
C Code
struct Location {
char Town[16];
char State[16];
};
struct myStructTag {
int field1;
struct Location NestedOne;
};
Example 2:
Nested Reference When Nested via a Pointer with
Appropriate C Declarations
When nested via a pointer, myStructTagWithPtr (which has pNestedOne)
uses pointer register offset instructions.
C Code:
// from C header
struct Location {
char Town[16];
char State[16];
};
struct myStructTagWithPtr {
int field1;
struct Location *pNestedOne;
};
Assembler Directives
Directives in an assembly source file control the assembly process. Unlike
assembly instructions, directives do not produce opcodes during assembly.
Use the following general syntax for assembler directives
.directive [/qualifiers | arguments];
Each assembler directive starts with a period (.) and ends with a
semicolon (;). Some directives take qualifiers and arguments. A directive’s
qualifier immediately follows the directive and is separated by a slash (/);
arguments follow qualifiers. Assembler directives can be uppercase or
lowercase; uppercase distinguishes directives from other symbols in your
source code.
Table 1-18 lists all currently supported assembler directives. A description
of each directive appears in the following sections. These directives were
added for GNU compatibility.
where
expression – evaluates to an integer. It specifies an alignment require-
ment; its value must be a power of 2. When aligning a data item or
instruction, the assembler adjusts the address of the current location
counter to the next address that can be divided by the value of
expression, with no remainder. The expression set to 0 or 1 signifies no
address alignment requirement.
The linker stops allocating padding for symbols aligned by 16 or more.
L Inalignment
the absence of the
is 1.
.ALIGN directive, the default address
Example:
In the following example, the assembler sets the alignment of the section
to 4 to match the value specified in the second alignment directive. This
satisfies the first alignment directive as well, since any item alignment on
an address multiple of 4 is also aligned on a multiple of 2. If the target is a
byte-addressed processor, such as Blackfin, there is no padding inserted
between “single” and “samples” since .VAR creates a four-byte word of
storage. If the target is a processor on which the .VAR directive reserves a
one-address unit, such as SHARC, three words of padding follow “single”
in the section produced by the assembler.
...
.ALIGN 1; /* no alignment requirement */
...
.SECTION data1;
.ALIGN 2;
.VAR single; /* aligns the data item on the word boundary,
at the location with the address value that can
be evenly divided by 2 */
.ALIGN 4;
.VAR samples1[100]="data1.dat";
/* aligns the first data item on the double-word
boundary, at the location with the address value
that can be evenly divided by 4; advances other
data items consecutively */
L The
as
Blackfin assembler accepts
. .VAR
.BYTE, .BYTE2, and .BYTE4 as well
L
The
Used with TigerSHARC processors only.
directive forces the address alignment of an instruction
.ALIGN_CODE
within the .SECTION in which it is used. .ALIGN_CODE is similar to the
.ALIGN directive, but whereas .ALIGN causes the code to be padded with
0s, .ALIGN_CODE pads with NOPs. The .ALIGN_CODE directive is used to
align instructions.
Refer to the VisualDSP++ 5.0 Linker and Utilities Manual for more infor-
mation on section alignment.
Syntax:
.ALIGN_CODE expression;
where
expression – evaluates to an integer. It specifies an alignment require-
ment; its value must be a power of 2. In TigerSHARC processors, the
expression value is usually 4. When aligning a data item or instruction,
the assembler adjusts the address of the current location counter to the
next address that is divisible by the value of the expression. The expres-
sion set to 0 or 1 signifies no address alignment requirement.
L alignment
In the absence of the
is 1.
.ALIGN_CODE directive, the default address
Example:
.ALIGN_CODE 0; /* no alignment requirement */
...
.ALIGN_CODE 1; /* no alignment requirement */
...
.SECTION program;
.ALIGN_CODE 4;
JUMP LABEL;;
/* Jump instruction aligned to four word boundary.
If necessary, padding will be done with NOPs */
.ASCII
L
The
Used with Blackfin processors only.
directive initializes a data location with one or more charac-
.ASCII
ters from a double-quoted ASCII string. This is equivalent to the .BYTE
directive. Note that the syntax differs from the .BYTE directive as follows:
• There is no “=” sign
• The string is enclosed in double-quotes, not single quotes
Syntax:
.ASCII “string”;
Example:
.SECTION data1;
ASCII_String:
.TYPE ASCII_String,STT_OBJECT;
.ASCII "ABCD";
.ASCII_String.end:
Byte_String:
.TYPE Byte_String,STT_OBJECT;
.Byte = ‘ABCD’;
.Byte_String.end:
L
The
Used with Blackfin processors only.
, , and
.BYTE .BYTE2 directives declare and optionally initialize
.BYTE4
one-, two-, and four-byte data objects, respectively. Note that the .BYTE4
directive performs the same function as the .VAR directive.
Syntax:
When declaring and/or initializing memory variables or buffer elements,
use one of these forms:
.BYTE varName1[,varName2,…];
.BYTE = initExpression1, initExpression2,…;
.BYTE varName1 = initExpression,varName2 = initExpression2,…
.BYTE bufferName[] = initExpression1, initExpression2,…;
.BYTE bufferName[] = "fileName";
.BYTE bufferName[length ] = "fileName";
.BYTE bufferName[length] = initExpression1, initExpression2,…;
where:
varName – user-defined symbols that name variables
bufferName – user-defined symbols that name buffers
fileName – indicates that the elements of a buffer get their initial values
from the fileName data file. The <fileName> parameter can consist of the
actual name and path specification for the data file. If the initialization file
is in current directory of your operating system, only the fileName need
be given inside double quote (" ") characters. Note that when reading in a
data file, the assembler reads in whitespace-separated lists of decimal digits
or hex strings.
If the file name is not found in the current directory, the assembler looks
in the directories in the processor include path. You may use the -I
The assembler supports ASCII string initialization. This allows the full use
of the ASCII character set, including digits and special characters.
In Blackfin processors, ASCII initialization can be provided with .BYTE,
.BYTE2, or .VAR directives. The most likely use is the .BYTE directive where
each char is represented by one byte versus a .VAR directive in which each
char needs four bytes. The characters are stored in the upper byte of
32-bit words. The LSBs are cleared.
String initialization takes one of the following forms:
.BYTE symbolString[length] = ‘initString’, 0;
.BYTE symbolString [] = ’initString’, 0;
Example:
.BYTE k[13] = ‘Hello world!’, 0;
.BYTE k[] = ‘Hello world!’, 0;
L
The
Used with the ADSP-2146x SHARC processors only.
directive indicates that all of the following instructions in
.COMPRESS
the source file should be compressed, if possible. The directive has effect
on sections assembled as short word. Compression is canceled by a
.NOCOMPRESS directive later in the source file (see on page 1-110).
where:
symbolName – the name of a global symbol to import. A single .EXTERN
directive can reference any number of symbols on one line, separated by
commas.
Example:
.EXTERN coeffs;
// This code declares an external symbol to reference
// the global symbol "coeffs" declared in the example
// code in the .GLOBAL directive description.
where:
typedef – the type definition for a struct VAR
structvarName – a struct VAR name
The .EXTERN STRUCT directive specifies a struct symbol name declared
in another file. The naming conventions are the same for structs as for
variables and arrays:
• If a struct was declared in a C file, refer to it with a leading _.
• If a struct was declared in an .asm file, use the name “as is”,
no leading underscore (_) is necessary.
The .EXTERN STRUCT directive optionally accepts a list, such as:
.EXTERN STRUCT typedef structvarName [,STRUCT typedef structvar-
Name …]
The key to the assembler knowing the layout is the .IMPORT directive and
the .EXTERN STRUCT directive associating the typedef with the struct VAR.
To reference a data structure declared in another file, use the .IMPORT
directive with the .EXTERN directive. This mechanism can be used for
structures defined in assembly source files as well as in C files.
The .EXTERN directive supports variables in the assembler. If the program
references struct members, .EXTERN STRUCT must be used because the
assembler must consult the struct layout to calculate the offset of the
struct members. If the program does not reference struct members, you
can use .EXTERN for struct VARs.
Example (SHARC code):
.IMPORT "MyCelebrities.h";
// 'Celebrity' is the typedef for struct var 'StNick'
// .EXTERN means that '_StNick' is referenced within this
// file, but not locally defined. This example assumes StNick
// was declared in a C file and it must be referenced with
// a leading underscore.
.EXTERN STRUCT Celebrity _StNick;
// "isSeniorCitizen" is one of the members of the 'Celebrity'
// type
P3.L = LO( _StNick->isSeniorCitizen);
P3.H = HI(_StNick->isSeniorCitizen);
where:
filename– the name of the source file to associate with the object file.
The argument is enclosed in double quotes.
where:
attrName – the name of the attribute. Attribute names must follow the
same rules for naming symbols.
attrVal – sets the attribute to this value. If omitted, “1” is used. The value
must be double-quoted unless it follows the rules for naming symbols
(as described in “Assembler Keywords and Symbols” on page 1-42).
Examples:
.FILE_ATTR at1;
.FILE_ATTR at10=a123;
.FILE_ATTR at101=a123, at102,at103="999";
L
The
Used with the ADSP-2146x SHARC processors only.
directive causes the next instruction to be com-
.FORCECOMPRESS
pressed, if possible. The directive has effect on sections that are assembled
as short word. The directive overrides the effect of a previous .NOCOMPRESS
directive (on page 1-110) for one instruction. Only the immediately fol-
lowing assembly instruction is affected by .FORCECOMPRESS, while
.COMPRESS (on page 1-85) starts a sequence of .COMPRESS, instructions,
and .NOCOMPRESS.
where:
symbolName – the name of a global symbol. A single .GLOBAL directive may
define the global scope of any number of symbols on one line, separated
by commas.
Example (SHARC and TigerSHARC code):
.VAR coeffs[10]; // declares a buffer
.VAR taps=100; // declares a variable
where:
headerfilename – one or more comma-separated C header files enclosed
in double quotes.
The .IMPORT directive does not allocate space for a variable of this type.
Allocating space requires the .STRUCT directive (see on page 1-133).
The assembler takes advantage of knowing the struct layouts. The assem-
bly programmer may reference struct data members by name in assembler
source, as one would do in C. The assembler calculates the offsets within
the structure based on the size and sequence of the data members.
If the structure layout changes, the assembly code need not change. It just
needs to get the new layout from the header file, via the compiler. Make
dependencies track the .IMPORT header files and know when a rebuild is
needed. Use the -flags-compiler assembler switch (on page 1-157) to
pass options to the C compiler for .IMPORT header file compilations.
An .IMPORT directive with one or more .EXTERN directives allows code in
the module to refer to a struct variable that was declared and initialized
elsewhere. The C struct can be declared in C-compiled code or another
assembly file.
The .IMPORT directive with one or more .STRUCT directives declares and
initializes variables of that structure type within the assembler section in
which it appears.
For more information, refer to the .EXTERN directive on page 1-85 and the
.STRUCT directive on page 1-133.
Example:
.IMPORT "CHeaderFile.h";
.IMPORT "ACME_IIir.h","ACME_IFir.h";
.SECTION program;
// … code that uses CHeaderFile, ACME_IIir, and
// ACME_IFir C structs
where:
symbol – the name of a symbol to associate with the data being included
from the file
filename – the name of the file to include. The argument is enclosed in
double quotes.
The skip argument skips a number of bytes from the start of the file.
The count argument indicates the maximum number of bytes to read.
Example:
.SECTION data1;
.VAR jim;
.INC/BINARY sym[] = "bert",10,6;
.VAR fred;
.INC/BINARY Image1[] = "photos/Picture1.jpg";
where:
expression – evaluates to an integer from 0 to 100. Default is 0. There-
fore, the minimum left margin value is 0 and the maximum left margin
value is 100. To change the default setting for the entire listing, place the
.LEFTMARGIN directive at the beginning of your assembly source file.
Example:
.LEFTMARGIN 9; /* the listing line begins at column 10 */
L You can set the margin width only once per source file. If the
assembler encounters multiple occurrences of the .LEFTMARGIN
directive, it ignores all of them except the last directive.
.NOLIST;
These directives can appear multiple times anywhere in a source file, and
their effect depends on their location in the source file.
.NOLIST_DATA;
These directives can appear multiple times anywhere in a source file, and
their effect depends on their location in the source file.
.NOLIST_DATFILE;
These directives can appear multiple times anywhere in a source file, and
their effect depends on their location in the source file. They are used in
assembly source files, but not in data initialization files.
Both the default tab width and the local tab width can be changed any
number of times via the .LIST_DEFTAB and .LIST_LOCTAB directives.
The default tab width is inherited by nested source files, but the local tab
width only affects the current source file.
Syntax:
.LIST_DEFTAB expression;
where:
expression – evaluates to an integer greater than or equal to 0. In the
absence of a .LIST_DEFTAB directive, the default tab width defaults to 4.
A value of 0 sets the default tab width.
Example:
// Tabs here are expanded to the default of 4 columns
.LIST_DEFTAB 8;
// Tabs here are expanded to 8 columns
.LIST_LOCTAB 2;
// Tabs here are expanded to 2 columns
// But tabs in "include_1.h" will be expanded to 8 columns
#include "include_1.h"
.LIST_DEFTAB 4;
// Tabs here are still expanded to 2 columns
// But tabs in "include_2.h" will be expanded to 4 columns
#include "include_2.h"
where:
expression – evaluates to an integer greater than or equal to 0. A value
of 0 sets the local tab width to the current setting of the default tab width.
In the absence of a .LIST_LOCTAB directive, the local tab width defaults to
the current setting for the default tab width.
Example: See the .LIST_DEFTAB example on page 1-100.
.LIST_WRAPDATA/.NOLIST_WRAPDATA
The .LIST_WRAPDATA/.NOLIST_WRAPDATA directives control the listing of
opcodes that are too big to fit in the opcode column. By default, the
.NOLIST_WRAPDATA directive is in effect.
This directive pair applies to any opcode that does not fit, but in practice,
such a value almost always is the data (alignment directives can also result
in large opcodes).
• If .LIST_WRAPDATA is in effect, the opcode value is wrapped so that
it fits in the opcode column (resulting in multiple listing lines).
• If .NOLIST_WRAPDATA is in effect, the printout is what fits in the
opcode column.
Nested source files inherit the current setting of this directive pair, but
a change to the setting made in a nested source file does not affect
the parent source file.
The .LIST_WRAPDATA/.NOLIST_WRAPDATA directives do not take any
qualifiers or arguments.
Syntax:
.LIST_WRAPDATA;
.NOLIST_WRAPDATA;
These directives can appear multiple times anywhere in a source file, and
their effect depends on their location in the source file.
L
The
Used with Blackfin processors only.
directive declares and optionally initializes four-byte data
.LONG
objects. It is effectively equivalent to .BYTE4 initExpression1,
initExpression2, …. For more information, see “.BYTE, Declare a Byte
Data Variable or Buffer” on page 1-81.
Syntax:
When declaring and/or initializing memory variables or buffer elements,
use the following format. Note that the terminating semicolon is optional.
.LONG initExpression1, initExpression2, …[;]
.LONG constExpression1, constExpression2, …[;]
where:
initExpressions parameters – contain one or more comma-separated
“symbol=value” expressions
constExpressions parameters – contain a comma-separated list of con-
stant values
The following lines of code demonstrate .LONG directives:
// Define an initialized variable
.LONG buf1=0x1234;
// Define two initialized variables
.LONG 0x1234, 0x5678, …;
// Declare three 8 byte areas of memory, initialized to
// 3, 4, and 5 respectively
.LONG 0x0003, 0x0004, 0x0005;
where:
warnid1[,warnid2, …] is a list of one or more message identification
numbers.
A qualifier can be:
• ERROR – change messages to errors
• WARN – change messages to warnings
• INFO – change messages to informational messages
• SUPPRESS – do not output the messages
• RESTORE_CL – change the severity of the messages back to the
default values they had at the beginning of the source file, after the
command line arguments were processed, but before any DEFAULT
directives have been processed.
The DEFAULT qualifier cannot be used with the UNTIL or FOR forms of the
.MESSAGE directive.
The temporary forms of the .MESSAGE directive (UNTIL and FOR) changes
the severity of messages until the specified label (or for the specified
number of source lines). The temporary forms of the .MESSAGE directive
must start and end within a single .SECTION directive.
The POP qualifier changes the severity of the messages back to previous
severities.
Example (for TigerSHARC Processors):
.MESSAGE/INFO 3012;
.SECTION program;
RETI;; // generates an informational
.MESSAGE/ERROR 3012;
RETI;; // generates an error
.MESSAGE/INFO 3012;
RETI;; // generates an informational
.MESSAGE/POP 3012;
RETI;; // generates an error - 2nd directive
.MESSAGE/POP 3012;
RETI;; // generates an informational - 1st directive
.MESSAGE/POP 3012;
RETI;; // generates a warning - the default for this message
The DEFAULT qualifier is used to redefine the default severity for messages.
It can be placed anywhere in a source file. It only takes affect when the
message severity has not been changed by a .MESSAGE directive.
This directive may appear anywhere in your source file. In the absence of
the .NEWPAGE directive, the assembler generates no page breaks in the file.
L
The
Used with the ADSP-2146x SHARC processors only.
directive indicates that all of the following instructions
.NOCOMPRESS
in the source file should not be compressed.
Syntax:
.NOCOMPRESS;
where:
expression – evaluates to an integer 0 or greater. It specifies the number
of text lines per printed page. The default page length is 0, which means
the listing has no page breaks.
To format the entire listing, place the .PAGELENGTH directive at the
beginning of your assembly source file. If a page length value greater than
0 is too small to allow a properly formatted listing page, the assembler
issues a warning and uses its internal minimum page length (approxi-
mately 10 lines).
Example:
.PAGELENGTH 50; // starts a new page after printing 50 lines
L You can set the page length only once per source file. If the
assembler encounters multiple occurrences of the directive,
it ignores all except the last directive.
where:
expression – evaluates to an integer
Depending on setting of the .LEFTMARGIN directive, this integer should be
at least equal to:
• LEFTMARGIN value plus 46 (for Blackfin processors)
• LEFTMARGIN value plus 49 (for TigerSHARC processors)
• LEFTMARGIN value plus about 66 (for SHARC processors)
You cannot set this integer to less than 46, 49, or 66, respectively. There is
no upper limit. If LEFTMARGIN = 0 and the .PAGEWIDTH value is not
specified, the actual page width is set to any number over 46, 49, or 66,
respectively.
To change the number of characters per line in the entire listing, place the
.PAGEWIDTH directive at the beginning of the assembly source file.
Example:
.PAGEWIDTH 72; // starts a new line after 72 characters
// are printed on one line, assuming
// the .LEFTMARGIN setting is 0.
L You can set the page width only once per source file. If the
assembler encounters multiple occurrences of the directive,
it ignores all of them except the last directive.
L
The
Used with SHARC processors only.
legacy directive assigns port name symbols to I/O ports.
.PORT
Port name symbols are global symbols that correspond to memory-
mapped I/O ports defined in the .ldf file.
The .PORT directive uses the following syntax:
.PORT portName;
where:
portName – a globally available port symbol
Example:
.PORT p1; // declares I/O port P1
.PORT p2; // declares I/O port P2
To declare a port using the SHARC assembler syntax, use the .VAR
directive (for port-identifying symbols) and the linker description file
(for corresponding I/O sections). The linker resolves port symbols in the
.ldf file.
L
The
Used with SHARC processors only.
directive controls how the assembler interprets float-
.PRECISION
ing-point numeric values in constant declarations and variable
initializations. To configure the floating-point precision of the target
processor system, you must set up control registers of the chip using
instructions specific to the processor core.
Use one of the following options:
.PRECISION [=] 32;
.PRECISION [=] 40;
where:
The precision of 32 or 40 (default) specifies the number of significant bits
for floating-point data. The equal sign (=) following the .PRECISION
keyword is optional.
Note that the .PRECISION directive applies only to floating-point data.
Precision of fixed-point data is determined by the number of digits
specified. The .PRECISION directive applies to all floating-point
expressions in the file that follow it up to the next .PRECISION directive.
Example:
.PRECISION=32; /* Selects standard IEEE 32-bit
single-precision format. */
The following examples provide valid and invalid cases of the use of the
consecutive .PREVIOUS directives.
Example of Invalid Directive Use:
.SECTION data1; // data
.SECTION code; // instructions
.PREVIOUS; // previous section ends, back to data1
.PREVIOUS; // no previous section to set to
evaluates as:
.SECTION data1; // data
.VAR va = 1;
.SECTION program; // instructions
.VAR vb = 2;
// Start MACRO1
.SECTION data2;
.VAR vd = 4;
.PREVIOUS; // end data2, section program
// End MACRO1
.PREVIOUS; // end program, start data1
.VAR vc = 3;
where:
In the first case, symbolName is a global symbol or locally defined symbol.
In the second case, symbolName is a symbol defined in ‘sourcefile’.
Example:
.PRIORITY _foo, 35; // Symbol with highest priority
.PRIORITY _main, 15; // Symbol with medium priority
.PRIORITY bar, "barFile.asm", -10; // Symbol with lowest priority
Linker Operation
_func2:
.section L1_code;
_L1_func:
...
.PRIORITY _L1_func,10;
.PRIORITY _func1,11;
.PRIORITY _func2,12;
The preceding two examples result in the linker executing the following
three steps:
1. Because _func2 is assigned the highest priority (12) in the assem-
bler code, the linker first tries to map it into the L1_B memory
segment. If _func2 does not fit into L1_B , it tries the L2 segment.
2. Because _func1 is assigned the middle priority (11) in the assem-
bler code, the linker first tries to map it into the L1_B memory
segment. If _func2 does not fit into L1_B , it tries the L2 segment.
3. Because _L1_func is assigned the lowest priority (10) in the assem-
bler code, the linker first tries to map it into the L1_A memory
segment. If _L1_func does not fit into L1_A , it tries the L1_B
segment.
L
The
Used with Blackfin processors only.
directive is used by the compiler to provide better
.REFERENCE
information in an X-REF file generated by the linker. This directive is
used when there are indirect symbol references that would otherwise not
appear in an X-REF file.
The .REFERENCE directive uses the following syntax:
.REFERENCE symbol;
where:
symbol – is a symbol
Example:
.REFERENCE P1;
.REFERENCE P2;
where:
symbol – is a user-defined symbol
For information on KEEP(), refer to the VisualDSP++ 5.0 Linker and
Utilities Manual.
L
The
Used with SHARC processors only.
directives control how the assembler interprets literal
.ROUND_
floating-point numeric data after .PRECISION is defined. The .PRECISION
directive determines the number of bits to be truncated to match the
number of significant bits (see on page 1-115).
The .ROUND_ directives determine how the assembler handles the
floating-point values in constant declarations and variable initializations.
To configure the floating-point rounding modes of the target processor
system, you must set up control registers on the chip using instructions
specific to the processor core.
The .ROUND_ directives use the following syntax:
.ROUND_mode;
where:
The mode string specifies the rounding scheme used to fit a value in the
destination format. Use one of the following IEEE standard modes:
.ROUND_NEAREST; (default)
.ROUND_PLUS; (rounds to round-to-positive infinity)
.ROUND_MINUS; (rounds to round-to-negative infinity)
.ROUND_ZERO; (selects round-to-zero)
In the following examples, the numbers with four decimal places are
reduced to three decimal places and are rounded accordingly.
.ROUND_NEAREST;
/* Selects Round-to-Nearest scheme; the default setting.
A 5 is added to the digit that follows the third
decimal digit (the least significant bit - LSB). The
result is truncated after the third decimal digit (LSB).
SHARC Syntax:
.SECTION[/TYPE/qualifier sectionName [sectionType];
L All qualifiers are optional, and more than one qualifier can be used.
Common .SECTION Attributes
[ Ifqualifier,
you select an invalid common qualifier or specify no common
the assembler exits with an error message.
Blackfin Example:
/* Declared below memory sections correspond to the default
LDF’s input sections. */
.SECTION/DOUBLE32 data1; /* memory section to store data */
.SECTION/DOUBLE32 program; /* memory section to store code */
DOUBLE* Qualifiers
The DOUBLE* qualifier can be one of the following, listed in Table 1-19.
The DOUBLE size qualifiers are used to ensure that object files are consistent
when linked together and with run-time libraries. A memory section may
have one DOUBLE size qualifier – it cannot have two DOUBLE size qualifiers.
Sections in the same file do not have to have the same type size qualifiers.
TigerSHARC-Specific Qualifiers
The char size qualifiers are used to ensure that object files are consistent
when linked together and with run-time libraries. A section may have a
double size qualifier and a char size qualifier. It cannot have two char size
qualifiers. Sections in the same file do not have to have the same type size
qualifiers.
SHARC-Specific Qualifiers
For the SHARC assembler, the .SECTION directive supports qualifiers that
specify the size of data words in the section. A qualifier can specify
restricted placement for the section. Each section that defines data or code
Example:
.SECTION/DM/DMAONLY seg_extm;
.VAR _external_var[100];
Example:
.SECTION/NO_INIT seg_bss;
.VAR big[0x100000];
.SECTION/ZERO_INIT seg_bsz;
.VAR big[0x100000];
For more information, refer to the VisualDSP++ 5.0 Linker and Utilities
Manual.
.SEPARATE_MEM_SEGMENTS
L
The
Used with TigerSHARC processors only.
directive allows you to specify two buffers
.SEPARATE_MEM_SEGMENTS
the linker should try to place into different memory segments.
Syntax:
.SECTION data1;
.VAR buf1;
.VAR buf2;
.EXTERN buf3;
.SEPARATE_MEM_SEGMENTS buf1, buf2;
.SEPARATE_MEM_SEGMENTS buf1, buf3;
where:
symbol1 becomes an alias to symbol2.
Example:
.SET symbol1, symbol1
L
The
Used with Blackfin processors only.
directive declares and optionally initializes two-byte data
.SHORT
objects. It is effectively equivalent to .BYTE2 initExpression1,
initExpression2,…. For more information, see “.BYTE, Declare a Byte
Data Variable or Buffer” on page 1-81.
Syntax:
When declaring and/or initializing memory variables or buffer elements,
use this format. Note that the terminating semicolon is optional.
.SHORT initExpression1, initExpression2, …[;]
.SHORT constExpression1, constExpression2, …[;]
where:
initExpressions parameters – contain one or more comma-separated
“symbol=value” expressions
constExpressions parameters – contain a comma-separated list of
constant values
where:
typedef – the type definition for a struct VARstructName – a struct name
struct-member-initializers – per struct member initializers
The { } curly braces are used for consistency with the C initializer syntax.
Initialization can be in “long” form or “short” form where data member
names are not included. The short form corresponds to the syntax in C
compiler struct initialization with these changes:
• C compiler keyword struct is changed to .struct by adding the
period (.)
• C compiler constant string syntax “MyString” is changed
to 'MyString' by changing the double quotes (" ") into single
quotes (‘ ‘)
The long form is assembler-specific and provides the following benefits:
• Provides better error checking
• Supports self-documenting code
• Protects from possible future changes to the layout of the struct.
If an additional member is added before the member is initialized,
the assembler will continue to offset to the correct location for the
specified initialization and zero-initialize the new member.
Any members that are not present in a long-form initialization are
initialized to zero. For example, if struct StructThree has three members
(member1, member2, and member3), and
.STRUCT StructThree myThree {
member1 = 0xaa,
member3 = 0xff
};
In the short form, nested braces can be used to perform partial initializa-
tions as in C. In Example 4 below, if the second member of the struct is an
array with more than four elements, the remaining elements is initialized
to zero.
Example 4. Short Form .STRUCT Directive to Initialize an Array
.STRUCT structWithArrays XXX = { 5, { 1,2,3,4 }, 1, 2 };
where:
symbolName – the name of the object to which the symbolType is applied
symbolType – an ELF symbol type STT_*. Valid ELF symbol types are
listed in the ELF.h header file. By default, a label has an STT_FUNC symbol
type, and a variable or buffer name defined in a storage directive has an
STT_OBJECT symbol type.
Syntax:
The .VAR directive takes one of the following forms:
.VAR varName1[,varName2,…];
.VAR = initExpression1, initExpression2, …;
.VAR bufferName[] = {initExpression1, initExpression2, …};
.VAR bufferName[] = {"fileName"};
.VAR bufferName[length] = "fileName";
.VAR bufferName[length] = initExpression1,initExpression2, …;
where:
varName – user-defined symbols that identify variables
bufferName – user-defined symbols that identify buffers
fileName parameter – indicates that the elements of a buffer get their
initial values from the fileName data file. The fileName can consist of the
actual name and path specification for the data file. If the initialization file
is in the current directory of your operating system, only the fileName
need be given quotes. Note that when reading in a data file, the assembler
reads in whitespace-separated lists of decimal digits or hex strings.
Initialization from files is useful for loading buffers with data, such as
filter coefficients or FFT phase rotation factors that are generated by other
programs. The assembler determines how the values are stored in memory
when it reads the data files.
Ellipsis (…) – a comma-delimited list of parameters
[length] – optional parameter that defines the length (in words) of the
associated buffer. When length is not provided, the buffer size is deter-
mined by the number of initializers.
Brackets ([ ]) – enclosing the optional [length] is required. For more
information, see the following .VAR examples.
L With
(
Blackfin processors, the assembler uses a qualifier
/R32
) to support 32-bit initialization for use with 1.31 fracts
.VAR/R32
(see on page 1-61).
The following code demonstrate some .VAR directives:
.VAR buf1=0x1234;
/* Define one initialized variable */
.VAR=0x1234, 0x5678;
/* Define two initialized words */
.VAR samples[] = {10, 11, 12, 13, 14};
/* Declare and initialize an implicit-length buffer
since there are five values; this has the same effect
as samples[5]. */
/* Initialization values for implicit-size buffer must
be in curly brackets. */
.VAR Ins, Outs, Remains;
/* Declare three uninitialized variables */
.VAR samples[100] = "inits.dat";
/* Declare a 100-location buffer and initialize it
with the contents of the inits.dat file; */
.VAR taps=100;
/* Declare a variable and initialize the variable to 100 */
.VAR twiddles[10] = "phase.dat";
/* Declare a 10-location buffer and load the buffer
with the contents of the phase.dat file */
.VAR Fract_Var_R32[] = "fr32FormatFract.dat";
L AllTherefore,
Blackfin processor memory accesses require proper alignment.
when loading or storing an -byte value into the
N
processor, ensure that this value is aligned in memory by N
boundary; otherwise, a hardware exception is generated.
Blackfin Code Example:
In the following example, the 4-byte variables y0, y1, and y2 would be
misaligned unless the .ALIGN 4; directive is placed before the .VAR y0;
and .VAR y2; statements.
.SECTION data1;
.ALIGN 4;
.VAR X0;
.VAR X1;
.BYTE B0;
.ALIGN 4; /* aligns the following data item "Y0" on a word
boundary; advances other data items consequently */
.VAR Y0;
.VAR Y1;
.BYTE B1;
.ALIGN 4; /* aligns the following data item "Y2" on a word
boundary */
.VAR Y2;
The assemblers support ASCII string initialization. This allows the full use
of the ASCII character set, including digits and special characters.
On SHARC and TigerSHARC processors, the characters are stored in the
upper byte of 32-bit words. The least significant bits (LSBs) are cleared.
When using 16-bit Blackfin processors, refer to the .BYTE directive
description on page 1-81 for more information.
String initialization takes one of the following forms:
.VAR symbolString[length] = ‘initString’, 0;
.VAR symbolString[] = ‘initString’, 0;
For example,
.VAR x[13] = ‘Hello world!’, 0;
.VAR x[] = {‘Hello world!’, 0};
where:
symbol – the user-defined symbol
Although the linker generates an error if two objects define global symbols
with identical names, it allows any number of instances of weak defini-
tions of a name. All will resolve to the first, or to a single, global definition
of a symbol.
One difference between .EXTERN and .WEAK references is that the linker
does not extract objects from archives to satisfy weak references. Such
references, left unresolved, have the value 0.
-switch Switch (or switches) to process. The command-line interface offers many
optional switches that select operations and modes for the assembler and pre-
processor. Some assembler switches take a file name as a required parameter.
sourceFile Name of the source file to assemble.
The assembler supports relative path names and absolute path names.
When you specify an input or output file name as a parameter, follow
these guidelines for naming files:
• Include the drive letter and path string if the file is not in the
current project directory.
• Enclose long file names in double quotation marks; for example,
“long file name”.
• Append the appropriate file name extension to each file.
Table 1-25 summarizes file extension conventions accepted by the
VisualDSP++ environment.
-align-branch-lines
L
The
This switch is used with TigerSHARC processors only.
switch directs the assembler to align branch
-align-branch-lines
instructions (JUMP, CALL, CJMP, CJMP_CALL, RETI, and RTI) on quad-word
-anomaly-detect {id1[,id2...]|all|none}
The -anomaly-detect switch directs the assembler to check for assembly
code that may be affected by any of the hardware anomalies listed in the
id switches. The id switch parameter is:
id – Anomaly identifier
The anomaly identifier syntax may use or omit dashes. For example, either
05-00-0245 or 05000245 are accepted. Additionally, ids specified override
the all and none options. For example, -anomaly-detect none,050000245
detects only anomaly 050000245.
all – use all identifiers applicable to the given processor
none – ignore all identifiers not specifically provided (same as -no-anom-
aly-detect all)
If the check detects assembly code that will be affected by the specificed
anomaly (or anomalies), the assembler issues a warning. Using this option
helps you detect and avoid code combinations affected by anomalies.
-anomaly-warn {id1[,id2]|all|none}
The -anomaly-warn switch directs the assembler to check assembly
instructions against hardware anomalies. Switch parameters are:
id – anomaly identifier (for example, 05-00-0245 or 05000245)
all – uses all identifiers known to the assembler
none – do nothing
This switch allows the user to control which anomaly warnings are to be
displayed. Typically, code is assembled using the -anomaly-warn all
selection. This will cause the assembler to issue a warning for all anomalies
it knows about.
For example, the switch yelds the following anomaly IDs.
05000165 05000209 05000227 05000244
The anomaly identifier syntax may use or omit dashes. For example, either
05-00-00245 or 050000245 are accepted. Additionally, specified ids over-
-char-size-8
The -char-size-8 switch directs the assembler to add /CHAR8 to
.SECTIONs in the source file that do not have char size qualifiers.
For .SECTIONs in the source file that already have a char size qualifier,
this option is ignored and a warning is produced. For more information,
see “.SECTION, Declare a Memory Section” on page 1-125.
-double-size-32
The -double-size-32 switch directs the assembler to add /DOUBLE32
to .SECTIONs in the source file that do not have double size qualifiers.
For .SECTIONs in the source file that already have a double size qualifier,
this option is ignored and a warning is produced. For more information,
see “.SECTION, Declare a Memory Section” on page 1-125.
-double-size-64
The -double-size-64 switch directs the assembler to add /DOUBLE64
to .SECTIONs in the source file that do not have double size qualifiers.
For .SECTIONs in the source file that already have a double size qualifier,
this option is ignored and a warning is produced. The -double-size-any
flag should be used to avoid a linker warning when compiling C/C++
sources with -double-size-64.
Warning Example:
[Warning li2151] Input sections have inconsistent qualifiers as
follows.
-double-size-any
The -double-size-any switch directs the assembler to add /DOUBLEANY
to .SECTIONs in the source file that do not have double size qualifiers,
making SECTION contents independent of size of double type. For
.SECTIONs in the source file that already have a double size qualifier,
this option is ignored and a warning is produced. For more information,
see “.SECTION, Declare a Memory Section” on page 1-125.
-expand-symbolic-links
The expand-symbolic-links switch directs the assembler to correctly
access directories and files whose name or path contain Cygwin path
components.
-expand-windows-shortcuts
The expand-windows-shortcuts switch directs the assembler to correctly
access directories and files whose name or path contain Windows
shortcuts.
-file-attr attr[=val]
The -file-attr (file attribute) switch directs the assembler to add an
attribute (attr) to the object file. The attribute will be given the value
(val) or “1” if the value is omitted. Attr should follow the rules for
naming symbols. Val should be double-quoted unless it follows the rules
for naming symbols. See “Assembler Keywords and Symbols” on
page 1-42 for more information on naming conventions.
-flags-compiler
The -flags-compiler -opt1 [,-opt2 …] switch passes each
comma-separated option to the C compiler. The switch takes a list of one
or more comma-separated compiler options that are passed on the com-
piler command line for compiling .IMPORT headers. The assembler calls
the compiler to process each header file in an .IMPORT directive. It calls the
compiler with the -debug-types option along with any -flags-compiler
switches given on the assembler command line.
For example,
// file.asm has .IMPORT "myHeader.h"
easmbkln -proc ADSP-BF535 -flags-compiler -I/Path -I. file.asm
The rest of the assembly program, including its #include files, are
processed by the assembler preprocessor. The -flags-compiler switch
processes a list of one or more valid C compiler options, including the
-D and -I options.
L See “Using Assembler Feature Macros” on page 1-25 for the list
of predefined macros, including default macros.
Include Options
For example,
easmblkfn -proc ADSP-BF535 -I/aPath -DaDef -flags-compiler
-I/cPath,-I. file.asm
-g
The -g (generate debug information) switch directs the assembler to
generate complete data type information for arrays, functions, and the
C structs. This switch also generates DWARF2 function information with
starting and ending ranges based on the myFunc: … myFunc.end: label
boundaries, as well as line number and symbol information in DWARF2
binary format, allowing you to debug the assembly source files.
The ending label marks the boundary of the end of a function. Compiled
code automatically provides ending labels. Hand-written assembly code
needs to have the ending labels explicitly added to tell the tool chain
where the ending boundary is. This information is used to automate
statistical profiling of assembly functions. It is also needed by the linker
to eliminate unused functions and other features.
To suppress a specific assembler warning by unique warning number,
the assembler provides the following option:
-Wsuppress 1121
Functions (Code):
_gfxeng_vertspan:
[--sp] = fp;
...
rts;
Add an ending label after rts;. Use the suffix “.end” and begin the label
with “.” to have it treated as an internal label that is not displayed in the
debugger.
.global _gfxeng_vertspan;
_gfxeng_vertspan:
[--sp] = fp;
...
rts;
._gfxeng_vertspan.end:
-h[elp]
The -h (or -help) switch directs the assembler to output to standard
output a list of command-line switches with a syntax summary.
-i
The -idirectory (or -I) switch (include directory path) directs the
assembler to append the specified directory (or a list of directories
separated by semicolons “;”) to the search path for included files.
-l filename
The -l filename (listing) switch directs the assembler to generate the
named listing file. Each listing file (.lst) shows the relationship between
your source code and instruction opcodes that the assembler produces.
For example,
easmblkfn -proc ADSP-BF533 -I\path -I. -l file.lst file.asm
-li filename
The -li (listing) switch directs the assembler to generate the named listing
file with #include files. The file name is a required argument to the -li
switch. For more information, see “Reading a Listing File” on page 1-38.
-M
The -M (generate make rule only) assembler switch directs the assembler to
generate make dependency rules, suitable for the make utility, describing
the dependencies of the source file. No object file is generated for -M
assemblies. For make dependencies with assembly, use the -MM switch.
The output, an assembly make dependencies list, is written to stdout in
the standard command-line format:
“target_file”: “dependency_file.ext”
-MM
The -MM (generate make rule and assemble) assembler switch directs the
assembler to output a rule, suitable for the make utility, describing the
dependencies of the source file. The assembly of the source into an object
file proceeds normally. The output, an assembly make dependencies list,
is written to stdout. The only difference between -MM and -M actions is
that the assembling continues with -MM. See -M for more information.
-Mo filename
The -Mo (output make rule) assembler switch specifies the name of the
make dependencies file that the assembler generates when you use the -M
or -MM switch. If -Mo is not present, the default is <stdout> display. If the
named file is not in the current directory, you must provide the path name
in double quotation marks (" ").
L The
switch.
-Mo filename switch takes precedence over the -o filename
-Mt filename
The -Mt filename (output make rule for named object) assembler switch
specifies the name of the object file for which the assembler generates the
make rule when you use the -M or -MM switch. If the named file is not in
the current directory, you must provide the path name. If -Mt is not
present, the default is the base name plus the .doj extension. See -M
for more information.
-micaswarn
The -micaswarn switch treats multi-issue conflicts as warnings.
-no-anomaly-detect {id1[,id2...]|all|none}
The -no-anomaly-detect switch directs the assembler to switch off any
check for a specific anomaly ID in the assembler. No assembler warning
or error will be issued when the assembler encounters assembly code that
the anomaly will have an impact upon. This option overrules any default
behavior for the anomaly. The switch parameter is:
id – anomaly identifier (for example, 05-00-0245 or 05000245)
all – ignore all identifiers not specifically provided (same as -anom-
aly-detect none))
none – use all identifiers applicable to the given processor (same as -anom-
aly-detect all)
The anomaly identifier syntax may use or omit dashes. For example, either
05-00-00245 or 050000245 are accepted. Additionally, specified ids over-
ride the all and none options. For example, -no-anomaly-detect
all,050000245 detects only anomaly 050000245.
-no-anomaly-workaround {id1[,id2...]|all|none}
The -no-anomaly-workaround switch directs the assembler to switch off
any workaround for a specific anomaly id in the assembler. The assembler
will not alter the user assembly code so that it cannot encounter the
anomaly. This option overrules any default behavior for the anomaly.
The switch parameter is:
id – anomaly identifier (for example, 05-00-0245 or 05000245)
all – ignore all identifiers not specifically provided (same as -anom-
aly-workaround none) )
none – use all identifiers applicable to the given processor (same as -anom-
aly-workaround all)
The anomaly identifier syntax may use or omit dashes. For example, either
05-00-00245 or 050000245 are accepted. Additionally, specified ids
override the all and none options. For example, -no-anomaly-workaround
all,050000245 works around only anomaly 050000245.
A warning may be issued if the assembler always checks for the anomaly
and has no workaround.
-no-expand-symbolic-links
The no-expand-symbolic-links switch directs the assembler not to
expand any directories or files whose name or path contain Cygwin path
components.
-no-expand-windows-shortcuts
The -no-expand-windows-shortcuts switch directs the assembler not to
expand directories or files whose name or path contain Windows
shortcuts.
-no-temp-data-file
The -no-temp-data-file switch directs the assembler not to write
temporary data to a memory (disk).
As part of a space saving measure, the assembler stores all data declarations
into a file. This is to allow large sources to assemble more quickly by free-
ing valuable memory resources. By default, the temporary data files are
stored into the system temporary folder (for example, C:\Documents and
Settings\User\Local Settings\Temp) and is given the prefix
“EasmblkfnNode”). These files are removed by the assembler but, if for any
reason the assembler does not complete, these files will not be deleted and
persist in the temporary folder. These files can always be safely deleted in
such circumstances after the assembler has stopped.
This command-line option allows the user to turn off this default feature.
When turned off, all data is stored into internal memory and not written
to the disk.
-normal-word-code or -nwc
The -normal-word-code or -nwc switch directs the assembler to encode
input sections bearing the /PM qualifier (see Table 1-21) for execution
from normal word memory.
-pp
The -pp (proceed with preprocessing only) switch directs the assembler to
run the preprocessor, but stop without assembling the source into an
object file. When assembling with the -pp switch, the .is file is the final
result of the assembly. By default, the output file name uses the same root
name as the source, with the .is extension.
-proc processor
The -proc processor (target processor) switch specifies that the assembler
produces code suitable for the specified processor.
The processor identifiers directly supported by VisualDSP++ 5.0 are
listed in VisualDSP++ online Help.
For example,
easm21K -proc ADSP-21161 -o bin\p1.doj p1.asm
L See also the -si-revision version switch description for more infor-
mation on silicon revision of the specified processor.
-save-temps
The -save-temps (save intermediate files) switch directs the assembler to
retain intermediate files generated and normally removed as part of the
assembly process.
-short-word-code or -swc
The -short-word-code or -swc switch directs the assembler to encode
input sections bearing the /PM qualifier (see Table 1-21) for execution
from short word memory.
-sp
The -sp (skip preprocessing) switch directs the assembler to assemble the
source file into an object file without running the preprocessor. When the
assembler skips preprocessing, no preprocessed assembly file ( .is) is
created.
-stallcheck
The -stallcheck = option switch provides the following choices for
displaying stall information:
-version
The -version (display version) switch directs the assembler to display
version information for the assembler and preprocessor programs.
-w
The -w (disable all warnings) switch directs the assembler not to display
warning messages generated during assembly.
-Werror number[,number]
The -Werror number switch turns the specified assembler messages into
errors. For example, “-Werror 1177” turns warning message ea1177 into
an error. This switch optionally accepts a list, such as [,number …].
-Wnumber[,number]
The -Wnumber (warning suppression) switch selectively disables warnings
specified by one or more message numbers. For example, -W1092 disables
warning message ea1092. Optionally, this switch accepts a list, such as
[,number …]. See also “-g” on page 1-159.
-Wsuppress number[,number]
The -Wsuppress number switch selectively turns off assembler messages.
For example, “-Wsuppress 1177” turns off warning message ea1177.
Optionally, this switch accepts a list, such as [,number …].
This dialog box allows you to select the target processor, type and name
of the executable file, as well as VisualDSP++ tools available for use with
the selected processor.
When using the VisualDSP++ IDDE, use the Assemble page of the
Project Options dialog box (Figure 1-6) to select and/or set assembler
functional options.
Preprocessor Guide
This section describes pp preprocessor information used when building
programs from a command line or from within the VisualDSP++ 5.0
environment. Software developers who use the preprocessor should be
familiar with:
• “Writing Preprocessor Commands” on page 2-3
• “Header Files and #include Command” on page 2-4
• “Writing Macros” on page 2-7
• “Using Predefined Preprocessor Macros” on page 2-14
• “Specifying Preprocessor Options” on page 2-16
Compiler Preprocessor
The compiler has it own preprocessor that enables the use of preprocessor
commands within C/C++ source. The compiler preprocessor automati-
cally runs before the compiler. This preprocessor is separate from the
assembler preprocessor and has some features that may not be used within
your assembly source files. For more information, refer to the Visu-
alDSP++ C/C++ Compiler and Library Manual for the target processor.
Assembler Preprocessor
The assembler preprocessor differs from the ANSI C standard preproces-
sor in several ways. First, the assembler preprocessor supports a “?”
operator (see on page 2-37) that directs the preprocessor to generate a
unique label for each macro expansion. Second, the assembler preproces-
sor does not treat “.” as a separate token. Instead, “.” is always treated as
part of an identifier. This behavior matches the assembler’s behavior,
which uses “.” to start directives and accepts “.” in symbol names.
For example, the following command sequence:
#define VAR my_var
.VAR x;
does not cause any change to the variable declaration. The text “.VAR” is
treated as a single identifier which does not match the macro name VAR.
The standard C preprocessor treats .VAR as two tokens ( “.” and “VAR”)
and makes the following substitution:
.my_var x;
The file name is placed between a pair of angle bracket characters. The file
name in this form is interpreted as a system header file. These files are
used to declare global definitions, especially memory-mapped registers,
system architecture, and processors.
Example:
#include <device.h>
#include <major.h>
The file name is placed within a pair of double quote characters. The file
name in this form is interpreted as a user header file. These files contain
declarations for interfaces between the source files of the program.
Example:
#include "defTS.h"
#include "fft_ovly.h"
Sequence of Tokens
Syntax: #include text
It is an error if after macro expansion the text does not match one of the
two header file forms. If the text on the line after the #include is not
placed between double quotes (as a user header file) or between angle
brackets (as a system header file), the preprocessor performs macro
expansion on the text. After that expansion, the line requires either of the
two header file forms.
Examples:
/* define preprocessor macro with name for include file */
#define includefilename "header.h"
/* use the preprocessor macro in an #include command */
#include includefilename
/* the code above evaluates to #include "header.h" */
Writing Macros
The assembler/linker preprocessor processes macros in assembly source
files and linker description files (.ldf). Macros provide for text
substitution.
The term macro defines a macro-identifying symbol and its corresponding
definition that the preprocessor uses to substitute the macro reference(s).
For example, use macros to define symbolic constants or to manipulate
register bit masks in an assembly program based on a macro argument,
as follows:
/* Define a symbolic constant */
#define MAX_INPUT 256
The following guidelines are provided to help you construct macros and
use them appropriately.
• A macro definition must begin with #define and must end with a
carriage return.
• Macro termination. If a macro definition ends with a terminator
on the instruction (one semicolon (;) for SHARC and Blackfin
processors; two semicolons (;;) for TigerSHARC processors), do
not place a terminator at the end of the macro (usage) in an assem-
bly statement. However, if a macro definition does not end with a
terminator, each instance of the macro usage must be followed by
the terminator in the assembly statement.
Correct:
#define MultiLineMacro \
instruction1; \
instruction2; \
instruction3
No characters are permitted on a line after a backslash.
#define macro1 \
instruction1; \(whitespace)
instruction2; \
instruction3
#define macro \
/* this macro has two lines */ \
first line; \
/* and two comments */ \
second line
#define macro \
// this comment will devour the rest of the macro \
first line; \
second line
In the code above, the first line of the macro definition starts a
comment. Since there are line-continuation characters, the logical
end of line for that comment is the end of the macro. Thus, the
code yields an “empty” macro.
• Macro nesting (macros called within another macro) is limited only
by the memory available during preprocessing. Recursive macro
expansion, however, is not allowed.
Refer to “#define” on page 2-19 for more information on the #define
command.
Debugging Macros
If you get an unexpected syntax error from the assembler on a macro
expansion, it can be helpful to debug the macro by looking at what the
preprocessor produced post preprocessing. The intermediate file produced
by the preprocessor is the .is output file.
From the VisualDSP++ IDDE, select the Save temporary files check box
on the Assemble page of the Project Options dialog box. If you are run-
ning the assembler from the command line, add the -save-temps switch
(see -save-temps).
Tips for Debugging Macros:
Assembly programmers may find it useful to include the processor system
header files for pre-defined macros that are helpful to assembly language
programmers for that processor family. These are known as “def headers”.
For example, an ADSP-BF534 programmer would use:
// Header is located in <install_path>/Blackfin/include
#include "defBF534.h"
.SECTION data1;
L The , , and
__DATE__ __FILE__
within the single quotation marks (
macros return strings
__TIME__
‘ ’) suitable for initializing
character buffers. For more information, see “.VAR and ASCII
String Initialization Support” on page 1-141.
Table 2-1 on page 2-15 describes the common predefined macros pro-
vided by the preprocessor. Table 1-5 on page 1-26 lists feature macros for
Blackfin processors. Table 1-7 on page 1-29 lists feature macros for
SHARC processors. Table 1-8 on page 1-34 feature macros for Tiger-
SHARC processors. These processor-specific feature macros are defined by
the project development tools to specify the architecture and language
being processed.
L
The
The macro applies to all Analog Devices processors.
-D__VISUALDSPVERSION__ predefined preprocessor macro provides
VisualDSP++ product version information. The macro allows a pre-pro-
cessing check to be placed within code. It can be used to differentiate
between VisualDSP++ releases and updates. The assemblers and linker
predefine -D__VISUALDSPVERSION__ in calls to the preprocessor.
For further information on the product version encoding (including
parameters and examples), see “-D__VISUALDSPVERSION__ Pre-
defined Macro” on page 1-35.
For more information, see the VisualDSP++ User’s Guide and Visu-
alDSP++ online Help.
#define
The #define command defines macros.
When defining macros in your source code, the preprocessor substitutes
each occurrence of the macro with the defined text. Defining this type
of macro has the same effect as using the Find/Replace feature of a text
editor, although it does not replace literals in double quotation marks
(" ") and does not replace a match within a larger token.
For macro definitions longer than one line, place a backslash character (\)
at the end of each line (except the last line) for readability; refer to the
macro definition rules in “Writing Macros” on page 2-7.
You can add arguments to the macro definition. The arguments are sym-
bols separated by commas that appear within parentheses.
Syntax:
#define macroSymbol replacementText
#define macroSymbol[(arg1,arg2,…)] replacementText
where:
macroSymbol – macro identifying symbol
replacementText – text to substitute each occurrence of macroSymbol in
your source code
Examples:
#define BUFFER_SIZE 1020
/* Defines a macro named BUFFER_SIZE and sets its
value to 1020. */
For example, the code above defines a macro named test, which takes two
or more arguments. It is invoked like any other macro, although the
number of arguments can vary.
expands into:
test (1,2) -> bar(1); testbar(2);
test (1,2,3,4,5) -> bar(1); testbar(2,3,4,5);
#elif
The #elif command (else if) is used within an #if … #endif pair.
The #elif includes an alternative condition to test when the initial #if
condition evaluates as FALSE. The preprocessor tests each #elif condition
inside the pair and processes instructions that follow the first true #elif.
There can be an unlimited number of #elif commands inside one
#if … #end pair.
Syntax:
#elif condition
where:
condition – expression to evaluate as TRUE (nonzero) or FALSE (zero)
Example:
#if X == 1
...
#elif X == 2
...
/* The preprocessor includes text within the section
and excludes all other text before #else when X=2. */
#else
#endif
#else
The #else command is used within an #if … #endif pair. It adds an
alternative instruction to the #if … #endif pair. Only one #else com-
mand can be used inside the pair. The preprocessor executes instructions
that follow #else after all the preceding conditions are evaluated as FALSE
(zero). If no #else text is specified, and all preceding #if and #elif
conditions are FALSE, the preprocessor does not include any text inside the
#if … #endif pair.
Syntax:
#else
Example:
#if X == 1
...
#elif X == 2
...
#else
...
/* The preprocessor includes text within the section
and excludes all other text before #else when
x!=1 and x!=2. */
#endif
#endif
The command is required to terminate #if … #endif,
#endif
#ifdef… #endif, and #ifndef … #endif pairs. Ensure that the
number of #if commands matches the number of #endif commands.
Syntax:
#endif
Example:
#if condition
...
...
#endif
/* The preprocessor includes text within the section only
if the test is true. */
#error
The #error command causes the preprocessor to raise an error. The
preprocessor uses the text following the #error command as the error
message.
Syntax:
#error messageText
where:
messageText – user-defined text
To break a long messageText without changing its meaning, place a back-
slash character (\) at the end of each line (except the last line).
Example:
#ifndef __ADSPBF535__
#error \
MyError: \
Expecting a ADSP-BF535. \
Check the Linker Description File!
#endif
#if
The #if command begins an #if … #endif pair. Statements inside an
#if … #endif pair can include other preprocessor commands and condi-
tional expressions. The preprocessor processes instructions inside the
#if … #endif pair only when condition that follows the #if evaluates
as TRUE. Every #if command must terminated with an #endif command.
Syntax:
#if condition
where:
condition – expression to evaluate as TRUE (nonzero) or FALSE (zero)
Example:
#if x!=100 /* test for TRUE condition */
…
/* The preprocessor includes text within the section
if the test is true. */
#endif
More examples:
#if (x!=100) && (y==20)
#if defined(__ADSPBF535__)
#ifdef
The #ifdef (if defined) command begins an #ifdef … #endif pair and
instructs the preprocessor to test whether the macro is defined. Each
#ifdef command must have a matching #endif command.
Syntax:
#ifdef macroSymbol
where:
macroSymbol – macro identifying symbol
Example:
#ifdef __ADSPBF535__
/* Includes text after #ifdef only when __ADSPBF535__ has
been defined. */
#endif
#ifndef
The #ifndef (if not defined) command begins an #ifndef … #endif
pair and directs the preprocessor to test for an undefined macro. The
preprocessor considers a macro undefined if it has no defined value.
Each #ifndef command must have a matching #endif command.
Syntax:
#ifndef macroSymbol
where:
macroSymbol – macro identifying symbol
Example:
#ifndef __ADSPBF535__
/* Includes text after #ifndef only when __ADSPBF535__
is not defined. */
#endif
#include
The #include command directs the preprocessor to insert the text from a
header file at the command location. There are two types of header files:
system and user. However, the #include command may be presented in
three forms:
• #include <filename> – used with system header files
• #include "filename" – used with user header files
• #include text – used with a sequence of tokens
The sequence of tokens is subject to macro expansion by the pre-
processor. After macro expansion, the text must match one of the
header file forms.
The only difference to the preprocessor between the two types of header
files is the way the preprocessor searches for them.
• System Header File <fileName> – The preprocessor searches for a
system header file in this order: (1) the directories you specify, and
(2) the standard list of system directories.
• User Header File “fileName” – The preprocessor searches for a user
header file in this order:
1. Current directory – the directory where the source file that has the
#include command(s) lives
Syntax:
#include <fileName> // include a system header file
#include "fileName" // include a user header file
#include macroFileNameExpansion
/* Include a file named through macro expansion.
This command directs the preprocessor to expand the
macro. The preprocessor processes the expanded text,
which must match either <fileName> or "fileName". */
Example:
#ifdef __ADSPBF535__
/* Tests that __ADSPBF535__ has been defined. */
#include <stdlib.h>
#endif
#line
The #line command directs the preprocessor to set the internal line
counter to the specified value. Use this command for error tracking
purposes.
Syntax:
#line lineNumber “sourceFile”
where:
lineNumber – line number of the source line
sourceFile – name of the source file included in double quotation marks.
The sourceFile entry can include the drive, directory, and file extension
as part of the file name.
Example:
#line 7 "myFile.c"
#pragma
The #pragma command is the implementation-specific command that
modifies the preprocessor behavior. The #pragma command can take any
sequence of tokens. This command is accepted for compatibility with
other VisualDSP++ software tools. The pp preprocessor currently does not
support any pragmas; therefore, it ignores any information in the #pragma
command.
Syntax:
#pragma any_sequence_of_tokens
Example:
#pragma disable_warning 1024
#undef
The #undef command directs the preprocessor to undefine a macro.
Syntax:
#undef macroSymbol
where:
macroSymbol – macro created with the #define command
Example:
#undef BUFFER_SIZE /* undefines a macro named BUFFER_SIZE */
#warning
The #warning command causes the preprocessor to issue a warning.
The preprocessor uses the text following the #warning command as the
warning message.
Syntax:
#warning messageText
where:
messageText – user-defined text
To break a long messageText without changing its meaning, place a
backslash character (\) at the end of each line (except the last line).
Example:
#ifndef __ADSPBF535__
#warning \
MyWarning: \
Expecting a ADSPBF535. \
Check the Linker Description File!
#endif
# (Argument)
The # (argument) “stringization” operator directs the preprocessor to con-
vert a macro argument into a string constant. The preprocessor converts
an argument into a string when macro arguments are substituted into the
macro definition.
The preprocessor handles white space in string-to-literal conversions by:
• Ignoring leading and trailing white spaces
• Converting white space in the middle of the text to a single space
in the resulting string
Syntax:
# toString
where:
toString – macro formal parameter to convert into a literal string.
The # operator must precede a macro parameter. The preprocessor
includes a converted string within double quotation marks (" ").
## (Concatenate)
The ## (concatenate) operator directs the preprocessor to concatenate two
tokens. When you define a macro, you request concatenation with ## in
the macro body. The preprocessor concatenates the syntactic tokens on
either side of the concatenation operator.
Syntax:
token1##token2
Example:
#define varstring(name) .VAR var_##name[] = {‘name’, 0};
varstring (error);
varstring (warning);
JUMP yourlabel_2;
mylabel_3:yc =1+1;yc =2+2;yourlabel_3:Jl =3*3;Jl =5*5;
JUMP mylabel_3;
JUMP yourlabel_3;
The last numeric suffix used to generate unique labels is maintained by the
preprocessor and is available through a preprocessor predefined macro
__LastSuffix__ (see on page 2-15). This value can be used to generate
references to labels in the last macro expansion.
The following example assumes the macro “loop” from the previous
example.
// Some macros for appending a suffix to a label
#define makelab(a, b) a##b
#define Attach(a, b) makelab(a##_, b)
#define LastLabel(foo) Attach( foo, __LastSuffix__)
The above expands to (the last macro expansion had a suffix of 3):
JUMP mylabel_3;
L Mosttoswitches
-no
without arguments can be negated by prefixing
the switch. For example, turns off warning
-nowarn
messages, and -nocs! turns off omitting “!” style comments.
-cpredef
The -cpredef switch directs the preprocessor to produce C compiler-style
strings in all cases. By default, the preprocessor produces assembler-style
strings within single quotes (for example, ‘string’) unless the -cpredef
switch is used.
The -cpredef switch sets the following C compiler-style behaviors:
• Directs the preprocessor to use double quotation marks rather than
the default single quotes as string delimiters for any preprocessor-
generated strings. The preprocessor generates strings for predefined
-cs!
The -cs! switch directs the preprocessor to treat as a comment all text
after “!” on a single line.
-cs/*
The -cs/* switch directs the preprocessor to treat as a comment all text
within /* */ on multiple lines.
-cs//
The -cs// switch directs the preprocessor to treat as a comment all text
after // on a single line.
-cs{
The -cs{ switch directs the preprocessor to treat as a comment all text
within { } on multiple lines.
-csall
The -csall switch directs the preprocessor to accept comments in all
formats.
-Dmacro[=def]
The -Dmacro switch directs the preprocessor to define a macro. If you do
not include the optional definition string (=def), the preprocessor defines
the macro as value 1. Similar to the C compiler, you can use the -D switch
to define an assembly language constant macro.
Some examples of this switch are:
-Dinput // defines input as 1
-h[elp]
The -h (or -help) switch directs the preprocessor to send to standard
output the list of command-line switches with a syntax summary.
-i
The -i (less includes) switch may be used with the -M or -MM switches to
direct the preprocessor to not output dependencies on any system files.
System files are any files that are brought in using #include < >. Files
included using #include " " (double quote characters) are included in the
dependency list.
-i
The -idirectory (or -Idirectory) switch direct the preprocessor
to append the specified directory (or a list of directories separated
by semicolons) to the search path for included header files
(see on page 2-29).
L not
The current directory is the directory where the source file lives,
the directory of the assembler program. Usage of full path
names for the -I switch on the command line (omitting the disk
partition) is recommended.
The preprocessor searches for included files delimited by < > in this order:
1. The directories in the search path supplied by the -I switch (sub-
ject to modification by the -I- switch, as shown in “-I-” on
page 2-46. If more than one directory is supplied by the -I switch,
the directories are searched in the order that they appear on the
command line.
2. The system directory (that is, the \include subdirectory of the
VisualDSP++ installation directory.
-I-
The -I- switch indicates where to start searching for system include files,
which are delimited by < >. If there are several directories in the search
path, the -I- switch indicates where in the path the search for system
include files begins.
For example,
pp -Idir1 -Idir2 -I- -Idir3 -Idir4 myfile.asm
-M
The -M switch directs the preprocessor to output a rule (generate make
rule only) suitable for the make utility, describing the dependencies of the
source file. The output, a make dependencies list, is written to stdout in
the standard command-line format.
“target_file”: “dependency_file.ext”
where:
dependency_file.ext may be an assembly source file or a header file
included with the #include preprocessor command
When the -o filename switch is used with -M , the -o option is ignored. To
specify an alternate target name for the make dependencies, use the -Mt
filename switch. To direct the make dependencies to a file, use the -Mo
filename switch.
-MM
The -MM switch directs the preprocessor to output a rule (generate make
rule and preprocess) suitable for the make utility, describing the depen-
dencies of the source file. The output, a make dependencies list, is written
to stdout in the standard command-line format.
The only difference between -MM and -M actions is that the preprocessing
continues with -MM. See -M for more information.
-Mo filename
The -Mo switch specifies the name of the make dependencies file (output
make rule) that the preprocessor generates when using the -M or -MM
switch. The switch overrides default of make dependencies to stdout.
-Mt filename
The -Mt switch specifies the name of the target file (output make rule for
the named source) for which the preprocessor generates the make rule
using the -M or -MM switch. The -Mt fileneme switch overrides the default
filename.is file. See -M for more information.
-o filename
The -o switch directs the preprocessor to use (output) the specified
filename argument for the preprocessed assembly file. The preprocessor
directs the output to stdout when no -o option is specified.
-stringize
The -stringize switch enables the preprocessor stringization operator.
By default, this switch is off. When set, this switch turns on the preproces-
sor stringization functionality (see # (Argument)) which, by default, is
turned off to avoid possible undesired stringization.
For example, there is a conflict between the stringization operator and the
assembler’s boolean constant format in the following macro definition:
#define bool_const b#00000001
-tokenize-dot
The -tokenize-dot switch parses identifiers using C language rules
instead of assembler rules, without the need of other C semantics
(see -cpredef for more information).
When the -tokenize-dot switch is used, the preprocessor treats “.” as an
operator and not as part of an identifier. If the -notokenize-dot switch is
used, it returns the preprocessor to the default behavior. The only benefit
to the negative version is that if it appears on the command line after the
-cpredef switch, it can turn off the behavior of “.” without affecting
other C semantics.
-Uname
The -Uname switch directs the preprocessor to undefine a macro on the
command line. The “undefine macro” switch applies only to macros
defined on the same command line. The functionality provides a way for
users to undefine feature macros specified by the assembler or linker.
-v[erbose]
The -v[erbose] switch directs the preprocessor to output the version of
the preprocessor program and information for each phase of the
preprocessing.
-version
The -version switch directs the preprocessor to display version
information for the preprocessor program.
-w
The -w (disable all warnings) switch directs the assembler not to display
warning messages generated during assembly. Note that -w has the same
effect as the -nowarn switch.
-Wnumber
The -Wnumber (warning suppression) switch selectively disables warnings
specified by one or more message numbers. For example, -W74 disables
warning message pp0074.
-warn
The -warn switch generates (prints) warning messages (this switch is on by
default). The -nowarn switch negates this action.
Symbols ASCII
? preprocessor operator, 2-37 string directive, 1-71, 1-80
string initialization, 1-83, 1-119, 1-141
.asm files, 1-3
Numerics assembler
1.0r fract, 1-63 overview, 1-3
1.15 fract, 1-61, 1-62 Blackfin family macros, 1-25
1.31 fract, 1-62 Blackfin feature macros, 1-25
1.31 fracts, 1-82 command-line syntax, 1-145
32-bit initialization (used with 1.31 fracts), 1-82 debugging syntax errors, 2-13
directive syntax, 1-6, 1-71
expressions, constant and address, 1-54
A
file extensions, 1-146
absolute address, 1-68 instruction set, 1-6
ADDRESS () assembler operator, 1-57 keywords, 1-42
ADI macro, 2-15 numeric bases, 1-60
.ALIGN (address alignment) assembler operators, 1-56
directive, 1-76 producing code for specified processor, 1-168
-align-branch-lines assembler switch, 1-151 program content, 1-6
.ALIGN_CODE (code address alignment) running from command line, 1-145
assembler directive, 1-78 run-time environment, 1-2
-anomaly-detect assembler switch, 1-152, 1-165 setting options, 1-144, 1-173
-anomaly-warn assembler switch, 1-152 SHARC feature macros, 1-25
-anomaly-workaround assembler switch, 1-153 source files (.asm), 1-4
arithmetic special operators, 1-57
fractional, 1-63 symbols, 1-53
mixed fractional, 1-63 TigerSHARC feature macros, 1-26
C D
C/C++ run-time library, initializing, 1-129 DATA64 (64-bit word section) qualifier, 1-128
CHAR32 section qualifier, 1-127 .DATA assembler directive, 1-72
CHAR8 section qualifier, 1-127 __DATE__ macro, 2-15
CHARANY section qualifier, 1-127 .dat files, 1-3, 1-146
-char-size-32 assembler switch, 1-154 -D (define macro)
=char-size-8 assembler switch, 1-154 assembler switch, 1-155, 1-158
-char-size-any assembler switch, 1-154 preprocessor switch, 2-44
circular buffers, setting, 1-58, 1-59 debugging
comma-separated options, 1-159 generate information, 1-159
.COMPRESS assembler directive, 1-85 macros, 2-13
concatenate (##) preprocessor operator, 2-36 debugging macros, 2-13
conditional assembly directives -default-branch-np assembler switch, 1-155
.ELIF, 1-64 -default-branch-p assembler switch, 1-155
.ELSE, 1-64 #define (macro) preprocessor command, 2-8,
.ENDIF, 1-64 2-19
.IF, 1-64 dependencies, from buffer initialization, 1-37
constant expressions, 1-55 directives list, assembler, 1-71
conventions -D_LANGUAGE_C macro, 1-34
comment strings, 1-64 .dlb files, 1-5
file extensions, 1-146 DMAONLY section qualifier, 1-128
file names, 1-146 DM (data), 40-bit word section qualifier, 1-128
numeric formats, 1-60 .doj files, 1-3
user-defined symbols, 1-53 DOUBLE32|64|ANY section qualifiers, 1-126
-cpredef (C-style definitions) -double-size-32 assembler switch, 1-156
preprocessor switch, 2-42, 2-43 -double-size-64 assembler switch, 1-156
C programs, interfacing assembly, 1-20 -double-size-any assembler switch, 1-156
C++ programs, interfacing assembly, 1-20 DWARF2 function information, 1-159
-csall (all comment styles) preprocessor switch,
2-44
E
-cs! (! comment style) preprocessor switch, 2-43
-cs/* (/* */ comment style) preprocessor switch, easm21k assembler driver, 1-2
2-43 easmblkfn assembler driver, 1-2
-cs// (// comment style) preprocessor switch, easmts assembler driver, 1-2
2-44 ELF.h header file, 1-126
-cs{ ({ } comment style) preprocessor switch, ELF section types, 1-126
2-44 .ELIF conditional assembly directive, 1-64
#elif (else if) preprocessor command, 2-22 -flags-pp assembler switch, 1-159
#else (alternate instruction) preprocessor floating-point data, 1-115, 1-122
command, 2-23 .FORCECOMPRESS assembler directive, 1-90
.ELSE conditional assembly directive, 1-64 formats, numeric, 1-60
.ENDIF conditional assembly directive, 1-64 four-byte data initializer lists, 1-73
#endif (termination) preprocessor command, fractional data type arithmetic, 1-63
2-24 fracts
end labels 1.0r special case, 1-63
marking ending function boundaries, 1-39 1.15 format, 1-62
missing, 1-160 1.31 format, 1-62
end of a function, 1-160 constants, 1-61
.ENDSEG assembler directive, 1-131 mixed type arithmetic, 1-63
#error (error message) preprocessor command, signed values, 1-61
2-25
-expand-symbolic-links assembler switch, 1-157
G
-expand-windows-shortucts assembler switch,
1-157 -g (generate debug info) assembler switch, 1-159
expressions, 1-55 .GLOBAL (global symbol) assembler directive,
.EXTERN (global label) assembler directive, 1-72, 1-92
1-86 global symbols, 1-92
.EXTERN STRUCT assembler directive, 1-87
H
F hardware anomalies (warnings), 1-153
.FILE_ATTR assembler directive, 1-90 header files (.h extension)
-file-attr (file attribute) assembler switch, 1-157 source files, 1-3
file format, ELF (Executable and Linkable system, 2-5
Format), 1-3 tokens, 2-5
__FILE__ macro, 2-15 user, 2-5
.FILE (override filename) assembler directive, hex value, decoding, 1-35
1-89 -h (help) assembler switch, 1-161, 2-44
files HI() assembler operator, 1-57
.asm (assembly source), 1-3
.dat (data), 1-3 I
.dlb (library), 1-5 -I assembler switch, see -flags-compiler switch
.doj (object), 1-3 .IF conditional assembly directive, 1-64
.h (header), 1-3 #ifdef (test if defined) preprocessor command,
.is (preprocessed assembly), 1-168, 2-13 2-27
list of extensions, 1-146 #ifndef (test if not defined) preprocessor
naming conventions, 1-146 command, 2-28
-flags-compiler assembler switch, 1-157
#if (test if true) preprocessor command, 2-26 #line (output line number) preprocessor
-i (include directory path) command, 2-31
assembler switch, 1-161 Linker Description Files (.ldf), 1-7, 1-8
preprocessor switch, 2-45 .LIST assembler directive, 1-98
-I (include search-path)) assembler option, .LIST_DATA assembler directive, 1-99
1-158 .LIST_DATFILE assembler directive, 1-100
-i (less includes) preprocessor switch, 2-45 .LIST_DEFTAB assembler directive, 1-100
.IMPORT listing files
assembler directive, 1-94 data initialization, 1-100
header files, 1-37, 1-95 .lst extension, 1-5, 1-38
.INC/BINARY assembler directive, 1-96 named, 1-162
.INCBIN assembler directive, 1-73 opcodes, 1-99, 1-103
include files producing, 1-5
system header files, 2-4 .LIST_LOCTAB assembler directive, 1-102
user header files, 2-4 .LIST_WRAPDATA assembler directive, 1-103
#include (insert a file) preprocessor command, -l (named listing file) assembler switch, 1-162
2-4, 2-6, 2-29 LO() assembler operator, 1-57
initialization section qualifiers, 1-129 local symbols, 1-92
INPUT_SECTION_ALIGN() command, 1-76 local tab width, 1-100, 1-102
input section alignment instruction, 1-76 .LONG assembler directives, 1-104
intermediate source file (.is), 1-5 long-form initialization, 1-134
-I- (search system include files) preprocessor
switch, 2-46
M
.is (preprocessed assembly) files, 1-168, 2-13
macro argument, converting into string
constant, 2-35
K macros
keywords, assembler, 1-42 Blackfin assembler, 1-26
debugging, 2-13
defining, 2-7, 2-8, 2-19, 2-20
L
expansion, 1-25, 2-5
_LANGUAGE_ASM macro, 2-15 predefined by preprocessor, 2-14, 2-15
_LANGUAGE_C macro, 2-15 SHARC assembler, 1-26
__LASTSUFFIX__ macro, 2-15, 2-38 TigerSHARC assembler, 1-26
.LEFTMARGIN assembler directive, 1-97 make dependencies, 1-37, 1-95
legacy directives -meminit linker switch, 1-129
.PORT, 1-114, 1-121 memory
.SEGMENT/.ENDSEG, 1-131 initializer, 1-129
LENGTH () assembler operator, 1-57 RAM (random access memory), 1-128
-li (listing with include) assembler switch, 1-163 sections, declaring, 1-125
__LINE__ macro, 2-15 types, 1-7, 1-128
preprocessor commands R
#define, 2-19 R32 qualifier, 1-62
#elif, 2-22 relational
#else, 2-23 expressions, 1-66
#endif, 2-24 operators, 1-56
#error, 2-25 RESOLVE() command (in LDF), 1-138
#if, 2-26 rounding modes, 1-122
#ifdef, 2-27 .ROUND_MINUS (rounding mode) assembler
#ifndef, 2-28 directive, 1-122
#include, 2-29 .ROUND_NEAREST (rounding mode)
#line (counter), 2-31 assembler directive, 1-122
#pragma, 2-32 .ROUND_PLUS (rounding mode) assembler
#undef, 2-33 directive, 1-122
#warning, 2-34 .ROUND_ZERO (rounding mode) assembler
preprocessor macros directive, 1-122
common macros, 2-15 RUNTIME_INIT section qualifier, 1-129
... preprocessor operator, 2-20
preprocessor operators
? (generate unique label), 2-37 S
## (concatenate), 2-36 -save-temps (save intermediate files) assembler
# (stringization), 2-35 switch, 1-168
... (variable-length argument list), 2-20 searching, system include files, 2-46
.PREVIOUS assembler directive, 1-118 section
-proc (target processor) assembler switch, 1-168 name symbol, 1-125
programs qualifier, DM (data memory), 1-128
assembling, 1-4 qualifier, NW (normal-word memory), 1-128
content, 1-6 qualifier, PM (code and data), 1-128
listing files, 1-38 qualifier, RAM (random access memory),
preprocessing, 1-24 1-128
structure, 1-7 qualifier, SW (short-word memory), 1-128
writing in assembly, 1-3 type identifier, 1-126
project settings .SECTION (start or embed a section) assembler
assembler, 1-173 directive, 1-125
preprocessor, 1-24, 2-16 initialization qualifiers, 1-129
.SEGMENT (legacy directive) assembler
directive, 1-131
Q
.SEPARATE_MEM_SEGMENTS assembler
qualifiers, 1-62, 1-105 directive, 1-131, 1-132
question mark (?) preprocessor operator, 2-37 .SET assembler directive, 1-75
SHF_ALLOC flag, 1-130
W Z
WARNING ea1121, missing end labels, 1-160 ZERO_INIT
warnings memory section, 1-130
multi-issue conflicts, 1-164 section qualifier, 1-129
printing, 2-49
suppressing, See -Wnumber (warning
suppression) preprocessor switch