W3.1
Assembler and Preprocessor
Manual for Blackfin Processors
Revision 2.1, April 2003
Part Number
82-000410-04
Analog Devices, Inc.
One Technology Way
Norwood, Mass. 02062-9106
a
Copyright Information
© 2003 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.
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.
Trademark and Service Mark Notice
The Analog Devices logo, VisualDSP, the VisualDSP logo, SHARC,
the SHARC logo, TigerSHARC, the TigerSHARC logo, Blackfin, the
Blackfin logo are registered trademarks of Analog Devices, Inc.
VisualDSP++, the VisualDSP++ logo, CROSSCORE, the CROSSCORE
logo, and EZ-KIT Lite are trademarks of Analog Devices, Inc.
All other brand and product names are trademarks or service marks of
their respective owners.
VisualDSP++ 3.1 Assembler and Preprocessor Manual iii
for Blackfin Processors
CONTENTS
PREFACE
Purpose ........................................................................................... xi
Intended Audience .......................................................................... xi
Manual Contents ........................................................................... xii
What’s New in this Manual ............................................................ xii
Technical or Customer Support ..................................................... xiii
Supported Processors ..................................................................... xiii
Product Information ...................................................................... xiv
MyAnalog.com ......................................................................... xiv
DSP Product Information ......................................................... xiv
Related Documents ................................................................... xv
Online Technical Documentation .............................................. xv
From VisualDSP++ .............................................................. xvi
From Windows .................................................................... xvi
From the Web ..................................................................... xvii
Printed Manuals ..................................................................... xviii
VisualDSP++ Documentation Set ....................................... xviii
Hardware Manuals ............................................................. xviii
Data Sheets ........................................................................ xviii
CONTENTS
iv VisualDSP++ 3.1 Assembler and Preprocessor Manual
for Blackfin Processors
Contacting DSP Publications ................................................... xix
Notation Conventions ................................................................... xix
ASSEMBLER
Assembler Guide .......................................................................... 1-2
Assembler Overview ................................................................ 1-3
Writing Assembly Programs ..................................................... 1-3
Program Content ................................................................ 1-5
Program Structure .............................................................. 1-7
Program Interfacing Requirements .................................... 1-11
Using Assembler Support for C Structs .................................. 1-12
Preprocessing a Program ........................................................ 1-14
Using Assembler Feature Macros ........................................... 1-15
Make Dependencies .............................................................. 1-16
Reading a Listing File ............................................................ 1-17
Assembler Syntax Reference ........................................................ 1-19
Assembler Keywords and Symbols ......................................... 1-20
Assembler Expressions ........................................................... 1-24
Assembler Operators ............................................................. 1-25
Numeric Formats .................................................................. 1-27
Fractional Type Support .................................................... 1-28
1.31 Fracts ................................................................... 1-28
1.0r Special Case .......................................................... 1-29
Fractional Arithmetic .................................................... 1-29
Mixed Type Arithmetic ................................................. 1-30
VisualDSP++ 3.1 Assembler and Preprocessor Manual v
for Blackfin Processors
CONTENTS
Comment Conventions ......................................................... 1-30
Conditional Assembly Directives ............................................ 1-30
C Struct Support in Assembly Built-In Functions ................... 1-33
OFFSETOF() Built-In ...................................................... 1-33
SIZEOF() Built-In ............................................................ 1-33
-> Struct References ............................................................... 1-34
Assembler Directives .............................................................. 1-37
.ALIGN, Specify an Address Alignment ............................. 1-40
.BYTE, Declare a Byte Data Variable or Buffer .................. 1-42
ASCII String Initialization Support ............................... 1-44
.EXTERN, Refer to a Globally Available Symbol ............... 1-45
.EXTERN STRUCT, Refer to a Struct Defined Elsewhere . 1-46
.FILE, Override the Name of a Source File ........................ 1-48
.GLOBAL, Make a Symbol Globally Available ................... 1-49
.IMPORT, Provide Structure Layout Information .............. 1-50
.LEFTMARGIN, Set the Margin Width of a Listing File .... 1-52
.LIST/.NOLIST, Listing Source Lines and Opcodes ........... 1-53
.LIST_DATA/.NOLIST_DATA, Listing Data Opcodes ..... 1-54
.LIST_DATFILE/.NOLIST_DATFILE, Listing Data Initialization
Files ............................................................................... 1-55
.LIST_DEFTAB, Set the Default Tab Width for Listings ... 1-56
.LIST_LOCTAB, Set the Local Tab Width for Listings ...... 1-57
.LIST_WRAPDATA/.NOLIST_WRAPDATA ................... 1-58
.NEWPAGE, Insert a Page Break in a Listing File .............. 1-59
.PAGELENGTH, Set the Page Length of a Listing File ...... 1-60