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 implication or otherwise under the patent rights of Analog Devices, Inc.
Trademark and Service Mark Notice
The Analog Devices logo, the CROSSCORE logo, VisualDSP++,
SHARC, TigerSHARC, Blackfin, and EZ-KIT Lite are registered trademarks of Analog Devices, Inc.
All other brand and product names are trademarks or service marks of
their respective owners.
CONTENTS
CONTENTS
PREFACE
Purpose ......................................................................................... xiii
Intended Audience ........................................................................ xiii
Manual Contents ........................................................................... xiv
What’s New in this Manual ............................................................ xiv
Technical or Customer Support ....................................................... xv
Supported Processors ...................................................................... xvi
Product Information ..................................................................... xvii
MyAnalog.com ........................................................................ xvii
Processor Product Information ................................................ xviii
Related Documents .................................................................. xix
Online Technical Documentation .............................................. xx
Accessing Documentation From VisualDSP++ ....................... xx
Accessing Documentation From Windows ............................ xxi
Accessing Documentation From the Web .............................. xxi
VisualDSP++ 4.5 Assembler and Preprocessor Manualxi
-xiiVisualDSP++ 4.5 Assembler and Preprocessor Manual
PREFACE
Thank you for purchasing Analog Devices, Inc. development software for
digital signal processing (DSP) applications.
Purpose
The VisualDSP++ 4.5 Assembler and Preprocessor Manual contains infor-
mation about the assembler preprocessor utilties for the following Analog
Devices, Inc. processor families—SHARC® (ADSP-21xxx) processors,
TigerSHARC
processors.
®
(ADSP-TSxxx) processors, and Blackfin® (ADSP-BFxxx)
The manual describes how to write assembly programs for these processors
and 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.
VisualDSP++ 4.5 Assembler and Preprocessor Manualxiii
Manual Contents
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 the assembler’s
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.
What’s New in this Manual
The VisualDSP++ 4.5 Assembler and Preprocessor Manual is a new manual
that documents assembler support for all currently available Analog
Devices’ SHARC, TigerSHARC
“Supported Processors”.
Refer to VisualDSP++ 4.5 Product Release Bulletin for information on all
new and updated VisualDSP++® 4.5 features and other release
information.
xivVisualDSP++ 4.5 Assembler and Preprocessor Manual
and Blackfin processors listed in
Technical or Customer Support
You can reach Analog Devices, Inc. Customer Support in the following
ways:
•Visit the Embedded Processing and DSP products Web site at
•Contact your Analog Devices, Inc. local sales office or authorized
distributor
•Send questions by mail to:
Analog Devices, Inc.
One Technology Way
P.O. Box 9106
Norwood, MA 02062-9106
USA
VisualDSP++ 4.5 Assembler and Preprocessor Manualxv
Supported Processors
Supported Processors
The following is the list of Analog Devices, Inc. processors supported in
VisualDSP++ 4.5.
TigerSHARC (ADSP-TSxxx) Processors
The name “TigerSHARC” refers to a family of floating-point and
fixed-point [8-bit, 16-bit, and 32-bit] processors. VisualDSP++ currently
supports the following TigerSHARC processors:
ADSP-TS101 ADSP-TS201 ADSP-TS202 ADSP-TS203
SHARC (ADSP-21xxx) Processors
The name “SHARC” refers to a family of high-performance, 32-bit,
floating-point processors that can be used in speech, sound, graphics, and
imaging applications. VisualDSP++ currently supports the following
SHARC processors:
You can obtain product information from the Analog Devices Web site,
from the product CD-ROM, or from the printed publications (manuals).
Analog Devices is online at
mation about a broad range of products—analog integrated circuits,
amplifiers, converters, and digital signal processors.
MyAnalog.com
MyAnalog.com is a free feature of the Analog Devices Web site that allows
customization of a Web page to display only the latest information on
products you are interested in. You can also choose to receive weekly
e-mail notifications containing updates to the Web pages that meet your
interests.
sheets, code examples, and more.
VisualDSP++ 4.5 Assembler and Preprocessor Manualxvii
MyAnalog.com provides access to books, application notes, data
www.analog.com. Our Web site provides infor-
Product Information
Registration
Visit
www.myanalog.com to sign up. Click Register to use MyAnalog.com.
Registration takes about five minutes and serves as a means to select the
information you want to receive.
If you are already a registered user, just log on. Your user name is your
e-mail address.
Processor Product Information
For information on embedded processors and DSPs, visit our Web site at
www.analog.com/processors, which provides access to technical publica-
tions, data sheets, application notes, product overviews, and product
announcements.
You may also obtain additional information about Analog Devices and its
products in any of the following ways.
xviiiVisualDSP++ 4.5 Assembler and Preprocessor Manual
Related Documents
For information on product related development software, see these
publications:
•VisualDSP++ 4.5 Getting Started Guide
•VisualDSP++ 4.5 User’s Guide
•VisualDSP++ 4.5 C/C++ Compiler and Library Manual for SHARC
Processors
•VisualDSP++ 4.5 C/C++ Compiler and Library Manual for
TigerSHARC Processors
•VisualDSP++ 4.5 C/C++ Compiler and Library Manual for Blackfin
Processors
•VisualDSP++ 4.5 Assembler and Preprocessor Manual
Preface
•VisualDSP++ 4.5 Linker and Utilities Manual
•VisualDSP++ 4.5 Loader Manual
•VisualDSP++ 4.5 Product Release Bulletin
•VisualDSP++ Kernel (VDK) User’s Guide
•Device Drivers and System Services Manual for Blackfin Processors
•Quick Installation Reference Card
For hardware information, refer to your processors’s hardware reference,
programming reference, or data sheet. All documentation is available
online. Most documentation is available in printed form.
Visit the Technical Library Web site to access all processor and tools manuals and data sheets:
VisualDSP++ 4.5 Assembler and Preprocessor Manualxix
Product Information
Online Technical Documentation
Online documentation includes the VisualDSP++ Help system, software
tools manuals, hardware tools manuals, processor manuals, Dinkum
Abridged C++ library, and Flexible License Manager (FlexLM) network
license manager software documentation. You can easily search across the
entire VisualDSP++ documentation set for any topic of interest using the
Search function of VisualDSP++ Help system. For easy printing, supplementary
Each documentation file type is described as follows.
File Description
.CHMHelp system files and manuals in Help format
.PDF files of most manuals are also provided.
.HTM or
.HTML
.PDFVisualDSP++ and processor manuals in Portable Documentation Format (PDF).
Dinkum Abridged C++ library and FlexLM network license manager software documentation. Viewing and printing the
Internet Explorer 5.01 (or higher).
Viewing and printing the
Reader (4.5 or higher).
.PDF files requires a PDF reader, such as Adobe Acrobat
.HTML files requires a browser, such as
Access the online documentation from the VisualDSP++ environment,
Windows
®
Explorer, or the Analog Devices Web site.
Accessing Documentation From VisualDSP++
From the VisualDSP++ environment:
•Access VisualDSP++ online Help from the Help menu’s Contents, Search, and Index commands.
•Open online Help from context-sensitive user interface items (toolbar buttons, menu commands, and windows).
xxVisualDSP++ 4.5 Assembler and Preprocessor Manual
Preface
Accessing Documentation From Windows
In addition to any shortcuts you may have constructed, there are many
ways to open VisualDSP++ online Help or the supplementary documentation from Windows.
Help system files (.
CHM) are located in the Help folder of VisualDSP++
environment. The .PDF files are located in the Docs folder of your
VisualDSP++ installation CD-ROM. The Docs folder also contains the
Dinkum Abridged C++ library and the FlexLM network license manager
software documentation.
Using Windows Explorer
•Double-click the vdsp-help.chm file, which is the master Help system, to access all the other .CHM files.
•Open your VisualDSP++ installation CD-ROM and double-click
any file that is part of the VisualDSP++ documentation set.
Using the Windows Start Button
•Access VisualDSP++ online Help by clicking the Start button and
choosing Programs, Analog Devices, VisualDSP++, and
VisualDSP++ Documentation.
Accessing Documentation From the Web
Download manuals in PDF format at the following Web site:
Select a processor family and book title. Download archive (.ZIP) files, one
for each manual. Use any archive management software, such as WinZip,
to decompress downloaded files.
VisualDSP++ 4.5 Assembler and Preprocessor Manualxxi
Product Information
Printed Manuals
For general questions regarding literature ordering, call the Literature
Center at 1-800-ANALOGD (1-800-262-5643) and follow the prompts.
VisualDSP++ Documentation Set
To purchase VisualDSP++ manuals, call 1-603-883-2430. The manuals
may be purchased only as a kit.
If you do not have an account with Analog Devices, you are referred to
Analog Devices distributors. For information on our distributors, log onto
http://www.analog.com/salesdir/continent.asp.
Hardware Tools Manuals
To purchase EZ-KIT Lite® and In-Circuit Emulator (ICE) manuals, call
1-603-883-2430. The manuals may be ordered by title or by product
number located on the back cover of each manual.
Processor Manuals
Hardware reference and instruction set reference manuals may be ordered
through the Literature Center at 1-800-ANALOGD (1-800-262-5643),
or downloaded from the Analog Devices Web site. Manuals may be
ordered by title or by product number located on the back cover of each
manual.
Data Sheets
All data sheets (preliminary and production) may be downloaded from the
Analog Devices Web site. Only production (final) data sheets (Rev. 0, A,
B, C, and so on) can be obtained from the Literature Center at
1-800-ANALOGD (1-800-262-5643); they also can be downloaded from
the Web site.
xxiiVisualDSP++ 4.5 Assembler and Preprocessor Manual
Preface
To have a data sheet faxed to you, call the Analog Devices Faxback System
at 1-800-446-6212. Follow the prompts and a list of data sheet code
numbers will be faxed to you. If the data sheet you want is not listed,
check for it on the Web site.
Notation Conventions
Text conventions used in this manual are identified and described as
follows.
L
ExampleDescription
Close command
(File menu)
{this | that}Alternative required items in syntax descriptions appear within curly
[this | that]Optional items in syntax descriptions appear within brackets and sepa-
[this,…]Optional item lists in syntax descriptions appear within brackets
.SECTIONCommands, directives, keywords, and feature names are in text with
filenameNon-keyword placeholders appear in text with italic style format.
appear throughout this document.
Titles in in bold style reference sections indicate the location of an item
within the VisualDSP++ environment’s menu system (for example, the
Close command appears on the File menu).
brackets and separated by vertical bars; read the example as this or
that. One or the other is required.
rated by vertical bars; read the example as an optional this or that.
delimited by commas and terminated with an ellipse; read the example
as an optional comma-separated list of
letter gothic font.
this.
Additional conventions, which apply only to specific chapters, may
VisualDSP++ 4.5 Assembler and Preprocessor Manualxxiii
Notation Conventions
ExampleDescription
Note: For correct operation, ...
A Note provides supplementary information on a related topic. In the
L
a
[
online version of this book, the word Note appears instead of this
symbol.
Caution: Incorrect device operation may result if ...
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.
Warning: Injury to device users may result if ...
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 Wa rning appears
instead of this symbol.
xxivVisualDSP++ 4.5 Assembler and Preprocessor Manual
1ASSEMBLER
This chapter provides information on how to use the assembler for developing and assembling programs with SHARC (ADSP-21xxx) processors,
TigerSHARC (ADSP-TSxxx) processors, and Blackfin (ADSP-BFxxx)
processors.
The chapter contains:
•“Assembler Guide” on page 1-2
Describes the process of developing new programs in the processor’s assembly language
•“Assembler Syntax Reference” on page 1-33
Provides the assembler rules and conventions of syntax which are
used to define symbols (identifiers), expressions, and to describe
different numeric and comment formats
•“Assembler Command-Line Reference” on page 1-129
Provides reference information on the assembler’s switches and
conventions
L
VisualDSP++ 4.5 Assembler and Preprocessor Manual1-1
The code examples in this manual have been compiled using
VisualDSP++ 4.5. The examples compiled with other versions of
VisualDSP++ may result in build errors or different output
although the highlighted algorithms stand and should continue to
stand in future releases of VisualDSP++.
Assembler Guide
Assembler Guide
In VisualDSP++ 4.5, the assembler drivers for each processor family run
from the VisualDSP++ Integrated Debugging and Development Environment (IDDE) or from an operating system command line. The assembler
processes assembly source, data, header files, and produces an object file.
Assembler operations depend on two types of controls: assembler directives and assembler switches.
VisualDSP++ 4.5 supports the following assembler drivers:
This section describes the process of developing 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:
•“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-26
•“Make Dependencies” on page 1-30
•“Reading a Listing File” on page 1-31
•“Statistical Profiling for Assembly Functions” on page 1-31
•“Specifying Assembler Options in VisualDSP++” on page 1-151
1-2VisualDSP++ 4.5 Assembler and Preprocessor Manual
Assembler
For information about the processor architecture, including the instruction set used when writing the assembly programs, see the hardware
reference manual and instruction set manual for an appropriate processor.
Assembler Overview
The assembler processes data from assembly source (.ASM), data (.DAT),
and include header (
Linkable Format (ELF), an industry-standard format for binary object
files. The object file name has a
In addition to the object file, the assembler can produce a listing file,
which shows the correspondence between the binary code and the source.
Assembler switches are specified from the VisualDSP++ IDDE or in the
command 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. See “Assembler Com-
mand-Line Reference” on page 1-129.
.H) files to generate object files in Executable and
.DOJ extension.
You can also set assembler options via the Assemble tab of the
VisualDSP++ Project Options dialog box (see “Specifying Assembler
Options in VisualDSP++” on page 1-151).
Writing Assembly Programs
Assembler directives are coded in assembly source files. The directives
allow you to define variables, set up some hardware features, and identify
program’s sections for placement within processor memory. The assembler
uses directives for guidance as it translates a source program into object
code.
VisualDSP++ 4.5 Assembler and Preprocessor Manual1-3
Assembler Guide
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 on page 1-4 shows a graphical overview of the assembly pro-
cess. The figure shows the preprocessor processing the assembly source
(.ASM) and header (.H) files.
Data initialization file
(.DAT)
Object file
Assembly source file
Preprocessor
preprocessed file (.IS)
(.DOJ)
(.ASM)
Intermediate
Assembler
Header file
(.H)
Listing file
(.LST)
Figure 1-1. Assembler Input and Output Files
1-4VisualDSP++ 4.5 Assembler and Preprocessor Manual
Assembler
Assemble your source files from the VisualDSP++ environment or using
any mechanism, such as a batch file or makefile, that will support invoking an appropriate assembler driver with a specified command-line
command. By default, the assembler processes an input file to produce a
binary object file (.
DOJ) and an optional listing file (.LST).
Object files produced by the processor assembler may be used as input to
the linker and archiver. You can archive the output of an assembly process
into a library file (.DLB), which can then be linked with other objects into
an executable. Use the linker to combine separately assembled object files
and objects from library files to produce an executable file. For more
information on the linker and archiver, see the VisualDSP++ 4.5 Linker and Utilities Manual .
A binary object file (.DOJ) and an optional listing (.LST) file are final
results of the successful assembly.
The assembler listing files are text files read for information on the results
of the assembly process. The listing file also provides information about
the imported c data structures. The listing file tells which imports were
used within the program, followed by a more detailed section. (See the
.import directive on page 1-84.) The file shows the name, total size and
layout with offset for the members. The information appears at the end of
the listing. You must specify the -l listname switch (on page 1-143) to
get a listing file.
The assembly source file may contain preprocessor commands, such as
#include
, that cause the preprocessor to include header files (.H) into the
source program. The preprocessor’s only output, an intermediate source
file (.IS), is the assembler’s primary input. In normal operation, the preprocessor output is a temporary file that will be deleted during the
assembly process.
VisualDSP++ 4.5 Assembler and Preprocessor Manual1-5
Assembler Guide
Program Content
Assembly source file statements include assembly instructions, assembler
directives, and preprocessor commands.
Assembly Instructions
Instructions adhere to the processor’s instruction set syntax documented
in the processor’s instruction set manual. Each instruction line must be
terminated by a semicolon (;). On TigerSHARC processors, each instruction line (which can contain up to 4 instructions) is terminated by
an additional semicolon (;;).Figure 1-2 on page 1-10 shows an example
assembly source file.
To mark the location of an instruction, place an address label at the beginning of an instruction line or on the preceding line. End the label with a
colon (:) before beginning the instruction. Your program can then refer to
this memory location using the label instead of an address. The assembler
places no restriction on the number of characters in a label.
Labels are case sensitive. The assembler treats “outer” and “Outer” as
unique labels. For example (in Blackfin processors),