Command-Line Tools. freescale ColdFire v6.0
Reklama
Reklama
CF.book Page 179 Friday, July 8, 2005 8:59 AM
13
Command-Line Tools
Your CodeWarrior software includes a command-line compiler, assembler, and linker.
This chapter describes how to use these tools to build applications.
This chapter consists of these sections:
Command-Line Executables
Command-line tools let you do anything that you can do with IDE-hosted tools, but the command-line implementation is different. For example, you use a makefile instead of an
IDE project; you use command-line switches instead of IDE settings panels to specify options. However, you can script the IDE so that the automation environment and the GUI share common files.
The command-line tools are a set of executable files:
• mwccmcf.exe — the ColdFire compiler
• mwasmmcf.exe — the ColdFire assembler
• mwldmcf.exe — the ColdFire linker/disassembler
These files are in folder \E68K_Tools\Command_Line_Tools
Environment Variables
Use environment variables to store pathnames to the libraries you commonly use. This shortens the command lines for many tasks.
The syntax for defining an environment variable is: set EV_Name=pathname[;pathname] where
EV_Name
Name of the new environment variable.
ColdFire Architectures v6.0 - Targeting Manual 179
CF.book Page 180 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Environment Variables pathname
Full pathname of a file. Semicolons must separate multiple pathname values.
NOTE
Omit any quote marks from environment-variable definitions that include spaces. As Windows does not strip out quotes, they can lead to warnings or error messages.
If you use Makefiles, you can define the following as Makefile variables instead.
Listing 13.1 is a sample definition for the C/C++ compiler environment variable
MWCIncludes
. Using this variable would add all its constituent paths to the system path.
Listing 13.1 Example C/C++ Compiler Variable Definition
set MWCIncludes=
%MWDIR%\E68K_Tools\MetroTRK\Transport\M68k\mot_sbc_5407_serial\bin;
%MWDIR%\E68K_Support\Runtime\Inc;
%MWDIR%\E68K_Support\Msl\Msl_c\MSL_Common\Include;
%MWDIR%\E68K_Support\Msl\Msl_c++\MSL_Common\Include;
Listing 13.2 is a sample definition for the linker environment variable MWLibraries.
Using this variable would add all its constituent paths to the system path.
Listing 13.2 Example Linker Variable Definition 1
set MWLibraries=
%MWDIR%\E68K_Support\Msl\Msl_c\Msl_E68k\Lib;
%MWDIR%\E68K_Support\Msl\Msl_c++\Msl_E68k\Lib;
%MWDIR%\E68K_Support\Runtime\
Listing 13.3 is a sample definition for the linker environment variable
MWLibraryFiles
. Using this variable would add the named files to the end of the link order.
Listing 13.3 Example Linker Variable Definition 2
set MWLibraryFiles = fp_coldfire.o;
C_4i_CF5407_Runtime.a;
C_4i_CF5407_StdABI_MSL.a;
180 ColdFire Architectures v6.0 - Targeting Manual
CF.book Page 181 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Compiling and Linking
If you use the IDE, you use preference panels to configure linker and project settings.
With the command-line tools, you configure these settings by including appropriate switches in the command line.
At the end of compiling, the compiler automatically invokes the linker. The link order is the order in which your command line lists files. Remember that you still need a valid linker command file.
Table 13.1 lists the general options for compiling debug versions of ColdFire C
applications.
Table 13.1 Typical Operations for Debugging
Tool
Assembler
Compiler
Option
-D DEBUG
-g
-proc MCF5485
-abi compact
-fp soft
-g
-lang c
-model far
-opt level=0
-proc MCF5407
-r
-RTTI off
-wchar_t off
Purpose
Defines DEBUG
Generates DWARF output.
Sets the processor.
Specifies compact mode.
Specifies software floating point.
Generates DWARF output.
Specifies C source.
Specifies 32-bit references.
Specifies no optimizations.
Sets the processor.
Requires prototypes.
Turns off C++ runtime typing.
Specifies no built-in C++ type.
ColdFire Architectures v6.0 - Targeting Manual 181
CF.book Page 182 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.1 Typical Operations for Debugging ( continued)
Tool
Linker
Option
-application
-dis
-g
-map
-o a.out
-srec
-sreceol dos
-sreclength 80
-warnings on
Purpose
Specifies full application, not a library.
Generates disassembly.
Generates DWARF output.
Generates link file map.
Specifies output filename.
Creates S-record file
Specifies \r\n EOL separators.
Specifies 80-character record length.
Turns warnings on.
For more real-world uses of the command-line tools, examine any of the examples in folder,
(Examples)\ColdFire\ColdFire_Command_Line_Tools
For information about the parameters of these options, use the help option to cite the option, in this format:
-help opt= optionname where
optionname
The option for which you are seeking further information.
This help line, for example, requests the possible values for the -proc keyword — that is, the list of possible target processors: mwccmcf -help opt=proc
The system response is a list such as:
MCF5213
MCF548x
MCF5206e
MCF5249
MCF5272
MCF5280
MCF5282
182 ColdFire Architectures v6.0 - Targeting Manual
CF.book Page 183 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
MCF5307
MCF5407
The following is a complete list of command line switches for each tool component.
Assembler Options
Table 13.2 lists the options of the command-line assembler.
Table 13.2 Command-Line Assembler Options
Option Purpose
-bl_16
-c_preprocess
Sets bra.l to 16-bits (default is 32 bits).
Specifies C preprocessing.
-endian <little|big>
Specifies target byte ordering.
-gnu
Specifies Gnu-compatible assembly.
-list <filename>
-model abs|bigpic|pic|pid
Specifies the name or pathname for the listing file.
Specifies the memory model.
-nocase
-nocode
-nocolons
-nodebug
-noperiod
-nospace
-o <filename>
-p <hex longword>
-preprocess
Specifies that indentifiers are not case sensitive.
Specifies only a syntax check; no code generation.
Permits labels that do not end in the colon character.
Suppresses debug-information generation.
Permits directives that do not start with a period character.
Prohibits space characters in operand fields.
Specifies the name or pathname for the output file.
Defines a longwords that specifies the processors.
Specifies only preprocessing (macro expansions and conditionals).
ColdFire Architectures v6.0 - Targeting Manual 183
CF.book Page 184 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.2 Command-Line Assembler Options
Option
-shared
-w[arnings]
Purpose
Specifies shared libraries.
Turns of notes and warnings (error messages still appear).
Compiler Options
Table 13.3 lists the options of the command-line compiler. The compiler passes all options
to the linker, except as the table notes.
NOTE
Optimization keyword values except off, on, all, space, and speed are for backwards compatibility. To supersede other optimization options, use
-opt level=xxx
.
Table 13.3 Command-Line Compiler Options
Category
General
Option
-help [keyword[,...]]
all
group=keyword
[no]compatible
[no]deprecated
[no]ignored
[no]normal
[no]obsolete
[no]spaces
search=keyword
tool=keyword[,...]
all
both
other|skipped
this
usage
-maxerrors max
-maxwarnings max
Purpose
Displays corresponding help information:
All standard options.
All groups that include keyword.
Compatibility options.
Deprecated options.
Ignored options.
Only standard options.
Obsolete options.
Inserts blank lines between options.
All options that include keyword.
Options by tool:
all options available for this tool,
options available in all tools,
options passed to another tool
options this tool executes (default).
Usage information.
Specifies the maximum number of error messages to print. 0 (the default) means no maximum. (Not global)
Specifies the maximum number of warnings to print. 0 (the default) means no maximum. (Not global)
184 ColdFire Architectures v6.0 - Targeting Manual
CF.book Page 185 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.3 Command-Line Compiler Options ( continued)
Category
Preprocessing,
Precompiling, and
Input File Control
Option
-msgstyle keyword
gcc
IDE
mpw
parseable
std
-[no]stderr
-[no]wraplines
-progress
-search
-timing
-v[erbose]
-version
-c
-[no]codegen
-[no]convertpaths
-cwd keyword
explicit
include
proj
source
-D+ | -d[efine] name[=value]
-[no]defaults
Purpose
Sets message style per keyword value:
Use GCC-like style.
Use CodeWarrior IDE-like style.
Use MPW style.
Use context-free, machine-parseable style.
Use standard style (default).
Specifies separate stderr, stdout streams; if -nostderr is in effect, stderr goes to stdout
.
Specifies message word wrapping.
Shows progress and version.
Searches access paths for source, object, or library files that the command line specifies.
Collects timing statistics.
Specifies cumulative, verbose information; implies -progress.
Shows tool version, configuration, and build date.
Specifies compiling only, without linking.
Specifies object-code generation.
Interprets #include filepaths of other operating systems. Characters / and : separate directories, so cannot be in filenames.
Specifies searching priority per keyword:
No implicit directories: only I, -ir paths.
Start in directory of referencing file.
Start in current working directory (default).
Start in source-file directory.
(Not global)
Defines symbol name to value 1 or to specified value. (Not global)
Specifies passing to linker (default); same as
-[no]stdinc
.
ColdFire Architectures v6.0 - Targeting Manual 185
CF.book Page 186 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.3 Command-Line Compiler Options ( continued)
Category Option
-dis[assemble]
-E
-EP
-ext extension
-gccinc[ludes]
-i- | -I-
-I+ | -i path
-ir path
-[no]keepobj[ects]
-M | -make
-MD
Purpose
Specifies passing to all tools, disassembled files to stdout.
Specifies preprocessing source files.
Specifies preprocessing and stripping out line directives.
Specifies extension for generated object files; maximum 14 characters. A leading period character specifies appending this extension; no leading period specifies replacing the source-file extension.
Specifies GCC #include semantics: adds -
I
paths to the system list if -I- is not specified. #includes search starts in referencing-file directory. (Same as -cwd include)
Changes target for -I access paths to the system list; implies -cwd explicit. Doublequote characters (#include “...”) specify searching user paths then system paths.
Angle characters (#include <...>) specify searching only system paths.
Appends access path to the current
#include
list.
Appends a recursive access path to the current #include list.
Keeps object files generated after invoking the linker. Without this option, the system always deletes temporary intermediate object files after the link stage.
Specifies scanning source files for dependencies and emitting a makefile; does not
generate object code.
Specifies scanning source files for dependencies, writing a dependency map to a file, then generating object code.
186 ColdFire Architectures v6.0 - Targeting Manual
CF.book Page 187 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.3 Command-Line Compiler Options ( continued)
Category Option
_MM
-MMD
-nofail
-nolink
-noprecompile
-nosyspath
-o file | dir
-P
-precompile file | dir
-preprocess
-prefix file
-S
Purpose
Specifies scanning source files for dependencies and emitting a makefile. Does not list system include files, does not generate object code.
Specifies scanning source files for dependencies, writing a dependency map to a file, then generating object code. Does not list system include files.
Specifies that work continue, despite errors in earlier files.
Specifies compiling only, no
linking.
Prevents precompiling based on filename extensions.
Specifies searching both user and system path lists, so that #include <...> is like
#include “...”
.
Specifies the filename or directory for output files or text. If the linker is called, specifies the output filename for the linker.
Specifies preprocessing and sending the output to a file, without
generating code.
Specifies generating a precompiled header from the source, writing the header to the specified file or putting the header in the specified directory. If this option does not specify a file or directory, the system derives a header filename from the source filename.
The alternative argument ““ specifies writing the header to the location that the source specifies.
Specifies preprocessing source files.
Specifies prefixing the specified text file or precompiled header onto all source files.
Specifies passing to all tools, disassembling and sending output to a file.
ColdFire Architectures v6.0 - Targeting Manual 187
CF.book Page 188 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.3 Command-Line Compiler Options ( continued)
Category
Front-End C/C++
Language
Option
-[no]stdinc
-U+ | -u[ndefine] name
-ansi keyword
off
on | relaxed
strict
-ARM on | off
-bool on | off
-char signed | unsigned
-Cpp_exceptions on|off
-dialect|-lang keyword
c
c++
ec++
-enum min | int
Purpose
Specifies standard system include paths, per
%MWCIncludes%
environment variable, adding them after all system -I paths.
(Default)
Undefines the specified symbol.
Specifies ANSI conformance, per keyword:
Same as -stdkeywords on, -enum min,
and -strict off. (Default)
Same as -stdkeywords off, -enum min,
and -strict on.
Same as -stdkeywords off, -enum int,
and -strict on.
Specifies checking code for ARM conformance. (Default is off.)
Enables the C++ bool type, true and false constants. (Default is off.)
Specifies sign of chars. (Default is unsigned
.)
Enables or disables C++ exceptions. (Default is on.)
Specifies source-language treatment per keyword:
Always treat source as C.
Always treat source as C++.
Generate warnings for C++ features outside
embedded C++ subset (implies dialect
cplus
).
Specifies minimum or int word size for enumeration types. (Default is int.)
188 ColdFire Architectures v6.0 - Targeting Manual
CF.book Page 189 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.3 Command-Line Compiler Options ( continued)
Category Option
-inline keyword
on|smart
none|off
auto
noauto
all
deferred
level=n
-[no]mapcr
-msext on | off
-[no]multibyte[aware]
-once
-pragma ...
-r[equireprotos]
-relax_pointers
-RTTI on | off
-som
-som_env_check
Purpose
Specifies inline options per keyword:
Turns on inlining for inline functions. (Default)
Turns off inlining.
Automatically inlines small functions, even
without inline specification.
No auto inlining. (Default)
Turns on aggressive inlining.
Defers inlining until the end of compilation;
permits inlining in two directions.
Inlines functions to n levels, 0--8. (0 means
-inline on
.)
Reverse maps for Macintosh MPW compatibility, so that \n==13 and \r==10.
Controls Microsoft VC++ extensions: redefining macros; XXX::yyy syntax for method yyy of class XXX; extra commas; ignoring casts to same type; treating as equal function types that have equivalent parameters lists but different types; pointerinteger conversions. (Default for non-x86 targets is off.),
Enables multi-byte character encodings for source text, comments, and strings.
Prevents processing header files a second time.
Defines a pragma for the compiler.
Requires prototypes.
Relaxes pointer type-checking rules.
Specifies runtime typing information for C++.
(Default is on.)
Enables Apple’s Direct-to SOM implementation.
Enables automatic SOM-environment and new-allocation checking; implies -som.
ColdFire Architectures v6.0 - Targeting Manual 189
CF.book Page 190 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.3 Command-Line Compiler Options ( continued)
Category
Optimizer
Option
-stdkeywords on | off
-str[ings] keyword[,...]
[no]reuse
[no]pool
-strict on | off
-trigraphs on | off
-wchar_t on | off
-O
-O+keyword[,...]
0
1
2
3
4
p
s
Purpose
Permits only standard keywords. (Default is off
.)
Specifies string-constant options per keywords:
Reuse strings; equivalent strings are same
object (Default)
Pool strings into a single data object.
Controls strict ANSI checking. (Default is off
.)
Controls recognition of trigraphs. (Default is off
.)
Controls treating wchar_t as a built-in C++ type. (Default is on.)
Same as -O2.
Specifies optimization level per keyword values:
Same as -opt off.
Same as -opt level=1.
Same as -opt level=2.
Same as -opt level=3.
Same as -opt level=4.
Same as -opt speed.
Same as -opt space.
(You can combine options, as in -O4,p.)
190 ColdFire Architectures v6.0 - Targeting Manual
CF.book Page 191 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.3 Command-Line Compiler Options ( continued)
Category Option
-opt keyword[,...]
off | none
on
all | full
[no]space
[no]speed
l[evel]=num
[no]cse |
[no]commonsubs
[no]deadcode
[no]deadstore
[no]lifetimes
[noloop[invariants]
[no]propagation
[no]strength
[no]dead
display | dump
Purpose
Specifies optimization level per keyword values:
Suppresses all optimizations. (Default)
Same as -opt level=2.
Same as -opt speed, level=4.
Optimize for space.
Optimize for speed.
Optimize by num level value:
0 — no optimizations (Default);
1 — global register allocation, peephole,
deadcode elimination;
2 — 1, plus common subexpression
elimination, copy propagation;
3 — 2, plus loop transformations, strength
reduction, loop-invariant code motion;
4 — 3, plus repeated common
subexpression elimination, in-depth
loop-invariant code motion.
Eliminate common subexpressions.
Remove dead code.
Remove dead assignments.
Compute variable lifetimes.
Remove loop invariants.
Propagate constant and copy assignments.
Optimize by strength reduction (using an
index variable to change multiplication to
addition).
Remove dead code and dead assignments.
Display complete list of active optimizations.
ColdFire Architectures v6.0 - Targeting Manual 191
CF.book Page 192 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.3 Command-Line Compiler Options ( continued)
Category
ColdFire
Option
-[no]a6
-abi keyword
standard
register
compact
-align keyword
mc68k
mc68k4byte
power[pc]
array[members]
-fp soft | hard
-intsize 2 | 4
-mb on | off
-model keyword[,...]
near
far
nearCode
farCode
nearData
farData
smartCode | codeSmart
-pcrelstrings
Purpose
Generate A6 stack frames for this tool.
(Default)
Specifies application-binary interface per keyword value:
Standard (MPW) ABI (Default).
Register ABI.
Compact ABI.
Specifies structure/array alignment per keyword value:
MC68K — 2 bytes unless field is 1 byte
(Default);
MC68K 4-byte — 4 bytes unless field is
smaller;
Power PC — align per field size;
Array — align per array members.
Specifies floating-point options: soft (the default) means generate calls to the software
FP emulation library; hard means generate
MC68881 FP instructions.
Specifies the number of bytes per integer.
(Default is 2.)
Specifies generating MacsBug information.
(Default is off.)
Specifies code and data-model generation options per keyword value:
16-bit references to code and data (Default);
32-bit references to code and data;
16-bit references to code (Default);
32-bit references to code;
16-bit references to data (Default);
32-bit references to data;
16- or 32-bit references to code, according to
called-routine visibility from current scope
or file.
Specifies putting string constants into code, generating PC-relative references for function addresses. Default is A5 or A4 register offsets.
192 ColdFire Architectures v6.0 - Targeting Manual
CF.book Page 193 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.3 Command-Line Compiler Options ( continued)
Category Option
-[no]pic
-[no]pid
-proc[essor] keyword
-sdata size
Purpose
Specifies generating position-independent code references.
Specifies generating position-independent data references.
Specifies target processor by keyword. Values are 68020, 68328, 68349, CPU32,
MCF5206e
, MCF5307, MCF5407, MCF5272,
MCF457x
, and MCF5213.
Specifies placing objects smaller than size bytes in the small-data (.sdata) section.
Default size value in 0.
ColdFire Architectures v6.0 - Targeting Manual 193
CF.book Page 194 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.3 Command-Line Compiler Options ( continued)
Category
C/C++ Warnings
Option
-w[arn[ings]] keyword[,...]
off
on
[no]cmdline
[no]err[or] |
[no]iserr[or]
all
[no]pragmas |
[no]illpragmas
[no]empty[decl]
[no]possible |
[no]unwanted
[no]unusedarg
[no]unusedvar
[no]unused
[no]extracomma |
[no]comma
[no]pedantic |
[no]extended
[no]hidevirtual |
[no]hidden[virtual]
[no]implicit[conv]
Purpose
Specifies warnings per keyword value:
Passes to all tools; turns off warnings.
Passes to all tools; turns on most warnings.
Passes to all tools; command-line driver/
parser warnings.
Passes to all tools; treats warnings as errors.
Turns on all warnings, requires prototypes.
Controls inappropriate-pragma warnings.
Controls empty-declaration warnings.
Controls warnings about possible unwanted
side effects.
Controls unused-argument warnings.
Controls unused-variable warnings.
Controls unused-arguments and unused-
variable warnings.
Controls extra-comma warnings.
Controls pedantic error-checking
warnings.
Controls hidden virtual-function warnings.
[no]notinlined
[no]largeargs
[no]structclass
[no]padding
[no]notused
[no]unusedexpr
display | dump
Controls implicit-arithmetic-conversion
warnings.
Controls warnings about inline functions
not inlined.
Controls warnings about passing large
arguments to unprototyped functions.
Controls warnings about inconsistent class,
struct use.
Controls warnings about padding added
between struct members.
Controls warnings about non-use of a non-
void-returning function.
Controls warnings about using expressions
as statements without side effects.
Displays list of active warnings.
Linker Options
Table 13.4 lists the options of the command-line linker.
194 ColdFire Architectures v6.0 - Targeting Manual
CF.book Page 195 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.4 Command-Line Linker Options
Category
General
Option
-help [keyword[,...]]
all
group=keyword
[no]compatible
[no]deprecated
[no]ignored
[no]normal
[no]obsolete
[no]spaces
search=keyword
usage
-maxerrors max
-maxwarnings max
-msgstyle keyword
gcc
IDE
mpw
parseable
std
-progress
-search
-[no]stderr
-timing
-v[erbose]
-version
-[no]wraplines
Purpose
Displays help information per keyword values:
All standard options.
All groups that include keyword.
Compatibility options.
Deprecated options.
Ignored options.
Only standard options.
Obsolete options.
Inserts blank lines between options.
All options that include keyword.
Usage information.
Specifies the maximum number of error messages to print. 0 (the default) means no maximum. (Not global)
Specifies the maximum number of warnings to print. 0 (the default) means no maximum. (Not global)
Sets message style per keyword value:
Use GCC-like style.
Use CodeWarrior IDE-like style.
Use MPW style.
Use context-free, machine-parseable style.
Use standard style (default).
Shows progress and version.
Searches access paths for source, object, or library files that the command line specifies.
Specifies separate stderr, stdout streams; if -nostderr is in effect, stderr goes to stdout
.
Collects timing statistics.
Specifies cumulative, verbose information; implies -progress.
Shows tool version, configuration, and build date.
Specifies message word wrapping.
ColdFire Architectures v6.0 - Targeting Manual 195
CF.book Page 196 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.4 Command-Line Linker Options ( continued)
Category
Linker
ELF Linker
Option
-dis[assemble]
-L+ | -l path
-lr
-l+file
-nodefaults
-[no]fail
-[no]stdlib
-S
-[no]dead[strip]
-force_active symbol[,...]
-keep[local] on | off
-m[ain] symbol
Purpose
Specifies disassembling object code without linking; implies -nostdlib.
Adds specified library search path. (Default is to search working directory then system directories. Search paths have global scope over the command line; searching follows path order in the command line.
Adds a recursive library search path.
Adds a library before system libraries, searching for lib<file>.<ext>, where
<ext>
is the typical library extension.l
Same as -[no]stdlib. (Default)
Specifies continuing importing or disassembling, despite errors in earlier files.
Specifies using system-library access paths
(per %MWLibraries% environment variable), adding system libraries (per
%MWLibrariesFiles%
environment variable). (Default)
Specifies disassembling and sending output to a file, without
linking. Implies -nostdlib.
Controls deadstripping of unused code.
(Default)
Specifies a list of symbols as undefined; useful to force linking of static libraries.
Controls keeping relocations and output segment names generated during the link as local symbols. (Default is on.)
Sets the main entry point for the application or shared library. Maximum symbol length is 63 characters. The symbol value ““ specifies no entry point.
196 ColdFire Architectures v6.0 - Targeting Manual
CF.book Page 197 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.4 Command-Line Linker Options ( continued)
Category
ColdFire
Option
-map [keyword[,...]]
closure
unused
-srec
-sreceol keyword
mac
dos
unix
-sreclength length
-o file
-application
-library
-[no]pic
-[no]pid
-proc[essor] keyword
_shared
Purpose
Specifies generating a link map file, per keyword values:
Calculates symbol closures.
Lists unused symbols.
Specifies generating an S-record file. (The linker ignores this option if it generates static libraries.)
Sets the end-of-line separator style for the Srecord file, per the keyword value:
Macintosh: \r.
DOS: \r\n. (Default).
Unix: \n.
(This option implies -srec.)
Specifies the length of S-records. Length value range is 8 — 252, but must be a multiple of 4. Default length is 64.
Specifies name of the output file.
Specifies generating an application. (Default)
Specifies generating a static library.
Specifies generating position-independent code references.
Specifies generating position-independent data references. (Default)
Specifies target processor by keyword. Values are 68020, 68328, 68349, CPU32,
MCF5206e
, MCF5307, MCF5407, MCF5272, and MCF457x
Specifies generating a shared library.
ColdFire Architectures v6.0 - Targeting Manual 197
CF.book Page 198 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.4 Command-Line Linker Options ( continued)
Category
Debugging Control
Option
-g
-sym keyword[,...]
off
on
Purpose
Specifies generating debugging information; same as -sym on.
Specifies debugging options, per keyword values:
Do not generate debugging information.
(Default)
Generate debugging information.
198 ColdFire Architectures v6.0 - Targeting Manual
CF.book Page 199 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Table 13.4 Command-Line Linker Options ( continued)
Category
Warning
Option
-w[arn[ings]] keyword[,...]
off
on
[no]cmdline
[no]err[or] |
[no]iserr[or]
display | dump
Purpose
Specifies warnings per keyword value:
Turns off warnings.
Turns on all warnings.
Controls command-line parser warnings.
Treats warnings as errors.
ELF Disassembler -show keyword[,...]
only
none
all
[no]code | [no] text
[no]comments
[no]extended
[no]data
[no] debug | [no] sym
[no]exceptions
[no]headers
[no]hex
[no]names
[no]relocs
[no]source
[no]xtables
[no]verbose
Displays list of active warnings.
Specifies disassembly options, per keyword values:
Restricts display, as in -show only code.
Prevents display.
Displays everything. (Default)
Controls display of code of code or text
sections.
Controls display of comment field in code;
implies -show code.
Controls display of extended mnemonics;
implies -show code.
Controls display of data; with -show
verbose
, shows hex dumps of sections.
Controls display of symbolics information.
(Default)
Controls display of exception tables; implies
-show data.
Controls display of ELF headers.
Controls display of addresses and opcodes
in code disassembly; implies -show code.
Controls display of symbol table. (Default)
Controls display of resolved relocations in
code and relocation tables (Default)
Controls display of 4 source lines around
each function in disassembly; implies
-show code. (Default)
With -show verbose, controls display of
entire source file in output.
Controls display of exception tables.
Controls display of verbose information,
including hex dump of program segments,
in applications. (Default)
ColdFire Architectures v6.0 - Targeting Manual 199
CF.book Page 200 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
Data Auto-Alignment
If you assemble with alignment enabled, the assembler automatically aligns data items on a natural boundary for the data size, and for the target processor family. The ColdFire assembler follows this scheme:
• 8-bit items (.byte directive) — No alignment needed.
• 16-bit items (.word directive)— Aligned to a16-bit (even address) boundary.
• 32-bit items (such as the .long directive) — Also aligned to 16-bit boundary.
The ColdFire assembler is unusual, using a 16-bit natural boundary for 32-bit quantities.
(This is for compatibility with the inherited 680x0 interpretation.) Consider the Listing
Listing 13.4 Auto-Alignment Example
b1: l1: b2: l2:
.data
.globl
b1,l1,b2,l2
.byte
.long
0xab
0x12345678
.byte
0xcd
;; <-- label "l2" on different line to directive
.long
0x87654321
This assembles to this sequence of bytes:
0x00000000: ab 00
0x00000002: 12 34
0x00000004: 56 79
0x00000006: cd 00
0x00000008: 87 65
0x0000000a: 43 21 in which the two 0x00 bytes are padding the assembler added, to make sure that the 32bit, .long items are at even addresses.
The example also demonstrates an important subtlety shown by the addresses of the symbols created for the labels: b1: 0x00000000 l1: 0x00000002 b2: 0x00000006 l2: 0x00000007
As the example code had the labels b1, l1 and b2 on the same line as their data directives, these labels are directly attached to the data items. This means that the autoalignment also applies to the labels. Accordingly, the symbol l1 refers to the address of the 32-bit data item after the 0x00 padding byte.
200 ColdFire Architectures v6.0 - Targeting Manual
CF.book Page 201 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
But the example code had label l2 on a line by itself, so it is not attached to the data item given by the next line’s directive. So the symbol l2 is attached to the value of the location
counter before auto-alignment of the following item: l2 refers to the address of the 0x00 padding byte.
The assembler does not use unique flags for each processor; some flag values specify versions of the core. Examples are:
• ColdFire version 2 core — 0x400
• ColdFire version 3 core — 0x800
• ColdFire version 4 core — 0x1000
The assembler has extra flags for ColdFire MAC and EMAC extensions:
Other flag issues are:
• You can combine flag values, so that 0x100800 denotes a version 3 core with
MAC instructions.
• For ColdFire processor numbers, the second digit indicates the core number, so that
5307 has a version-3 core.
• An alternative to command-line processor specification is using the .option directive in the source file:
• MAC instructions — 0x100000
• EMAC instructions — 0x200000
.option processor AAA where AAA is name of processor, such as MCF5282, MCF5307, MCF5407, or
MCF547x
. This is a friendlier wrapping for the numeric processor flags. The system internally maps each processor name to one of the version v2, v3 or v4 cores.
ColdFire Architectures v6.0 - Targeting Manual 201
CF.book Page 202 Friday, July 8, 2005 8:59 AM
Command-Line Tools
Compiling and Linking
202 ColdFire Architectures v6.0 - Targeting Manual
Stáhnout
Reklama