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, 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.
Page 3
CONTENTS
PREFACE
Purpose of This Manual ............................................................... xxxi
xlVisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 41
PREFACE
Thank you for purchasing Analog Devices, Inc. development software for
signal processing applications.
Purpose of This Manual
The VisualDSP++ 4.0 C/C++ Compiler and Library Manual for
SHARC Processors contains information about the C/C++ compiler and
run-time library for SHARC® (ADSP-21xxx) processors. It includes syntax for command lines, switches, and language extensions. It leads you
through the process of using library routines and writing mixed
C/C++/assembly code.
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 SHARC architecture and instruction set
and the C/C++ programming languages.
Programmers who are unfamiliar with SHARC processors can use this
manual, but they should supplement it with other texts (such as the
appropriate hardware reference and programming reference manuals) that
describe your target architecture.
VisualDSP++ 4.0 C/C++ Compiler and Library Manual xxxi
for SHARC Processors
Page 42
Manual Contents
Manual Contents
This manual contains:
•Chapter 1, “Compiler”
Provides information on compiler options, language extensions and
C/C++/assembly interfacing
•Chapter 2, “Achieving Optimal Performance from C/C++ Source
Code”
Shows how to optimize compiler operation
•Chapter 3, “C/C++ Run-Time Library”
Shows how to use library functions and provides a complete C/C++
library function reference (for functions covered in the current
compiler release)
•Chapter 4, “DSP Library for ADSP-2106x and ADSP-21020 Pro-
cessors”
Shows how to use DSP library functions and provides a complete
library function reference used with ADSP-2106x and
ADSP-21020 processors (for functions covered in the current compiler release)
•Chapter 5, “DSP Library for ADSP-2116x/2126x/2136x Proces-
sors”
Shows how to use DSP library functions and provides a complete
library function reference used with ADSP-2116x/2126x/2136x
processors (for functions covered in the current compiler release)
xxxiiVisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 43
Preface
What’s New in This Manual
This edition of the VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors documents support for all current SHARC proces-
sors listed in “Supported Processors”.
Refer to the VisualDSP++ 4.0 Product Release Bulletin for a complete list
of new compiler features and enhancements.
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
http://www.analog.com/processors/technicalSupport
•E-mail tools questions to
dsptools.support@analog.com
•E-mail processor questions to
dsp.support@analog.com
•Phone questions to 1-800-ANALOGD
•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.0 C/C++ Compiler and Library Manual xxxiii
for SHARC Processors
Page 44
Supported Processors
Supported Processors
The name “SHARC” refers to a family of Analog Devices, Inc.
high-performance 32-bit floating-point digital signal processors that can
be used in speech, sound, graphics, and imaging applications.
VisualDSP++® currently supports the following SHARC processors:
ADSP-21020ADSP-21060ADSP-21061ADSP-21062
ADSP-21065LADSP-21160ADSP-21161ADSP-21261
ADSP-21262ADSP-21266ADSP-21267ADSP-21363
ADSP-21364ADSP-21365ADSP-21366ADSP-21367
ADSP-21368ADSP-21369
Product Information
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 www.analog.com. Our Web site 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 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.
xxxivVisualDSP++ 4.0 C/C++ Compiler and Library Manual
MyAnalog.com provides access to books, application notes, data
for SHARC Processors
Page 45
Preface
Registration
Visit
www.myanalog.com to sign up. Click Register to use MyAnalog.com.
Registration takes about five minutes and serves as 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.
•E-mail 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 FTP Web site at
ftp ftp.analog.com or ftp 137.71.23.21
ftp://ftp.analog.com
VisualDSP++ 4.0 C/C++ Compiler and Library Manual xxxv
for SHARC Processors
Page 46
Product Information
Related Documents
For information on product related development software, see these
publications:
•VisualDSP++ 4.0 Getting Started Guide
•VisualDSP++ 4.0 User’s Guide
•VisualDSP++ 4.0 C/C++ Assembler and Preprocessor Manual
•VisualDSP++ 4.0 Linker and Utilities Manual
•VisualDSP++ 4.0 Loader Manual
•VisualDSP++ 4.0 Product Release Bulletin
•VisualDSP++ Kernel (VDK) User’s Guide
•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:
xxxviVisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 47
Preface
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 .HTML files requires a browser, such as
Internet Explorer 4.0 (or higher).
Viewing and printing the .PDF files requires a PDF reader, such as Adobe Acrobat
Reader (4.0 or higher).
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).
VisualDSP++ 4.0 C/C++ Compiler and Library Manual xxxvii
for SHARC Processors
Page 48
Product Information
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.
xxxviiiVisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 49
Preface
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.
VisualDSP++ 4.0 C/C++ Compiler and Library Manual xxxix
for SHARC Processors
Page 50
Notation Conventions
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 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
xlVisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 51
ExampleDescription
Note: For correct operation, ...
L
a
[
A Note provides supplementary information on a related topic. In the
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.
Warn in g: 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 rnin g appears
instead of this symbol.
Preface
VisualDSP++ 4.0 C/C++ Compiler and Library Manual xli
for SHARC Processors
Page 52
Notation Conventions
xliiVisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 53
1COMPILER
The C/C++ compiler (cc21k) is part of Analog Devices development software for SHARC (ADSP-21xxx) processors.
L
This chapter contains:
The code examples in this manual have been compiled using
VisualDSP++ 4.0. 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++.
•“C/C++ Compiler Overview” on page 1-2
provides an overview of C/C++ compiler for SHARC processors.
•“Compiler Command-Line Interface” on page 1-4
describes the operation of the compiler as it processes programs,
including input and output files, and command-line switches.
•“C/C++ Compiler Language Extensions” on page 1-70
describes the
dard for the C and C++ languages.
•“Preprocessor Features” on page 1-165
contains information on the preprocessor and ways to modify
source compilation.
•“C/C++ Run-Time Model and Environment” on page 1-175
contains reference information about implementation of C/C++
programs, data, and function calls in ADSP-21xxx processors.
cc21k compiler’s extensions to the ISO/ANSI stan-
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-1
for SHARC Processors
Page 54
C/C++ Compiler Overview
•“C/C++ and Assembly Interface” on page 1-209
describes how to call an assembly language subroutine from a C or
C++ program, and how to call a C or C++ function from within an
assembly language program.
•“Compiler C++ Template Support” on page 1-238
describes how templates are instantiated at compile time
C/C++ Compiler Overview
The C/C++ compiler (cc21k) is designed to aid your project development
efforts by:
•Processing C and C++ source files, producing machine-level versions of the source code and object files
•Providing relocatable code and debugging information within the
object files
•Providing relocatable data and program memory segments for
placement by the linker in the processors’ memory
Using C/C++, developers can significantly decrease time-to-market since
it gives them the ability to efficiently work with complex signal processing
data types. It also allows them to take advantage of specialized processor
operations without having to understand the underlying processor
architecture.
The C/C++ compiler (cc21k) compiles ISO/ANSI standard C and C++
code for the SHARC processors. Additionally, Analog Devices includes
within the compiler a number of C language extensions designed to assist
in processor development. The compiler runs from the VisualDSP++ environment or from an operating system command line.
1-2VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 55
Compiler
The C/C++ compiler (
cc21k) processes your C and C++ language source
files and produces SHARC assembler source files. The assembler source
files are assembled by the SHARC assembler (easm21k). The assembler
creates Executable and Linkable Format (ELF) object files that can either
be linked (using the linker) to create an ADSP-21xxx executable file or
included in an archive library (elfar). The way in which the compiler
controls the assemble, link, and archive phases of the process depends on
the source input files and the compiler options used.
Your source files contain the C/C++ program to be processed by the compiler. The cc21k compiler supports the ANSI/ISO standard definitions of
the C and C++ languages. For information on the C language standard,
see any of the many reference texts on the C language. Analog Devices recommends the Bjarne Stroustrup text “The C++ Programming Language”
from Addison Wesley Longman Publishing Co (ISBN: 0201889544)
(1997) as a reference text for the C++ programming language.
The cc21k compiler supports a set of C/C++ language extensions. These
extensions support hardware features of the ADSP-21xxx processors. For
information on these extensions, see “C/C++ Compiler Language Exten-
sions” on page 1-70.
You can set the compiler options from the Compile page of the Project Options dialog box of the VisualDSP++ Integrated Development and
Debug Environment (IDDE) (see “Specifying Compiler Options in Visu-
alDSP++” on page 1-9). These selections control how the compiler
processes your source files, letting you select features that include the language dialect, error reporting, and debugger output.
For more information on the VisualDSP++ environment, see the
VisualDSP++ 4.0 User’s Guide and online Help.
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-3
for SHARC Processors
Page 56
Compiler Command-Line Interface
Compiler Command-Line Interface
This section describes how the ADSP-21xxx compiler is invoked from the
command line, the various types of files used by and generated from the
compiler, and the switches used to tailor the compiler’s operation.
This section contains:
•“Running the Compiler” on page 1-5
•“Specifying Compiler Options in VisualDSP++” on page 1-9
•“Compiler Command-Line Switches” on page 1-11
•“Data Type and Data Type Sizes” on page 1-61
•“Environment Variables Used by the Compiler” on page 1-63
•“Optimization Control” on page 1-64
By default, the compiler runs with Analog Extensions for C code enabled.
This means that the compiler processes source files written in ANSI/ISO
standard C language supplemented with Analog Devices extensions.
Table 1-1 on page 1-7 lists valid extensions of source files the compiler
operates upon. By default, the compiler processes the input file through
the listed stages to produce a .DXE file (see file names in Table 1-2 on
page 1-8). Table 1-3 on page 1-11 lists the switches that select the lan-
guage dialect.
Although many switches are generic between C and C++, some of them
are valid in C++ mode only. A summary of the generic C/C++ compiler
switches appears in Table 1-4 on page 1-12. A summary of the C++-specific compiler switches appears in Table 1-5 on page 1-21. The summaries
are followed by descriptions of each switch.
1-4VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 57
Compiler
L
compiler’s default options settings. The way the compiler’s options
are set depends on the environment used to run the processor
development software. See “Specifying Compiler Options in Visu-
alDSP++” on page 1-9 for more information.
Running the Compiler
Use the following syntax for the cc21k command line:
When developing a project, sometimes it is useful to modify the
cc21k
-switch
sourceFile
Name of the compiler program for SHARC processors.
Switch (or switches) to process.
The compiler has many switches. These switches select the operations and modes for the compiler and other tools. Command-line
switches are case sensitive. For example,
Name of the file to be preprocessed, compiled, assembled, and/or
l
inked
-O is not the same as -o.
The name of the source file to be processed:
can include the drive, directory, file name and file extension. The
compiler supports both Win32 and POSIX-style paths by using
forward or back slashes as the directory delimiter. It also supports
UNC path names (starting with two slashes and a network name).
If its length exceeds eight characters or contains spaces, enclose it
in straight quotes; for example, “long file name.c”. The cc21k
compiler uses the file extension to determine what the file contains
(Table 1-2 on page 1-8) and what operations to perform upon it
(Table 1-1 on page 1-7).
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-5
for SHARC Processors
-proc ADSP-21161 Specifies compiler instructions unique to the
ADSP-21161 processor
-O Specifies optimization for the compiler
-Wremarks Selects extra diagnostic remarks in addition to
warning and error messages
-o program.dxe Selects a name for the compiled, linked output
source.c Specifies the C language source file to be compiled
The following example command line for the C++ mode
cc21k -c++ source.cpp
runs cc21k with:
-c++ Specifies all of the source files to be compiled in
C++ mode
source.cpp Specifies the C++ language source file to be
compiled
The normal function of
cc21k is to invoke the compiler, assembler, and
linker as required to produce an executable object file. The precise operation is determined by the extensions of the input filenames and by various
switches.
In normal operation, the compiler uses the files listed in Table 1-1 to perform the specified action. If multiple files are specified, each is first
processed to produce an object file; then all object files are presented to
the linker.
1-6VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 59
Compiler
Table 1-1. File Extensions
ExtensionAction
.c .cpp .cxx .cc .c++Source file is compiled, assembled, and linked
.asm, .dsp, or .sAssembly language source file is assembled and linked
.dojObject file (from previous assembly) is linked
You can stop this sequence at various points by using appropriate compiler switches, or by selecting options with the VisualDSP++ environment.
These switches are
-E, -P,-M,-H,-S, and -c.
Many of the compiler’s switches take a file name as an optional parameter.
If you do not use the optional output name switch, cc21k names the output for you. Table 1-2 on page 1-8 lists the type of files, names, and
extensions cc21k appends to output files.
File extensions vary by command-line switch and file type. These extensions are influenced by the program that is processing the file, any search
directories that you select, and any path information that you include in
the file name. Table 1-2 indicates the searches that the preprocessor, compiler, assembler, and linker support. The compiler supports relative and
absolute directory names to define file search paths. For information on
additional search directories, see the -I directory switch (on page 1-32)
and -L directory switch (on page 1-34).
When providing an input or output file name as an optional parameter,
use the following guidelines:
•Use a file name (include the file extension) with either an unambiguous relative path or an absolute path. A file name with an absolute
path includes the drive, directory, file name, and file extension.
•Enclose long file names within straight quotes; for example,
file name.c’. The cc21k compiler uses the file extension conven-
‘long
tions listed in Table 1-2 to determine the input file type.
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-7
for SHARC Processors
Page 60
Compiler Command-Line Interface
•Verify that the compiler is using the correct file. If you do not provide the complete file path as part of the parameter or add
additional search directories,
cc21k looks for input in the current
directory.
L
assembler, and linker causes each of these tools to echo the name of
each file as it is processed.
Table 1-2. Input and Output Files
Input File ExtensionFile Extension Description
.cC source file.
.cc, .cpp, .cxxC++ source file
.hHeader file (referenced by a #include directive)
.hpp .hh .hxx .h++C++ header file (referenced by a #include statement)
.pchC++ pre-compiled header file
.ii, .tiTemplate instantiation files – used internally by the compiler when
instantiating templates
.ipa, .opaInterprocedural analysis files – used internally by the compiler when
performing interprocedural analysis
.iPreprocessed C source, created when preprocess only is specified
.s, .asmAssembler source file
.isPreprocessed assembly source (retained when -save-temps is speci-
fied)
Using the verbose output switches for the preprocessor, compiler,
.ldfLinker Description File
.dojObject file to be linked
.dlbLibrary of object files to be linked as needed
.dxeExecutable file produced by compiler
.xmlProcessor memory map file output
.symProcessor symbol map file output
1-8VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 61
Compiler
The compiler refers to a number of environment variables during its operation, and these environment variables can affect the compiler’s behavior.
Refer to “Environment Variables Used by the Compiler” on page 1-63 for
more information.
Specifying Compiler Options in VisualDSP++
When using the VisualDSP++ Integrated Development and Debug Environment (IDDE), use the Compile option from the Project Options
dialog box to set compiler functional options as shown on Figure 1-1.
Figure 1-1. Project Options — Compile Tab
There are four sub-pages you can access—General, Preprocessor, Proces-sor, and Warning. Most page options have a corresponding compiler
command-line switch described in “Compiler Command-Line Switches”
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-9
for SHARC Processors
Page 62
Compiler Command-Line Interface
on page 1-11. The Additional options field is used to enter the appropri-
ate file names and options that do not have corresponding controls on the
Compile tab but are available as compiler switches.
For example, the Processor page (Figure 1-2) provides selection of data
word sizes, processor speed, and other options.
For more information, use the VisualDSP++ context-sensitive online Help
for each target architecture to select information on compiler options you
can specify in VisualDSP++. To do that, click on the ? button and then
click in a field or box you need information about.
1-10VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 63
Compiler
Compiler Command-Line Switches
This section describes the command-line switches used when compiling.
It contains a set of tables that provide a brief description of each switch.
These tables are organized by type of switch. Following these tables are
sections that provide fuller descriptions of each switch.
C/C++ Compiler Switch Summaries
This section contains a set of tables that summarize generic and specific
switches (options).
•“C or C++ Mode Selection Switches”, Table 1-3
•“C/C++ Compiler Common Switches”, Table 1-4
•“C++ Mode Compiler Switches”, Table 1-5 on page 1-21
A brief description of each switch follows the tables, beginning
on page 1-22.
Table 1-3. C or C++ Mode Selection Switches
Switch NameDescription
-c89
(on page 1-22)
-c++
(on page 1-22)
Supports programs that conform to the ISO/IEC
9899:1990 standard
Supports ANSI/ISO standard C++ with Analog Devices
extensions. Note that C++ is not supported on the
ADSP-21020 processor.
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-11
for SHARC Processors
Page 64
Compiler Command-Line Interface
Table 1-4. C/C++ Compiler Common Switches
Switch NameDescription
sourcefile
(on page 1-23)
-@ filename
(on page 1-23)
-A name[tokens]
(on page 1-23)
-aligned-stack
(on page 1-24)
-alttok
(on page 1-24)
-annotate-loop-instr
(on page 1-25)
-bss
(on page 1-25)
-build-lib
(on page 1-25)
-C
(on page 1-25)
-c
(on page 1-26)
-compatible-pm-dm
(on page 1-26)
Specifies file to be compiled
Reads command-line input from the file
Asserts the specified name as a predicate
Aligns the program stack on a double-word boundary
Allows alternative keywords and sequences in sources
Provides additional annotation information for the prolog,
kernel and epilog of a loop
Places zero-initialized global data into a BSS section
Directs the librarian to build a library file
Retains preprocessor comments in the output file; must
run with the -E or -P switch
Compiles and/or assembles only, but does not link
Specifies that the compiler shall treat dm- and pm-qualified
pointers as assignment-compatible
-const-read-write
(on page 1-26)
-Dmacro[=definition]
Specifies that data accessed via a pointer to
may be modified elsewhere
Defines a macro.
const data
(on page 1-26)
-debug-types
(on page 1-26)
-default-linkage-{asm|C|C++}
Supports building an
*.h file directly and writing a com-
plete set of debugging information for the header file
Sets the default linkage type (
C, C++, asm)
(on page 1-27)
1-12VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 65
Table 1-4. C/C++ Compiler Common Switches (Cont’d)
Switch NameDescription
Compiler
-double-size [-32|-64]
(on page 1-27)
-double-size-any
(on page 1-28)
-dry
(on page 1-28)
-dryrun
(on page 1-28)
-E
(on page 1-29)
-ED
(on page 1-29)
-EE
(on page 1-29)
-extra-keywords
(on page 1-29)
-flags-{tools} <arg1>
[,arg2...]
(on page 1-29)
-float-to-int
(on page 1-30)
Selects 32- or 64-bit IEEE format for double.
The -double-size-32 is the default mode.
Indicates that the resulting object can be linked with
objects built with any double size
Displays, but does not perform, main driver actions
(verbose dry-run)
Displays, but does not perform, top-level driver actions
(terse dry-run)
Preprocesses, but does not compile, the source file
Preprocesses and sends all output to a file
Preprocesses and compiles the source file
Recognizes ADI extensions to ANSI/ISO standards for C
and C++ (default mode)
Passes command-line switches through the compiler to
other build tools
Uses a support library function to convert a float to an
integer
-force-circbuf
(on page 1-26)
-fp-associative
(on page 1-30)
-full-version
(on page 1-30)
-g
Treats array references of the form
array[i%n] as circular
buffer operations
Treats floating-point multiply and addition as an associative
Displays the version number of the driver and any processes invoked by the driver
Generates DWARF-2 debug information
(on page 1-31)
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-13
for SHARC Processors
Page 66
Compiler Command-Line Interface
Table 1-4. C/C++ Compiler Common Switches (Cont’d)
Switch NameDescription
-H
(on page 1-31)
-HH
(on page 1-31)
-h[elp]
(on page 1-32)
-I directory
(on page 1-32)
-I-
(on page 1-32)
-i
(on page 1-32)
-include filename
(on page 1-33)
-ipa
(on page 1-33)
-L directory
(on page 1-34)
-l library
(on page 1-34)
Outputs a list of included header files, but does not compile
Outputs a list of included header files and compiles
Outputs a list of command-line switches
Appends directory to the standard search path
Establishes the point in the include directory list at
which the search for header files enclosed in angle brackets
should begin
Outputs only header details or makefile dependencies for
include files specified in double quotes
Includes named file prior to preprocessing each source file
Enables interprocedural analysis
Appends directory to the standard library search path
Searches library for functions when linking
-M
Generates make rules only, but does not compile
(on page 1-35)
-MD
Generates make rules, compiles, and prints to a file
(on page 1-35)
-MM
Generates make rules and compiles
(on page 1-35)
-Mo filename
(on page 1-35)
Writes dependency information to
is used in conjunction with the
-ED or -MD options
filename. This switch
1-14VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 67
Table 1-4. C/C++ Compiler Common Switches (Cont’d)
Switch NameDescription
Compiler
-Mt filename
(on page 1-35)
-MQ
(on page 1-36)
-map filename
(on page 1-36)
-mem
(on page 1-36)
-multiline
on page 1-36
-no-aligned-stack
(on page 1-36)
-no-alttok
(on page 1-36)
-no-annotate
(on page 1-37)
-no-annotate-loop-instr
(on page 1-37)
-no-bss
(on page 1-37)
Makes dependencies, where the target is renamed as
filename
Generates make rules only; does not compile. No notification when input files are missing
Directs the linker to generate a memory map of all symbols
Enables memory initialization
Enables string literals over multiple lines (default)
Does not double-word align the program stack
Does not allow alternative keywords and sequences in
sources
Disables the annotation of assembly files
Disables the production of additional loop annotation
information by the compiler (default mode)
Causes the compiler to group global zero-initialized data
into the same section as global data with non-zero initializers. Set by default
-no-builtin
(on page 1-37)
-no-circbuf
(on page 1-38)
-no-db
(on page 1-38)
-no-defs
(on page 1-38)
Recognizes only built-in functions that begin with two
underscores(
__)
Disables the automatic generation of circular buffer code
by the compiler
Specifies that the compiler shall not generate code containing delayed branches jumps
Disables preprocessor definitions: macros, include directories, library directories, run-time headers, or keyword
extensions
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-15
for SHARC Processors
Page 68
Compiler Command-Line Interface
Table 1-4. C/C++ Compiler Common Switches (Cont’d)
Switch NameDescription
-no-extra-keywords
(on page 1-38)
-no-fp-associative
(on page 1-38)
-no-mem
(on page 1-39)
-no-multiline
(on page 1-39)
-no-saturation
(on page 1-39)
-no-simd
(on page 1-39)
-no-std-ass
(on page 1-39)
-no-std-def
(on page 1-40)
-no-std-inc
(on page 1-40)
-no-std-lib
(on page 1-40)
Does not accept ADI keyword extensions that might affect
ISO/ANSI standards for C and C++
Does not treat floating-point multiply and addition as an
associative
Disables memory initialization
Disables multiple line string literal support
Causes the compiler not to introduce saturation semantics
when optimizing expressions
Disables automatic SIMD mode when compiling for
ADSP-2116x, ADSP-2126x or ADSP-2136x processors
Disables any predefined assertions and system-specific
macro definitions
Disables preprocessor definitions and ADI keyword extensions that do not have leading underscores(__)
Searches for preprocessor include header files only in the
current directory and in directories specified with the -I
switch
Searches for only those library files specified with the
-l
switch
-no-threads
Specifies that all compiled code need not be thread-safe
(on page 1-40)
-O [0|1]
Enables code optimizations
(on page 1-40)
-Oa
Enables automatic function inlining
(on page 1-41)
-Og
(on page 1-41)
Enables a compiler mode that performs optimizations
while still preserving the debugging information
1-16VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 69
Table 1-4. C/C++ Compiler Common Switches (Cont’d)
Switch NameDescription
Compiler
-Os
(on page 1-41)
-Ov num
(on page 1-41)
-o filename
(on page 1-42)
-P
(on page 1-42)
-PP
(on page 1-42)
-path-{asm|compiler|lib|
link|mem} directory
(on page 1-42)
-path-install directory
(on page 1-42)
-path-output directory
(on page 1-43)
-path-temp directory
(on page 1-43)
-pch
(on page 1-43)
Optimizes for code size
Controls speed versus size optimizations
Specifies the output file name
Preprocesses, but does not compile, the source file; omits
line numbers in the preprocessor output
Similar to -P, but does not halt compilation after preprocessing
Uses the specified directory as the location of the specified
compilation tool (assembler, compiler, librarian, linker, or
and memory initializer, respectively)
Uses the specified directory as the location of all compilation tools
Specifies the location of non-temporary files
Specifies the location of temporary files
Generates and uses precompiled header files (*.pch)
-pchdir directory
(
on page 1-43)
-pedantic
(on page 1-43)
-pedantic-errors
(on page 1-44)
-pguide
(on page 1-44)
Specifies the location of PCHRepository
Issues compiler warnings for any constructs that are not
ISO/ANSI standard C/C++-compliant
Issues compiler errors for any constructs that are not
ISO/ANSI standard C/C++-compliant.
Adds instrumentation for the gathering of a profile as the
first stage of performing profile-guided optimization
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-17
for SHARC Processors
Page 70
Compiler Command-Line Interface
Table 1-4. C/C++ Compiler Common Switches (Cont’d)
Switch NameDescription
-pplist filename
(on page 1-44)
-proc processor
(on page 1-45)
-progress-rep-func
(on page 1-45)
-progress-rep-gen-opt
(on page 1-45)
-progress-rep-mc-opt
(on page 1-46)
-R directory
(on page 1-46)
-R-
(on page 1-47)
-reserve <reg1>[,reg2...]
(on page 1-47)
-restrict-hardware-loops
<maximum> (on page 1-47)
Outputs a raw preprocessed listing to the specified file.
Specifies that the compiler should produce code suitable
for the specified processor
Issues a diagnostic message each time the compiler starts
compiling a new function. Equivalent to -Wwarn=cc1472.
Issues a diagnostic message each time the compiler starts a
new generic optimization pass on the current function.
Equivalent to -Wwarn=cc1473.
Issues a diagnostic message each time the compiler starts a
new machine-specific optimization pass on the current
function. Equivalent to -Wwarn=cc1473.
Appends directory to the standard search path for source
files
Removes all directories from the standard search path for
source files
Reserves certain registers from compiler use.
Note: Reserving registers can have a detrimental effect on
the compiler’s optimization capabilities.
Restrict the number of levels of loop nesting used by the
compiler
-S
Stops compilation before running the assembler
(on page 1-47)
-s
Removes debug info from the output executable file
(on page 1-48)
-save-temps
Saves intermediate files
(on page 1-48)
-section <id>=<section_name>
(on page 1-48)
-show
Orders the compiler to place data/program of type “
into the section “
section_name”
Displays the driver command-line information
id”
(on page 1-48)
1-18VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 71
Table 1-4. C/C++ Compiler Common Switches (Cont’d)
Switch NameDescription
Compiler
-si-revision version
(on page 1-49)
-signed-bitfield
(on page 1-50)
-signed-char
(on page 1-50)
-structs-do-not-overlap
(on page 1-51)
-switch-pm
(on page 1-51)
-syntax-only
(on page 1-51)
-sysdefs
(on page 1-52)
-T filename
(on page 1-52)
-threads
(on page 1-52)
-time
(on page 1-53)
Specifies a silicon revision of the specified processor. The
default setting is the latest silicon revision.
Makes the default type for int bitfields signed
Makes the default type for
char signed
Specifies that struct copies may use “memcpy” semantics,
rather than the usual “memmove” behavior
Specifies that the compiler should place switch tables in
program memory
Checks the source code for compiler syntax errors, but
does not write any output
Defines the system definition macros
Specifies the Linker Description File
Specifies that support for multithreaded applications is to
be enabled
Displays the elapsed time as part of the output information on each part of the compilation process
-Umacro
Undefines macro(s)
on page 1-53
-unsigned-bitfield
Makes the default type for plain
int bitfields unsigned
(on page 1-53)
-unsigned-char
Makes the default type for
char unsigned
(on page 1-54)
-v
Displays both the version and command-line information
(on page 1-54)
-verbose
Displays command-line information
(on page 1-54)
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-19
for SHARC Processors
Page 72
Compiler Command-Line Interface
Table 1-4. C/C++ Compiler Common Switches (Cont’d)
Switch NameDescription
-version
(on page 1-54)
-W{error|remark|
suppress|warn} number
(on page 1-55)
-Wdriver-limit number
(on page 1-55)
-Werror-limit number
(on page 1-55)
-Wremarks
(on page 1-55)
-Wterse
(on page 1-55)
-w
(on page 1-56)
-warn-protos
(on page 1-56)
-workaround <workaround>
(on page 1-56)
-write-files
(on page 1-56)
Displays version information
Overrides the default severity of the specified error message
Aborts the driver after reaching the specified number of
errors
Stops compiling after reaching the specified number of
errors
Indicates that the compiler may issue remarks, which are
diagnostic messages even milder than warnings
Issues only the briefest form of compiler warning, errors,
and remarks.
Does not display compiler warning messages
Produces a warnings when a function is called without a
prototype
Enables code generator workaround for specific hardware
errata
Enables compiler I/O redirection
-write-opts
(on page 1-57)
-xref filename
Passes the user options (but not input filenames) via a
temporary file
Outputs cross-reference information to the specified file
(on page 1-57)
1-20VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 73
Table 1-5. C++ Mode Compiler Switches
Switch NameDescription
Compiler
-anach
on page 1-58
-eh
on page 1-59
-no-anach
on page 1-60
-no-demangle
(on page 1-60)
-no-eh
on page 1-60
-no-implicit-inclusion
(on page 1-60)
-no-rtti
on page 1-60
-rtti
on page 1-61
Supports some language features (anachronisms) that are prohibited by the C++ standard but still in common use
Enables exception handling
Disallows the use of anachronisms that are prohibited by the C++
standard
Prevents filtering of any linker errors through the demangler
Disables exception-handling
Prevents implicit inclusion of source files as a method of finding
definitions of template entities to be instantiated
Disables run-time type information
Enables run-time type information
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-21
for SHARC Processors
Page 74
Compiler Command-Line Interface
C/C++ Mode Selection Switch Descriptions
The following command-line switches provide C/C++ mode selection.
-c89
The
-c89 switch directs the compiler to support programs that conform to
the ISO/IEC 9899:1990 standard. For greater conformance to the standard, the following switches should be used: -alttok, -const-read-write,
no-extra-keywords, and -pedantic (see Table 1-4 on page 1-12).
-c++
The -c++ (C++ mode) switch directs the compiler to compile the source
file(s) written in ANSI/ISO standard C++ with Analog Devices language
extensions. When using this switch, source files with an extension of .c is
compiled and linked in C++ mode.
All the standard features of C++ are accepted in the default mode except
exception handling and run-time type identification because these impose
a run-time overhead that is not desirable for all embedded programs. Support for these features can be enabled with the -eh and -rtti switches (see
Table 1-5).
C++ is not supported on the ADSP-21020 processor.
L
1-22VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 75
Compiler
C/C++ Compiler Common Switch Descriptions
The following command-line switches apply in both C and C++ modes.
sourcefile
The
sourcefile parameter (or parameters) specifies the name of the file
(or files) to be preprocessed, compiled, assembled, and/or linked. A file
name can include the drive, directory, file name, and file extension. The
cc21k compiler uses the file extension to determine the operations to per-
form. Table 1-2 on page 1-8 lists the permitted extensions and matching
compiler operations.
-@ filename
The -@filename (command file) switch directs the compiler to read
command-line input from filename.
-A name[tokens]
The -A (assert) switch directs the compiler to assert name as a predicate
with the specified tokens. This has the same effect as the #assert preprocessor directive. The following assertions are predefined:
systemembedded
machineadsp21xxx
cpuadsp21xxx
compilercc21k
-A name(value) switch is equivalent to including
The
#assert name(value)
in your source file, and both may be tested in a preprocessor condition in
the following manner:
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-23
for SHARC Processors
Page 76
Compiler Command-Line Interface
#if #name(value)
// do something
#else
// do something else
#endif
For example, the default assertions may be tested as:
#if #machine(adsp21xxx)
// do something
#endif
L
switch, to prevent misinterpretation. No quotes are needed for a
#assert directive in a source file.
-aligned-stack
The -aligned-stack switch directs the compiler to align the program
stack on a double-word boundary.
-alttok
The -alttok (alternative tokens) switch directs the compiler to allow
alternative operator keywords and digraph sequences in source files. Additionally, this switch enables the recognition of these alternative operator
keywords in C++ source files:
KeywordEquivalent
and &&
and_eq &=
bitand&
bitor|
compl~
or||
or_eq|=
not!
The parentheses in the assertion need quotes when using the -A
1-24VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 77
KeywordEquivalent
not_eq!=
xor^
xor_eq^=
Compiler
L
<iso646.h>
.
-annotate-loop-instr
The -annotate-loop-instr switch directs the compiler to provide additional annotation information for the prolog, kernel and epilog of a loop.
See “Assembly Optimizer Annotations” on page 2-51 for more details on
this feature.
-bss
The -bss (build library) switch directs the compiler to place global data
into a BSS-style section (called “bsz”), rather than into normal global data
section. See also “-no-bss” on page 1-37.
-build-lib
The -build-lib (build library) switch directs the compiler to use the
To use alternative tokens in C, you should use #include
librarian to produce a library file (
.dlb) as the output instead of using the
linker to produce an executable file (.dxe). The -o option must be used to
specify the name of the resulting library.
-C
The -C (comments) switch, which may only be run in combination with
the
-E or -P switches, directs the C/C++ preprocessor to retain comments
in its output file.
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-25
for SHARC Processors
Page 78
Compiler Command-Line Interface
-c
The
-c (compile only) switch directs the compiler to compile and/or
assemble the source files, but stop before linking. The output is an object
file (.doj) for each source file.
-compatible-pm-dm
The compatible-pm-dm switch specifies that the compiler shall treat dmand pm-qualified pointers as assignment-compatible.
-const-read-write
The -const-read-write switch directs the compiler to specify that constants may be accessed as read-write data (as in ANSI C). The compiler’s
default behavior assumes that data referenced through const pointers
never changes.
The -const-read-write switch changes the compiler’s behavior to match
the ANSI C assumption, which is that other non-const pointers may be
used to change the data at some point.
-Dmacro[=definition]
The -D (define macro) switch directs the compiler to define a macro. If
you do not include the optional definition string, the compiler defines the
macro as the string ‘1’. Note that the compiler processes all
the command line before any
-U (undefine macro) switches.
-D switches on
-debug-types
-debug-types switch builds a *.h file directly and writes a complete
The
set of debugging information for the header file. The
be specified with the
-debug-types switch because it is implied. For
-g option need not
example,
cc21k -debug-types anyHeader.h
1-26VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 79
Compiler
Until the introduction of
*.h file as a valid input file. The implicit -g option writes debugging infor-
-debug-types, the compiler would not accept a
mation for only those typedefs that are referenced in the program. The
-debug-types option provides complete debugging information for all
typedefs and structs.
-default-linkage[-asm | -C | -C++]
The -default-linkage-asm (assembler linkage), -default-linkage-C (C
linkage), and -default-linkage-C++ (C++ linkage) directs the compiler to
set the default linkage type. C linkage is the default type in C mode, and
C++ linkage is the default type in C++ mode.
Invoke this switch with the Additional Options box located in the
L
VisualDSP++ Project Options dialog box, Compile tab, General
category.
-double-size[-32|-64]
The -double-size-32 (double is 32 bits) and the -double-size-64 (double is 64 bits) switches select the storage format that the compiler uses for
type double. The default mode is -double-size-32.
The C/C++ type double poses a special problem for the compiler. The C
and C++ languages default to double for floating-point constants and
many floating-point calculations. If
double has the customary size of 64
bits, many programs inadvertently use slow speed emulated 64-bit
floating-point arithmetic, even when variables are declared consistently as
float.
To avoid this problem, cc21k provides a mode in which double is the
same size as
float. This mode is enabled with the -double-size-32 switch
and is the default mode.
Representing
double using 32 bits gives good performance and provides
enough precision for most DSP applications. This, however, does not fully
conform to the C and C++ standards. The standard requires that double
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-27
for SHARC Processors
Page 80
Compiler Command-Line Interface
maintains 10 digits of precision, which requires 64 bits of storage. The
-double-size-64 switch sets the size of double to 64 bits for full standard
conformance.
With -double-size-32, a double is stored in 32-bit IEEE single-precision
format and is operated on using fast hardware floating-point instructions.
Standard math functions such as sin also operate on 32-bit values. This
mode is the default and is recommended for most programs. Calculations
that need higher precision can be done with the long double type, which
is always 64 bits.
With -double-size-64, a double is stored in 64-bit IEEE single precision
format and is operated on using slow floating-point emulation software.
Standard math functions such as sin also operate on 64-bit values and are
similarly slow. This mode is recommended only for porting code that
requires that double have more than 32 bits of precision.
The -double-size-32 switch defines the __DOUBLES_ARE_FLOATS__
macro, while the -double-size-64 switch undefines the
__DOUBLES_ARE_FLOATS__ macro.
-double-size-any
The -double-size-any switch specifies that the resulting object files
should be marked in such a way that will enable them to be linked against
objects built with
doubles either 32-bit or 64-bit in size.
-dry
The -dry (verbose dry-run) switch directs the compiler to display main
driver actions, but not to perform them.
-dryrun
The -dryrun (terse dry-run) switch directs the compiler to display
top-level driver actions, but not to perform them.
1-28VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 81
Compiler
-E
The
-E (stop after preprocessing) switch directs the compiler to stop after
the C/C++ preprocessor runs (without compiling). The output (preprocessed source code) prints to the standard output stream (<stdout>) unless
the output file is specified with the -o switch. Note that the -C switch can
only be run in combination with the -E switch.
L
-ED
The -ED (run after preprocessing to file) switch directs the compiler to
write the output of the C/C++ preprocessor to a file named
original_filename.i. After preprocessing, compilation proceeds
normally.
-EE
The -EE (run after preprocessing) switch is similar to the -E switch, but it
does not halt compilation after preprocessing.
-extra-keywords
The
compiler to recognize the Analog Devices keyword extensions to
ANSI/ISO standard C and C++, such as
scores, which can affect conforming ANSI/ISO C and C++ programs.
This is the default mode.
Invoke this switch with the Stop after: Preprocessor check box
located in the VisualDSP++ Project Options dialog box, Compile
tab, General category.
-extra-keywords (enable short-form keywords) switch directs the
-flags (command-line input) switch directs the compiler to pass
The
command-line switches to the other build tools. The tools are:
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-29
for SHARC Processors
Page 82
Compiler Command-Line Interface
OptionTool
-flags-asmAssembler
-flags-compilerCompiler executable
-flags-libLibrary Builder (elfar.exe)
-flags-linkLinker
-flags-memMemory Initializer
-float-to-int
The
-float-to-int switch instructs the compiler to use a support library
function to convert a float to an integer. The library support routine performs extra checking to avoid a floating-point underflow occurring.
-force-circbuf
The -force-circbuf (circular buffer) switch instructs the compiler to
make use of circular buffer facilities, even if the compiler cannot verify
that the circular index or pointer is always within the range of the buffer.
Without this switch, the compiler's default behavior is conservative, and
does not use circular buffers unless it can verify that the circular index or
pointer is always within the circular buffer range. See “Circular Buffer
Built-In Functions” on page 1-107.
-fp-associative
-fp-associative switch directs the compiler to treat floating-point
The
multiplication and addition as an associative. This switch is on by default.
-full-version
The -full-version (display versions) switch directs the compiler to display version information for build tools used in a compilation.
1-30VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 83
Compiler
-g
The
-g (generate debug information) switch directs the compiler to out-
put symbols and other information used by the debugger.
When the -g switch is used in conjunction with the enable optimization
(-O) switch, the compiler performs standard optimizations. The compiler
also outputs symbols and other information to provide limited
source-level debugging through the VisualDSP++ IDDE (debugger). This
combination of options provides line debugging and global variable
debugging.
L
L
-H
The
the files included by the preprocessor via the #include directive, without
compiling.
-HH
The -HH (list headers and compile) switch directs the compiler to output
to the standard output stream a list of the files included by the preprocessor via the #include directive. After preprocessing, compilation proceeds
normally.
When the -g and -O switches are specified, no debug information is
available for local variables and the standard optimizations can
sometimes rearrange program code in a way that inaccurate line
number information may be produced. For full debugging capabilities, use the -g switch without the -O switch. See also the -Og
switch (on page 1-41).
Invoke this switch by selecting the Generate debug information
check box in the VisualDSP++ Project Options dialog box,
Compile tab, General category.
-H (list headers) switch directs the compiler to output only a list of
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-31
for SHARC Processors
Page 84
Compiler Command-Line Interface
-h[elp]
The
-help (command-line help) switch directs the compiler to output a
list of command-line switches with a brief syntax description.
-I directory [{,|;} directory...]
The -I (include search directory) switch directs the C/C++ compiler preprocessor to append the directory (directories) to the search path for
include files. This option can be specified more than once; all specified
directories are added to the search path.
Include files, whose names are not absolute path names and that are
enclosed in “...” when included, are searched for in the following directories in this order:
1. The directory containing the current input file (the primary source
file or the file containing the #include)
2. Any directories specified with the -I switch in the order they are
listed on the command line
3. Any directories on the standard list:
<VDSP++ install dir>/.../include
If a file is included using the <...> form, this file is only searched
L
for by using directories defined in items 2 and 3 above.
-I-
-I- (start include directory list) switch establishes the point in the
The
include directory list at which the search for header files enclosed in angle
brackets begins. Normally, for header files enclosed in double quotes, the
compiler searches in the directory containing the current input file; then
the compiler reverts back to looking in the directories specified with the
-I switch and then in the standard include directory.
1-32VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 85
Compiler
L
It is possible to replace the initial search (within the directory containing
the current input file) by placing the -I- switch at the point on the command line where the search for all types of header file begins. All include
directories on the command line specified before the -I- switch are used
only in the search for header files that are enclosed in double quotes.
L
-i
The -i (less includes) switch may be used with the –H, -HH, -M, or -MM
switches to direct the compiler to only output header details (-H, -HH) or
makefile dependencies (-M, -MM) for include files specified in double
quotes.
-include filename
The -include (include file) switch directs the preprocessor to process the
specified file before processing the regular input file. Any -D and -U
options on the command line are always processed before an -include file.
Only one -include may be given.
For header files in angle brackets, the compiler performs the latter
two searches only.
This switch removes the directory containing the current input file
from the include directory list.
-ipa
The -ipa (interprocedural analysis) switch turns on Interprocedural
Analysis (IPA) in the compiler. This option enables optimization across
the entire program, including between source files that were compiled separately. The -ipa option should be applied to all C and C++ files in the
program. For more information, see “Interprocedural Analysis” on
page 1-67. Specifying
(on page 1-40).
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-33
for SHARC Processors
-ipa also implies setting the -O switch
Page 86
Compiler Command-Line Interface
L
-L directory[{;|,}directory…]
The -L (library search directory) switch directs the linker to append the
directory to the search path for library files.
-l library
The -l (link library) switch directs the linker to search the library for
functions and global variables when linking. The library name is the portion of the file name between the lib prefix and .dlb extension.
For example, the -lc compiler switch directs the linker to search in the
library named c. This library resides in a file named libc.dlb.
All object files should be listed on the command line before listing libraries using the -l switch. When a reference to a symbol is made, the symbol
definition will be taken from the left-most object or library on the command line that contains the global definition of that symbol. If two
objects on the command line contain definitions of the symbol x, x will be
taken from the left-most object on the command line that contains a global definition of x.
Invoke this switch by selecting the Interprocedural Analysis check
box in the VisualDSP++ Project Options dialog box, Compile tab, General category.
If one of the definitions for
a user library, and the library definition should be overridden by the user
object definition, it is important that the user object comes before the
library on the command line.
Libraries included in the default .LDF file are searched last for symbol
definitions.
1-34VisualDSP++ 4.0 C/C++ Compiler and Library Manual
x comes from user objects, and the other from
for SHARC Processors
Page 87
Compiler
-M
The
-M (generate make rules only) switch directs the compiler not to com-
pile the source file, but to output a rule suitable for the make utility,
describing the dependencies of the main program file. The format of the
make rule output by the preprocessor is:
object-file: include-file …
-MD
The -MD (generate make rules and compile) switch directs the preprocessor
to print to a file called original_filename.d a rule describing the dependencies of the main program file. After preprocessing, compilation
proceeds normally. See also the –Mo switch.
-MM
The -MM (generate make rules and compile) switch directs the preprocessor
to print to standard out a rule describing the dependencies of the main
program file. After preprocessing, compilation proceeds normally.
-Mo _filename_
The -Mofilename (preprocessor output file) switch directs the compiler
to use
filename for the output of –MD or –ED switches.
-Mt filename
The -Mtfilename (output make rule for the named source) switch modifies the target of dependencies, renaming the target to filename. It only
has an effect when used in conjunction with the -M or -MM switch..
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-35
for SHARC Processors
Page 88
Compiler Command-Line Interface
-MQ
The
-MQ switch directs the compiler not to compile the source file but to
output a rule. In addition, the -MQ switch does not produce any notification when input files are missing.
-map filename
The -mapfilename (generate a memory map) switch directs the linker to
output a memory map of all symbols. The map file name corresponds to
the filename argument. For example, if the argument is test, the map file
name is test.xml. The .xml extension is added where necessary.
-mem
The -mem (enable memory initialization) switch directs the compiler to
run the mem21k initializer.
-multiline
The -multiline switch enables a compiler GNU compatibility mode
which allows string literals to span multiple lines without the need for a
“\” at the end of each line. This is the default mode.
-no-aligned-stack
-no-aligned-stack (disable stack alignment) switch directs the com-
The
piler to not align the program stack on a double-word boundary.
-no-alttok
The -no-alttok (disable alternative tokens) switch directs the compiler
not to accept alternative operator keywords and digraph sequences in the
source files. This is the default mode. For more information, see “-alttok”
on page 1-24.
1-36VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 89
Compiler
-no-annotate
The
-no-annotate (disable assembly annotations) switch directs the com-
piler not to annotate assembly files. The default behavior is that whenever
optimizations are enabled all assembly files generated by the compiler are
annotated with information on the performance of the generated assembly. See “Assembly Optimizer Annotations” on page 2-51 for more details
on this feature.
-no-annotate-loop-instr
The -no-annotate-loop-instr switch disables the production of additional loop annotation information by the compiler. This is the default
mode.
-no-bss
The -no-bss switch causes the compiler to keep zero-initialized and
non-zero-initialized data in the same data section, rather than separating
zero-initialized data into a different, BSS-style section. See also the -bss
switch on page 1-25.
-no-builtin
The -no-builtin (no built-in functions) switch directs the compiler to
ignore built-in functions that begin with two underscores (
this switch influences many functions. This switch also predefines the
__NO_BUILTIN preprocessor macro. For more information on built-in func-
tions, see “C++ Fractional Type Support” on page 1-146.
L
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-37
for SHARC Processors
Invoke this switch by selecting the Disable builtin functions check
box in the VisualDSP++ Project Options dialog box, Compile tab, General category.
__). Note that
Page 90
Compiler Command-Line Interface
-no-circbuf
The
-no-circbuf (no circular buffer) switch disables the automatic gener-
ation of circular buffer code by the compiler. Uses of the circindex() and
circptr() functions (that is, explicit circular buffer operations) are not
affected.
-no-db
The -no-db (no delayed branches) switch specifies that the compiler shall
not generate jumps that use delayed branches.
-no-defs
The -no-defs (disable defaults) switch directs the preprocessor not to
define any default preprocessor macros, include directories, library directories, libraries, and run-time headers. It also disables the Analog Devices
cc21k C/C++ keyword extensions.
-no-extra-keywords
The -no-extra-keywords (disable short-form keywords) switch directs the
compiler not to recognize the Analog Devices keyword extensions that
might affect conformance to ISO/ANSI standards for C and C++ languages. These include keywords such as pm and dm, which may be used as
identifiers in standard conforming programs. Alternate keywords, which
are prefixed with two leading underscores, such as __pm and __dm, continue to work.
-no-fp-associative
The -no-fp-associative switch directs the compiler NOT to treat
floating-point multiplication and addition as an associative.
1-38VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 91
Compiler
-no-mem
The
-no-mem (disable memory initialization) switch directs the compiler
not to run the mem21k initializer. Note that if you use -no-mem, the compiler does not initialize globals and statics.
-no-multiline
The -no-multiline switch disables a compiler GNU compatibility mode
which allows string literals to span multiple lines without the need for a
“\” at the end of each line.
-no-saturation
The -no-saturation switch directs the compiler not to introduce faster
operations in cases where the faster operation would saturate (if the
expression overflowed) when the original operation would have wrapped
the result.
-no-simd
The -no-simd (disable SIMD mode) switch directs the compiler to disable
automatic SIMD code generation when compiling for ADSP-2116x,
ADSP-2126x and ADSP-2136x processors. Note that SIMD code is still
generated for a loop if it is preceded with the “SIMD_for” pragma. The
pragma is treated as an explicit user request to generate SIMD code and is
always obeyed, if possible. See “SIMD Support” on page 1-150 for more
information.
-no-std-ass
-no-std-ass (disable standard assertions) switch prevents the com-
The
piler from defining the standard assertions. See the -A switch
(on page 1-23) for the list of standard assertions.
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-39
for SHARC Processors
Page 92
Compiler Command-Line Interface
-no-std-def
The
-no-std-def (disable standard macro definitions) switch prevents the
compiler from defining default preprocessor macro definitions.
L
-no-std-inc
The -no-std-inc (disable standard include search) switch directs the
C/C++ preprocessor to search for header files in the current directory and
directories specified with the -I switch.
L
-no-std-lib
The -no-std-lib (disable standard library search) switch directs the linker
to search for libraries in only the current project directory and directories
specified with the -L switch.
-no-threads
The
piled code and libraries used in the build need not be thread-safe. This is
the default setting when the
not used.
This switch also disables the Analog Devices keyword extensions
that have no leading underscores, such as pm and dm.
You can invoke this switch by selecting the Ignore standard include paths check box in the VisualDSP++ Project Options dialog box, Compile tab, Preprocessor category.
-nothreads (disable thread-safe build) switch specifies that all com-
-threads (enable thread-safe build) switch is
-O[0|1]
The -O (enable optimizations) switch directs the compiler to produce code
that is optimized for performance. Optimizations are not enabled by
default for the
zation on, while setting
1-40VisualDSP++ 4.0 C/C++ Compiler and Library Manual
cc21k compiler. The switch setting -O or -O1 turns optimi-
-O0 turns off all optimizations.
for SHARC Processors
Page 93
Compiler
L
-Oa
The -Oa (automatic function inlining) switch enables the inline expansion
of C/C++ functions, which are not necessarily declared inline in the source
code. The amount of auto-inlining the compiler performs is controlled
using the –Ov (optimize for speed versus size) switch (on page 1-41).
Therefore, use of -Ov100 indicates that as many functions as possible are
auto-inlined, whereas –Ov0 prevents any function from being auto-inlined.
Specifying -Oa also implies the use of -O.
-Og
The -Og switch enables a compiler mode that attempts to perform optimizations while still preserving the debugging information. It is meant as an
alternative for those who want a debuggable program but who are also
concerned about the performance of their debuggable code.
-Os
You can invoke this switch by selecting the Enable optimization
check box in the VisualDSP++ Project Options dialog box,
Compile tab, General category.
The -Os (optimize for size) switch directs the compiler to produce code
that is optimized for size. This is achieved by performing all optimizations
except those that increase code size. The optimizations not performed
include loop unrolling, some delay slot filling, and jump avoidance.
-Ov num
The -Ov num (optimize for speed versus size) switch directs the compiler to
produce code that is optimized for speed versus size. The “
an integer between 0 (purely size) and 100 (purely speed).
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-41
for SHARC Processors
num” should be
Page 94
Compiler Command-Line Interface
-o filename
The
-o (output file) switch directs the compiler to use filename for the
name of the final output file.
-P
The -P (omit line numbers) switch directs the compiler to stop after the
C/C++ preprocessor runs (without compiling) and to omit the #line preprocessor command with line number information from the preprocessor
output. The -C switch can be used in conjunction with -P to retain
comments.
-PP
The -PP (omit line numbers and compile) switch is similar to the -P
switch; however, it does not halt compilation after preprocessing.
-path-{ asm | compiler | lib | link | mem } directory
The -path-{asm|compiler|lib|link|mem}directory (tool location)
switch directs the compiler to use the specified component in place of the
default-installed version of the compilation tool. The component comprises a relative or absolute path to its location. Respectively, the tools are
the assembler, compiler, librarian, linker or memory initializer. Use this
switch when overriding the normal version of one or more of the tools.
The -path-{} switch also overrides the directory specified by the
-path-install switch.
-path-install directory
The
-path-install (installation location) switch directs the compiler to
use the specified directory as the location for all compilation tools instead
of the default path. This is useful when working with multiple versions of
the tool set.
L
1-42VisualDSP++ 4.0 C/C++ Compiler and Library Manual
You can selectively override this switch with the -path-tool
switch.
for SHARC Processors
Page 95
Compiler
-path-output directory
The
-path-output (non-temporary files location) switch directs the com-
piler to place final output files in the specified directory.
-path-temp directory
The -path-temp (temporary files location) switch directs the compiler to
place temporary files in the specified directory.
-pch
The -pch (precompiled header) switch directs the compiler to automatically generate and use precompiled header files. A precompiled output
header has a .pch extension attached to the source file name. By default,
all precompiled headers are stored in a directory called PCHRepository.
L
-pchdir directory
The -pchdir (locate PCHRepository) switch specifies the location of an
alternative PCHRepository for storing and invocation of precompiled
header files. If the directory does not exist, the compiler creates it. Note
that
-pedantic
The -pedantic (ANSI standard warnings) switch causes the compiler to
issue a warning for each construct found in your program that does not
strictly conform to ANSI/ISO standard C or C++.
L
Precompiled header files can significantly speed compilation; precompiled headers tend to occupy more disk space.
-o (output) does not influence the -pchdir option.
The compiler may not detect all such constructs. In particular, the
-pedantic switch does not cause the compiler to issue errors when
Analog Devices keyword extensions are used.
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-43
for SHARC Processors
Page 96
Compiler Command-Line Interface
-pedantic-errors
The
-pedantic-errors (ANSI standard errors) switch causes the compiler
to issue errors instead of warnings for cases described in the -pedantic
switch.
-pguide
The -pguide switch causes the compiler to add instrumentation for the
gathering of a profile as the first stage of performing profile-guided
optimization.
-pplist filename
The -pplist (preprocessor listing) directs the preprocessor to output a
listing to the named file. When more than one source file is preprocessed,
the listing file contains information about the last file processed. The generated file contains raw source lines, information on transitions into and
out of include files, and diagnostics generated by the compiler.
Each listing line begins with a key character that identifies its type as:
CharacterMeaning
NNormal line of source
XExpanded line of source
SLine of source skipped by #if or #ifdef
L
RDiagnostic message (remark)
WDiagnostic message (warning)
EDiagnostic message (error)
CDiagnostic message (catastrophic error)
Change in source position
1-44VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Page 97
-proc processor
The
-proc processor (target processor) switch specifies the compiler pro-
duces code suitable for the specified processor. Refer to “Supported
Processors” for the list of supported SHARC processors.
For example,
cc21k -proc ADSP-21161 -o bin\p1.doj p1.asm
Compiler
L
When compiling with the -proc switch, the appropriate processor macro
as well as __ADSP21000__ are defined as 1. For example, __ADSP21060__
and __ADSP-21000__ are 1.
L
-progress-rep-func
The -progress-rep-func switch provides feedback on the compiler’s
progress that may be useful when compiling and optimizing very large
source files. It issues a “warning” message each time the compiler starts
compiling a new function. The “warning” message is a remark that is disabled by default, and this switch enables the remark as a warning. The
switch is equivalent to
-progress-rep-gen-opt
The
progress that may be useful when compiling and optimizing a very large,
complex function. It issues a “warning” message each time the compiler
starts a new generic optimization pass on the current function. The “warn-
If no target is specified with the -proc switch, the system uses the
ADSP-21060 processor settings as a default.
See also “-si-revision version” on page 1-49 for more information
on silicon revision of the specified processor.
-Wwarn=cc1472.
-progress-rep-gen-opt switch provides feedback on the compiler’s
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-45
for SHARC Processors
Page 98
Compiler Command-Line Interface
ing” message is a remark that is disabled by default, and this switch
enables the remark as a warning. The switch is equivalent to
-Wwarn=cc1473.
-progress-rep-mc-opt
The -progress-rep-mc-opt switch provides feedback on the compiler’s
progress that may be useful when compiling and optimizing a very large,
complex function. It issues a “warning” message each time the compiler
starts a new machine-specific optimization pass on the current function.
The “warning” message is a remark that is disabled by default, and this
switch enables the remark as a warning. The switch is equivalent to
-Wwarn=cc1474.
-R directory[{:|,}directory …]
The -Rdirectory (add source directory) switch directs the compiler to
add the specified directory to the list of directories searched for source
files. On Windows platforms, multiple source directories are given as a
colon, comma, or semicolon separated list.
The compiler searches for the source files in the order specified on the
command line. The compiler searches the specified directories before
reverting to the current project directory. The -R directory option is
position-dependent on the command line. That is, it affects only source
files that follow the option.
[
1-46VisualDSP++ 4.0 C/C++ Compiler and Library Manual
Source files whose file names begin with /, ./ or ../ (or Windows
equivalent) and contain drive specifiers (on Windows platforms)
are not affected by this option
for SHARC Processors
Page 99
-R-
The
-R- (disable source path) switch removes all directories from the stan-
dard search path for source files, effectively disabling this feature.
Compiler
L
-reserve register[, register …]
The -reserve (reserve register) switch directs the compiler not to use the
specified registers. This guarantees that a known set of registers are available for inline assembly code or linked assembly modules. Separate each
register name with a comma on the compiler command line.
You can reserve the following registers: b0, l0, m0, i0, b1, l1, m1, i1, b8,
l8, m8, i8, b9, l9, m9, i9, ustat1, and ustat2 (as well as ustat3 and ustat4
on ADSP-2116x, ADSP-2126x and ADSP-2136x processors). When
reserving an L (length) register, you must reserve the corresponding I
(index) register; reserving an L register without reserving the corresponding I register may result in execution problems.
-restrict-hardware-loops <maximum>
The -restrict-hardware-loops <maximum> switch restricts the level of
nested hardware loops that the compiler generates. The default setting is
6, which is the maximum number of levels that the hardware supports.
This option is position-dependent on the command line; it only
affects files following it.
-S
The -S (stop after compilation) switch directs cc21k to stop compilation
before running the assembler. The compiler outputs an assembly file
with an
L
VisualDSP++ 4.0 C/C++ Compiler and Library Manual 1-47
for SHARC Processors
.s extension.
Invoke this switch by selecting the Stop after: Compiler check box
in the VisualDSP++ Project Options dialog box, Compile tab,
General category selection.
Page 100
Compiler Command-Line Interface
-s
The
-s (strip debug information) switch directs the compiler to remove
debug information (symbol table and other items) from the output executable file during linking.
-save-temps
The -save-temps (save intermediate files) switch directs the compiler not
to discard intermediate files. The compiler places the intermediate output
(*.i, *.is, *.s, *.doj) files in the temp subdirectory of the current
project directory. See Table 1-2 on page 1-8 for a list of intermediate files.
-section <id>=<section_name>[,<id>=section_name>]
The -section switch controls the placement of types of data produced by
the compiler. The data is placed into the section “section_name” as specified on the command line.
The compiler currently supports the following section identifiers:
vtbl — controls placement of the C++ virtual lookup tables
switch — controls placement of tables used in the implementation of
switch statements
Make sure that the section selected via the command line exists within the
.LDF file (refer to the Linker chapter in the VisualDSP++ 4.0 Linker and
Utilities manual).
-show
The -show (display command line) switch directs the compiler to display
the command-line arguments passed to the driver, including expanded
option files and environment variables. This option allows you to ensure
that command-line options have been successfully invoked by the driver.
1-48VisualDSP++ 4.0 C/C++ Compiler and Library Manual
for SHARC Processors
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.