W3.5
C Compiler and Library
Manual for ADSP-218x DSPs
Analog Devices, Inc.
One Technology Way
Norwood, Mass. 02062-9106
Revision 4.1, October 2003
Part Number:
82-000400-03
Copyright Information
© 2003 Analog Devices, Inc., ALL RIGHTS RESERVED. This document 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 implication or otherwise under the patent rights of Analog Devices, Inc.
Trademark and Service Mark Notice
The Analog Devices logo, VisualDSP++, and the VisualDSP++ logo 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 ......................................................................................... xxv
Intended Audience ........................................................................ xxv
Manual Contents Description ...................................................... xxvi
What’s New in this Manual .......................................................... xxvi
Technical or Customer Support ................................................... xxvii
Supported Processors ................................................................... xxvii
Product Information .................................................................. xxviii
MyAnalog.com ..................................................................... xxviii
DSP Product Information ..................................................... xxviii
Related Documents ................................................................ xxix
Online Technical Documentation ............................................ xxx
From VisualDSP++ ............................................................. xxx
From Windows .................................................................. xxxi
From the Web .................................................................... xxxi
Printed Manuals .................................................................... xxxii
VisualDSP++ Documentation Set ...................................... xxxii
VisualDSP 3.5 C Compiler and Library Manual iii
for ADSP-218x DSPs
CONTENTS
Hardware Manuals ........................................................... xxxii
Datasheets ........................................................................ xxxii
Contacting DSP Publications ............................................... xxxiii
Notation Conventions ............................................................... xxxiii
COMPILER
C Compiler Overview ................................................................... 1-2
Standard Conformance ............................................................ 1-3
Compiler Command-Line Reference ............................................. 1-6
Running the Compiler ............................................................ 1-7
Specifying Compiler Options in VisualDSP++ ....................... 1-10
Compiler Command-Line Switches ....................................... 1-11
-@ filename ...................................................................... 1-18
-A name(tokens) ............................................................... 1-18
-alttok .............................................................................. 1-19
-bss .................................................................................. 1-19
-build-lib .......................................................................... 1-20
-C .................................................................................... 1-20
-c ..................................................................................... 1-20
-const-read-write .............................................................. 1-20
-Dmacro [=definition] ...................................................... 1-20
-debug-types <file.h> ........................................................ 1-21
-default-linkage-{asm|C} ................................................... 1-21
-dry .................................................................................. 1-22
-dryrun ............................................................................ 1-22
iv VisualDSP 3.5 C Compiler and Library Manual
for ADSP-218x DSPs
CONTENTS
-E ..................................................................................... 1-22
-ED .................................................................................. 1-22
-EE ................................................................................... 1-22
-extra-keywords ................................................................. 1-22
-flags-{asm|compiler|lib|link|mem} switch [,switch2 [,...]] .. 1-23
-fp-associative ................................................................... 1-23
-full-version ...................................................................... 1-23
-g ..................................................................................... 1-23
-H .................................................................................... 1-24
-HH ................................................................................. 1-24
-h[elp] .............................................................................. 1-24
-I- ..................................................................................... 1-25
-I directory [{,|;} directory...] ............................................. 1-25
-include filename .............................................................. 1-25
-ipa ................................................................................... 1-26
-jump-{dm|pm|same} ........................................................ 1-26
-L directory [{,|;} directory...] ............................................ 1-27
-l library ........................................................................... 1-27
-M .................................................................................... 1-27
-MD ................................................................................. 1-28
-MM ................................................................................ 1-28
-Mo filename .................................................................... 1-28
-Mt filename ..................................................................... 1-28
-MQ ................................................................................. 1-28
VisualDSP 3.5 C Compiler and Library Manual v
for ADSP-218x DSPs
CONTENTS
-make-autostatic ............................................................... 1-29
-map filename .................................................................. 1-29
-mem ............................................................................... 1-29
-no-alttok ......................................................................... 1-29
-no-bss ............................................................................. 1-30
-no-builtin ....................................................................... 1-30
-no-defs ............................................................................ 1-30
-no-extra-keywords ........................................................... 1-30
-no-fp-associative .............................................................. 1-31
-no-mem .......................................................................... 1-31
-no-std-ass ........................................................................ 1-31
-no-std-def ....................................................................... 1-31
-no-std-inc ....................................................................... 1-31
-no-std-lib ........................................................................ 1-32
-no-widen-muls ................................................................ 1-32
-O .................................................................................... 1-32
-Oa .................................................................................. 1-33
-Os .................................................................................. 1-33
-Ov num .......................................................................... 1-33
-o filename ....................................................................... 1-33
-P ..................................................................................... 1-34
-PP .................................................................................. 1-34
-path-{asm|compiler|def|lib|link|mem} filename ................. 1-34
-path-install directory ....................................................... 1-34
vi VisualDSP 3.5 C Compiler and Library Manual
for ADSP-218x DSPs
CONTENTS
-path-output directory ...................................................... 1-35
-path-temp directory ......................................................... 1-35
-pch .................................................................................. 1-35
-pch directory ................................................................... 1-35
-pedantic .......................................................................... 1-35
-pedantic-errors ................................................................ 1-36
-pplist filename ................................................................. 1-36
-proc processor .................................................................. 1-36
-R directory [{;|,}directory …] ........................................... 1-37
-R- ................................................................................... 1-38
-reserve register[,register...] ................................................ 1-38
-S ..................................................................................... 1-38
-s ...................................................................................... 1-39
-save-temps ....................................................................... 1-39
-show ................................................................................ 1-39
-si-revision version ............................................................ 1-39
-signed-bitfield .................................................................. 1-40
-signed-char ...................................................................... 1-40
-syntax-only ...................................................................... 1-40
-sysdefs ............................................................................. 1-41
-T filename ....................................................................... 1-41
-time ................................................................................ 1-41
-Umacro ........................................................................... 1-42
-unsigned-bitfield .............................................................. 1-42
VisualDSP 3.5 C Compiler and Library Manual vii
for ADSP-218x DSPs
CONTENTS
-unsigned-char .................................................................. 1-43
-v ..................................................................................... 1-43
-val-global <name-list> ..................................................... 1-43
-verbose ............................................................................ 1-43
-version ............................................................................ 1-43
-Wdriver-limit number ..................................................... 1-44
-Werror-limit number ....................................................... 1-44
-W{error|remark|suppress|warn} <num>[,num...] ............... 1-44
-Wremarks ........................................................................ 1-44
-Wterse ............................................................................ 1-45
-w .................................................................................... 1-45
-warn-protos ..................................................................... 1-45
-write-files ........................................................................ 1-45
-write-opts ........................................................................ 1-45
-xref <file> ........................................................................ 1-46
Data Type Sizes ..................................................................... 1-47
Optimization Control ........................................................... 1-49
Interprocedural Analysis ................................................... 1-50
C Compiler Language Extensions ................................................ 1-52
Inline Function Support Keyword (inline) ............................. 1-55
Inline Assembly Language Support Keyword (asm) ................ 1-56
Assembly Construct Template ........................................... 1-57
ASM() Construct Syntax: .............................................. 1-57
ASM() Construct Syntax Rules ...................................... 1-59
viii VisualDSP 3.5 C Compiler and Library Manual
for ADSP-218x DSPs
CONTENTS
ASM() Construct Template Example ............................. 1-60
Assembly Construct Operand Description ......................... 1-61
Assembly Constructs With Multiple Instructions ............... 1-67
Assembly Construct Reordering and Optimization ............. 1-67
Assembly Constructs with Input and Output Operands ..... 1-68
Assembly Constructs and Macros ...................................... 1-70
Assembly Constructs and Flow Control ............................. 1-70
Dual Memory Support Keywords (pm dm) ............................ 1-71
Memory Keywords and Assignments/Type Conversions ...... 1-73
Memory Keywords and Function Declarations/Pointers ..... 1-74
Memory Keywords and Function Arguments ..................... 1-75
Memory Keywords and Macros ......................................... 1-75
PM and DM Compiler Support for Standard C Library Functions
1-76
Placement Support Keyword (section) .................................... 1-76
Boolean Type Support Keywords (bool, true, false) ................. 1-77
Pointer Class Support Keyword (restrict) ................................ 1-77
Variable-Length Array Support .............................................. 1-78
Non-Constant Aggregate Initializer Support ........................... 1-80
Indexed Initializer Support .................................................... 1-80
Aggregate Constructor Expression Support ............................. 1-82
Preprocessor-Generated Warnings .......................................... 1-83
C++-Style Comments ............................................................ 1-83
Compiler Built-in Functions .................................................. 1-83
I/O Space for Read/Write .................................................. 1-84
VisualDSP 3.5 C Compiler and Library Manual ix
for ADSP-218x DSPs
CONTENTS
Read/Write of Non-Memory-Mapped Registers ................. 1-85
Interrupt Control ............................................................. 1-85
ETSI Support ....................................................................... 1-86
ETSI Support Overview .................................................... 1-86
Calling ETSI Library Functions ........................................ 1-88
Using the ETSI Built-In Functions .................................... 1-89
Linking ETSI Library Functions ....................................... 1-89
Working with ETSI Library Source Code .......................... 1-90
ETSI Support for Data Types ............................................ 1-90
ETSI Header File .............................................................. 1-91
Pragmas ................................................................................ 1-99
Data Alignment Pragmas ................................................ 1-101
#pragma align (num) .................................................. 1-101
#pragma pad (alignopt) ............................................... 1-102
Interrupt Handler Pragmas ............................................. 1-102
#pragma interrupt ...................................................... 1-102
#pragma altregisters .................................................... 1-103
Loop Optimization Pragmas ........................................... 1-103
#pragma loop_count(min, max, modulo) .................... 1-104
#pragma vector_for ..................................................... 1-104
#pragma no_alias ........................................................ 1-105
General Optimization Pragmas ....................................... 1-105
Linking Control Pragmas ................................................ 1-106
#pragma linkage_name identifier ................................ 1-107
x VisualDSP 3.5 C Compiler and Library Manual
for ADSP-218x DSPs
CONTENTS
#pragma retain_name ................................................. 1-107
#pragma weak_entry .................................................. 1-108
Stack Usage Pragma ........................................................ 1-108
#pragma make_auto_static .......................................... 1-108
Function Side-Effect Pragmas .......................................... 1-109
#pragma alloc .............................................................. 1-109
#pragma pure .............................................................. 1-110
#pragma const ............................................................. 1-110
#pragma regs_clobbered string ..................................... 1-111
#pragma result_alignment (n) ...................................... 1-114
Header File Control Pragmas ........................................... 1-115
#pragma hdrstop ......................................................... 1-115
#pragma no_pch ......................................................... 1-116
#pragma once ............................................................. 1-116
#pragma system_header ............................................... 1-116
GCC Compatibility Extensions ........................................... 1-117
Statement Expressions ..................................................... 1-117
Type Reference Support Keyword (typeof) ....................... 1-118
GCC Generalized Lvalues ............................................... 1-119
Conditional Expressions with Missing Operands .............. 1-120
Hexadecimal Floating-Point Numbers ............................. 1-120
Zero Length Arrays ......................................................... 1-121
Variable Argument Macros .............................................. 1-121
Line Breaks in String Literals ........................................... 1-121
VisualDSP 3.5 C Compiler and Library Manual xi
for ADSP-218x DSPs
CONTENTS
Arithmetic on Pointers to Void and Pointers to Functions 1-122
Cast to Union ................................................................. 1-122
Ranges in Case Labels ..................................................... 1-122
Declarations mixed with Code ........................................ 1-122
Escape Character Constant ............................................. 1-123
Alignment Inquiry Keyword (__alignof__) ...................... 1-123
Keyword for Specifying Names in Generated Assembler (asm) 1-123
Function, Variable and Type Attribute Keyword (__attribute__)
1-124
Preprocessor Features ................................................................ 1-125
Predefined Preprocessor Macros ........................................... 1-125
__ADSP21XX__ and __ADSP218X__ ........................... 1-126
__ADSP21{81|83|84|85|86|87|88|89}__ ......................... 1-126
__ANALOG_EXTENSIONS__ ..................................... 1-126
__DATE__ .................................................................... 1-126
__DOUBLES_ARE_FLOATS__ .................................... 1-126
__ECC__ ....................................................................... 1-126
__EDG__ ...................................................................... 1-126
__EDG_VERSION__ .................................................... 1-127
__FILE__ ....................................................................... 1-127
_LANGUAGE_C ........................................................... 1-127
__LINE__ ...................................................................... 1-127
__NO_BUILTIN ........................................................... 1-127
__NO_LONG_LONG .................................................. 1-127
__SIGNED_CHARS__ .................................................. 1-127
xii VisualDSP 3.5 C Compiler and Library Manual
for ADSP-218x DSPs
CONTENTS
__STDC__ ..................................................................... 1-128
__STDC_VERSION__ .................................................. 1-128
__TIME__ ..................................................................... 1-128
__VERSION__ .............................................................. 1-128
Header Files ........................................................................ 1-128
Writing Preprocessor Macros ................................................ 1-129
Preprocessing of .IDL Files .................................................. 1-131
C Run-Time Model and Environment ....................................... 1-132
Using the Run-Time Header ................................................ 1-133
Interrupt Table and Interface ............................................... 1-133
Autobuffering Support ......................................................... 1-134
Stack Frame ......................................................................... 1-136
Stack Frame Description ................................................. 1-137
General System-Wide Specifications ................................ 1-138
At a procedure call, the following must be true: ............ 1-139
At an interrupt, the following must be true: ................. 1-139
Return Values ................................................................. 1-139
Procedure Call and Return .............................................. 1-140
On Entry: ................................................................... 1-140
To Return from a Procedure: ....................................... 1-140
File I/O Support .................................................................. 1-141
Extending I/O Support To New Devices .......................... 1-141
Miscellaneous Information ................................................... 1-143
Register Classification .......................................................... 1-144
VisualDSP 3.5 C Compiler and Library Manual xiii
for ADSP-218x DSPs
CONTENTS
Callee Preserved Registers (“Preserved”) .......................... 1-144
Dedicated Registers ........................................................ 1-144
Caller Save Registers (“Scratch”) ..................................... 1-144
Circular Buffer Length Registers ..................................... 1-144
Mode Status (MSTAT) Register ...................................... 1-145
Complete List of Registers ................................................... 1-145
C and Assembly Language Interface .......................................... 1-148
Calling Assembly Subroutines from C Programs ................... 1-148
Calling C Routines from Assemby Programs ........................ 1-151
Using Mixed C/Assembly Support Macros ....................... 1-152
function_entry ........................................................... 1-153
exit ............................................................................. 1-153
leaf_entry ................................................................... 1-153
leaf_exit ..................................................................... 1-153
alter(x) ....................................................................... 1-153
save_reg ...................................................................... 1-154
restore_reg .................................................................. 1-154
readsfirst(register) ....................................................... 1-154
register = readsnext ..................................................... 1-154
putsfirst = register ....................................................... 1-154
putsnext = register ...................................................... 1-155
getsfirst(register) ......................................................... 1-155
register = getsnext ....................................................... 1-155
Using Mixed C/Assembly Naming Conventions ................... 1-155
xiv VisualDSP 3.5 C Compiler and Library Manual
for ADSP-218x DSPs
CONTENTS
Compatibility Call ............................................................... 1-156
ACHIEVING OPTIMAL PERFORMANCE FROM C
SOURCE CODE
General Guidelines ....................................................................... 2-3
How the Compiler Can Help ................................................... 2-4
Using the Compiler Optimizer ............................................ 2-4
Using the Statistical Profiler ............................................... 2-4
Using Interprocedural Optimization .................................... 2-5
Data Types .............................................................................. 2-7
Avoiding Emulated Arithmetic ............................................ 2-8
Getting the Most from IPA ...................................................... 2-9
Initializing Constants Statically ........................................... 2-9
Avoiding Aliases ................................................................ 2-10
Indexed Arrays vs. Pointers .................................................... 2-12
Trying Pointer and Indexed Styles ...................................... 2-13
Function Inlining .................................................................. 2-13
Using Inline asm Statements .................................................. 2-14
Memory Usage ...................................................................... 2-15
Loop Guidelines ......................................................................... 2-17
Keeping Loops Short ............................................................. 2-17
Avoiding Unrolling Loops ...................................................... 2-17
Avoiding Loop Rotation by Hand .......................................... 2-18
Avoiding Array Writes in Loops ............................................. 2-19
Inner Loops vs. Outer Loops ................................................. 2-19
VisualDSP 3.5 C Compiler and Library Manual xv
for ADSP-218x DSPs
CONTENTS
Avoiding Conditional Code in Loops ..................................... 2-20
Avoiding Placing Function Calls in Loops .............................. 2-21
Avoiding Non-Unit Strides ................................................... 2-21
Loop Control ........................................................................ 2-21
Using the Restrict Qualifier ................................................... 2-22
Using the Const Qualifier ..................................................... 2-23
Using Built-in Functions in Code Optimization .......................... 2-24
Fractional Data ..................................................................... 2-24
System Support Built-in Functions ........................................ 2-25
Smaller Applications: Optimizing for Code Size .......................... 2-27
Pragmas ...................................................................................... 2-29
Function Pragmas ................................................................. 2-29
#pragma const .................................................................. 2-29
#pragma pure ................................................................... 2-30
#pragma alloc ................................................................... 2-30
#pragma regs_clobbered .................................................... 2-31
#pragma optimize_{off|for_speed|for_space|as_cmd_line} .. 2-33
Loop Optimization Pragmas .................................................. 2-33
#pragma loop_count ......................................................... 2-33
#pragma no_alias .............................................................. 2-34
Useful Optimization Switches ..................................................... 2-35
C RUN-TIME LIBRARY
C Run-Time Library Guide .......................................................... 3-2
Calling Library Functions ........................................................ 3-2
xvi VisualDSP 3.5 C Compiler and Library Manual
for ADSP-218x DSPs
CONTENTS
Using the Compiler’s Built-In Functions .................................. 3-2
Linking Library Functions ....................................................... 3-3
Working With Library Source Code ......................................... 3-4
Working with Library Header Files .......................................... 3-5
assert.h ............................................................................... 3-6
ctype.h ............................................................................... 3-6
def2181.h – Memory Map Definitions ................................ 3-7
def2181x.h – Memory Map Definitions ............................... 3-7
errno.h ............................................................................... 3-7
ffts.h – Fast Fourier Transforms ........................................... 3-7
filters.h – DSP Filters .......................................................... 3-8
float.h – Floating Point ....................................................... 3-8
fract.h – ADSP-218x DSP Macro Fract Definitions ............. 3-8
iso646.h ............................................................................. 3-8
locale.h ............................................................................... 3-9
math.h ................................................................................ 3-9
misc.h – ADSP-218x DSP Timer Functions ....................... 3-10
setjmp.h ............................................................................ 3-10
signal.h ............................................................................. 3-10
sport.h – ADSP-218x DSP Serial Ports .............................. 3-11
stdarg.h ............................................................................ 3-11
stdio.h .............................................................................. 3-11
stdlib.h ............................................................................. 3-12
string.h ............................................................................. 3-12
VisualDSP 3.5 C Compiler and Library Manual xvii
for ADSP-218x DSPs
CONTENTS
sysreg.h ............................................................................ 3-13
Documented Library Functions .................................................. 3-14
C Run-Time Library Reference ................................................... 3-18
Notation Conventions ........................................................... 3-18
Reference Format .................................................................. 3-18
abort .......................................................................................... 3-19
abs ............................................................................................. 3-20
acos ............................................................................................ 3-21
asin ............................................................................................ 3-22
atan ............................................................................................ 3-23
atan2 .......................................................................................... 3-24
atexit .......................................................................................... 3-25
atof ............................................................................................ 3-26
atoi ............................................................................................ 3-29
atol ............................................................................................ 3-30
biquad ........................................................................................ 3-31
bsearch ....................................................................................... 3-34
calloc ......................................................................................... 3-36
ceil ............................................................................................. 3-37
clear_interrupt ............................................................................ 3-38
copysign ..................................................................................... 3-40
cos ............................................................................................. 3-41
cosh ........................................................................................... 3-44
cot ............................................................................................. 3-45
xviii VisualDSP 3.5 C Compiler and Library Manual
for ADSP-218x DSPs
CONTENTS
demean_buffer ........................................................................... 3-46
disable_interrupts ....................................................................... 3-48
div ............................................................................................. 3-49
enable_interrupts ........................................................................ 3-50
exit ............................................................................................. 3-51
exp ............................................................................................. 3-52
fabs ............................................................................................ 3-53
fftN ........................................................................................... 3-54
fir .............................................................................................. 3-57
floor ........................................................................................... 3-59
fmod .......................................................................................... 3-60
free ............................................................................................ 3-61
frexp .......................................................................................... 3-62
ifftN .......................................................................................... 3-63
iir ............................................................................................... 3-66
interrupt .................................................................................... 3-71
io_space_read ............................................................................. 3-75
io_space_write ............................................................................ 3-77
isalnum ...................................................................................... 3-79
isalpha ........................................................................................ 3-80
iscntrl ......................................................................................... 3-81
isdigit ......................................................................................... 3-82
isgraph ....................................................................................... 3-83
isinf ........................................................................................... 3-84
xix VisualDSP 3.5 C Compiler and Library Manual
for ADSP-218x DSPs
CONTENTS
islower ........................................................................................ 3-86
isnan .......................................................................................... 3-87
isprint ........................................................................................ 3-89
ispunct ....................................................................................... 3-90
isspace ........................................................................................ 3-91
isupper ....................................................................................... 3-92
isxdigit ....................................................................................... 3-93
labs ............................................................................................ 3-94
ldexp .......................................................................................... 3-95
ldiv ............................................................................................ 3-96
log ............................................................................................. 3-97
log10 .......................................................................................... 3-98
longjmp ..................................................................................... 3-99
malloc ...................................................................................... 3-101
memchr .................................................................................... 3-102
memcmp .................................................................................. 3-103
memcpy ................................................................................... 3-104
memmove ................................................................................ 3-105
memset .................................................................................... 3-106
modf ........................................................................................ 3-107
pow .......................................................................................... 3-108
qsort ........................................................................................ 3-109
raise ......................................................................................... 3-111
rand ......................................................................................... 3-113
xx VisualDSP 3.5 C Compiler and Library Manual
for ADSP-218x DSPs
realloc ....................................................................................... 3-114
setjmp ...................................................................................... 3-115
signal ........................................................................................ 3-116
sin ............................................................................................ 3-120
sinh .......................................................................................... 3-122
sqrt ........................................................................................... 3-123
srand ........................................................................................ 3-124
strcat ........................................................................................ 3-125
strchr ........................................................................................ 3-126
strcmp ...................................................................................... 3-127
strcoll ....................................................................................... 3-128
strcpy ....................................................................................... 3-129
strcspn ...................................................................................... 3-130
strerror ..................................................................................... 3-131
strlen ........................................................................................ 3-132
strncat ...................................................................................... 3-133
strncmp .................................................................................... 3-134
strncpy ..................................................................................... 3-135
strpbrk ...................................................................................... 3-136
strrchr ....................................................................................... 3-137
strspn ....................................................................................... 3-138
strstr ......................................................................................... 3-139
strtod ........................................................................................ 3-140
strtodf ...................................................................................... 3-143
VisualDSP++ 3.5 C Compiler and Library Manual for ADSP-218x DSPs xxi
strtok ....................................................................................... 3-146
strtol ........................................................................................ 3-148
strtoul ...................................................................................... 3-150
strxfrm ..................................................................................... 3-152
sysreg_read ............................................................................... 3-154
sysreg_write .............................................................................. 3-156
tan ........................................................................................... 3-158
tanh ......................................................................................... 3-159
timer_off .................................................................................. 3-160
timer_on .................................................................................. 3-161
timer_set .................................................................................. 3-162
tolower ..................................................................................... 3-163
toupper .................................................................................... 3-164
va_arg ...................................................................................... 3-165
va_end ..................................................................................... 3-168
va_start .................................................................................... 3-169
COMPILER LEGACY SUPPORT
Tools Differences .......................................................................... A-1
C Compiler and C Run-Time Library ...................................... A-3
Segment Placement Support Keyword Changed to Section ... A-3
G21 Compatibility Call ...................................................... A-3
Support for G21-Based Options and Extensions .................. A-3
Indexed Initializers ............................................................. A-4
Compiler Diagnostics ......................................................... A-4
xxii VisualDSP++ 3.5 C Compiler and Library Manual for ADSP-218x DSPs
INDEX
ANSI C Extensions ............................................................ A-4
Compiler Switch Modifications .......................................... A-5
Warnings ........................................................................... A-7
Run-Time Model ............................................................... A-8
VisualDSP++ 3.5 C Compiler and Library Manual for ADSP-218x DSPs xxiii
xxiv VisualDSP++ 3.5 C Compiler and Library Manual for ADSP-218x DSPs
PREFACE
Thank you for purchasing Analog Devices development software for digital signal processors (DSPs).
Purpose
The VisualDSP++ 3.5 C Compiler and Library Manual for ADSP-218x
DSPs contains information about the C compiler and run-time library for
ADSP-218x DSPs. It includes syntax for command lines, switches, and
language extensions. It leads you through the process of using library routines and writing mixed C/assembly code.
Intended Audience
The primary audience for this manual is programmers who are familiar
with Analog Devices DSPs. This manual assumes that the audience has a
working knowledge of the ADSP-218x DSP architecture and instruction
set and the C programming language.
Programmers who are unfamiliar with ADSP-218x DSPs can use this
manual, but they should supplement it with other texts (such as the
appropriate hardware reference and instruction set reference) that provide
information about your ADSP-218x DSP architecture and instructions).
VisualDSP 3.5 C Compiler and Library Manual xxv
for ADSP-218x DSPs
Manual Contents Description
Manual Contents Description
This manual contains:
• Chapter 1, “Compiler”
Provides information on compiler options, language extensions and
C/assembly interfacing
• Chapter 2, “Achieving Optimal Performance from C Source Code”
Shows how to optimize compiler operation.
• Chapter 3, “C Run-Time Library”
Shows how to use library functions and provides a complete C
library function reference
•A p p e n d i x A , “Compiler Legacy Support”
Describes support for legacy code that was developed with previous
releases of the development tools.
What’s New in this Manual
This edition of the VisualDSP++ 3.5 C Compiler and Library Manual for
ADSP-218x DSPs documents support for all ADSP-218x processors.
Refer to VisualDSP++ 3.5 Product Bulletin for 16-Bit Processors for information on all new and updated features and other release information.
xxvi VisualDSP 3.5 C Compiler and Library Manual
for ADSP-218x DSPs
Technical or Customer Support
You can reach DSP Tools Support in the following ways:
• Visit the DSP Development Tools website at
www.analog.com/technology/dsp/developmentTools/index.html
• Email questions to
dsptools.support@analog.com
• Phone questions to 1-800-ANALOGD
• Contact your ADI 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
Preface
Supported Processors
The name “ADSP-218x” refers to a family of Analog Devices 16-bit,
fixed-point processors. VisualDSP++ currently supports the following
ADSP-218x processors:
ADSP-2181, ADSP-2183, ADSP-2184, ADSP-2185, ADSP-2186,
ADSP-2187, ADSP-2188, and ADSP-2189M
VisualDSP 3.5 C Compiler and Library Manual xxvii
for ADSP-218x DSPs
Product Information
Product Information
You can obtain product information from the Analog Devices website,
from the product CD-ROM, or from the printed publications (manuals).
Analog Devices is online at www.analog.com . Our website provides information 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 website that allows
customization of a webpage to display only the latest information on
products you are interested in. You can also choose to receive weekly email
notification containing updates to the webpages that meet your interests.
MyAnalog.com provides access to books, application notes, data sheets,
code examples, and more.
Registration:
Visit www.myanalog.com to sign up. Click Register to use MyAnalog.com .
Registration takes about five minutes and allows you to select the information you want to receive.
If you are already a registered user, just log on. Your user name is your
email address.
DSP Product Information
For information on digital signal processors, visit our website at
www.analog.com, which provides access to technical publications,
datasheets, application notes, product overviews, and product
announcements.
xxviii VisualDSP 3.5 C Compiler and Library Manual
for ADSP-218x DSPs
Preface
You may also obtain additional information about Analog Devices and its
products in any of the following ways.
• Email questions or requests for information to
dsp.support@analog.com
• Fax questions or requests for information to
1-781-461-3010 (North America)
089/76 903-557 (Europe)
• Access the Digital Signal Processing Division’s FTP website at
ftp ftp.analog.com or ftp 137.71.23.21
ftp://ftp.analog.com
Related Documents
For information on product related development software, see the following publications:
VisualDSP++ 3.5 Getting Started Guide for 16-Bit Processors
VisualDSP++ 3.5 User’s Guide for 16-Bit Processors
VisualDSP++ 3.5 Assembler and Preprocessor Manual for ADSP-218x and ADSP-219x DSPs
VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors
VisualDSP++ 3.5 Loader Manual for 16-Bit Processors
VisualDSP++ 3.5 Product Bulletin 16-Bit Processors
VisualDSP++ Kernel (VDK) User’s Guide
VisualDSP++ Component Software Engineering User’s Guide
Quick Installation Reference Card
For hardware information, refer to the processor’s Hardware Reference
Manual and Instruction Set Reference Manual .
VisualDSP 3.5 C Compiler and Library Manual xxix
for ADSP-218x DSPs
Product Information
Online Technical Documentation
Online documentation comprises VisualDSP++ Help system and tools
manuals, and FlexLM network license manager software documentation.
You can easily search across the entire VisualDSP++ documentation set for
any topic of interest. For easy printing, supplementary PDF files for the
tools manuals are also provided.
If documentation is not installed on your system as part of the software
installation, you can add it from the VisualDSP++ CD-ROM at any time.
Access the online documentation from the VisualDSP++ environment,
Windows Explorer, or Analog Devices website.
A description of each documentation file type is as follows.
File Description
.CHM Help system files and VisualDSP++ tools manuals.
.HTM or .HTML FlexLM network license manager software documentation. Viewing and
printing the .
higher).
PDF VisualDSP++ tools manuals in Portable Documentation Format, one .PDF
.
file for each manual. Viewing and printing the .
reader, such as Adobe Acrobat Reader 4.0 (or higher).
HTML files require a browser, such as Internet Explorer 4.0 (or
PDF files require a PDF
From VisualDSP++
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).
xxx VisualDSP 3.5 C Compiler and Library Manual
for ADSP-218x DSPs