3.1. Command syntax

This section relates only to armasm. The inline assemblers are part of the C and C++ compilers, and have no command syntax of their own.

The armasm command line is case-insensitive, except in filenames, and where specified.

Invoke the ARM assembler using this command:

armasm Space[ -16 | Space -32]Space[-apcsSpace[ none | Space [/qualifier[/qualifier[...]]]]]Space [ -bigend | Space -littleend]Space[-checkreglist]Space[-cpuSpace cpu]Space[-Space dependSpace{dependfile} | Space -m | Space -md]Space[-errorsSpace{errorfile}]Space[-fpu name]Space[-g]Space[-help]Space[-iSpace{dir}Space[,dir]...]Space[-keep]Space[-listSpace[listingfile]Space[options]]Space[-maxcacheSpace{n}]Space[-memaccess Space attributes]Space[-nocache]Space[-noesc]Space[-noregs]Space[-nowarn]Space[-oSpace{filename}]Space[-predefineSpace{"directive}"]Space[-split_ldm]Space[-unsafe]Space[-viaSpace{file}]Space{inputfile}

where:

-16

instructs the assembler to interpret instructions as Thumb instructions. This is equivalent to a CODE16 directive at the head of the source file.

-32

instructs the assembler to interpret instructions as ARM instructions. This is the default.

-apcsnone[/qualifier[/qualifier[...]]]

specifies whether you are using the ARM/Thumb Procedure Call Standard (ATPCS). It can also specify some attributes of code sections. See ADS Developer Guide for more information about the ATPCS.

/none

specifies that inputfile does not use ATPCS. ATPCS registers are not set up. Qualifiers are not allowed.

Note

ATPCS qualifiers do not affect the code produced by the assembler. They are an assertion by the programmer that the code in inputfile complies with a particular variant of ATPCS. They cause attributes to be set in the object file produced by the assembler. The linker uses these attributes to check compatibility of files, and to select appropriate library variants.

Values for qualifier are:

/interwork

specifies that the code in inputfile is suitable for ARM/Thumb interworking. See ADS Developer Guide for information on interworking.

/nointerwork

specifies that the code in inputfile is not suitable for ARM/Thumb interworking. This is the default.

/ropi

specifies that the content of inputfile is read-only position-independent. The default is /noropi.

/pic

is a synonym for /ropi.

/nopic

is a synonym for /noropi.

/rwpi

specifies that the content of inputfile is read-write position-independent. The default is /norwpi.

/pid

is a synonym for /rwpi.

/nopid

is a synonym for /norwpi.

/swstackcheck

specifies that the code in inputfile carries out software stack-limit checking.

/noswstackcheck

specifies that the code in inputfile does not carry out software stack-limit checking. This is the default.

/swstna

specifies that the code in inputfile is compatible both with code which carries out stack-limit checking, and with code that does not carry out stack-limit checking.

-bigend

instructs the assembler to assemble code suitable for a big-endian ARM. The default is -littleend.

-littleend

instructs the assembler to assemble code suitable for a little-endian ARM.

-checkreglist

instructs the assembler to check RLIST, LDM, and STM register lists to ensure that all registers are provided in increasing register number order. A warning is given if registers are not listed in order.

-cpu cpu

sets the target CPU. Some instructions produce either errors or warnings if assembled for the wrong target CPU (see also the -unsafe assembler option). Valid values for cpu are architecture names such as 3, 4T, or 5TE, or part numbers such as ARM7TDMI®. See ARM Architecture Reference Manual for information about the architectures. The default is ARM7TDMI.

-depend dependfile

instructs the assembler to save source file dependency lists to dependfile. These are suitable for use with make utilities.

-m

instructs the assembler to write source file dependency lists to stdout.

-md

instructs the assembler to write source file dependency lists to inputfile.d.

-errors errorfile

instructs the assembler to output error messages to errorfile.

-fpu name

this option selects the target floating-point unit (FPU) architecture. If you specify this option it overrides any implicit FPU set by the -cpu option. Floating-point instructions produce either errors or warnings if assembled for the wrong target FPU.

The assembler sets a build attribute corresponding to name in the object file. The linker determines compatibility between object files, and selection of libraries, accordingly.

The assembler sets a build attribute corresponding to name in the object file. The linker determines compatibility between object files, and selection of libraries, accordingly.

Valid options are:

none

Selects no floating-point option. This makes your assembled object file compatible with any other object file.

vfp

This is a synonym for -fpu vfpv1.

vfpv1

Selects hardware vector floating-point unit conforming to architecture VFPv1.

vfpv2

Selects hardware vector floating-point unit conforming to architecture VFPv2.

fpa

Selects hardware Floating Point Accelerator.

softvfp+vfp

Selects hardware Vector Floating Point unit.

To armasm, this is identical to -fpu vfpv1. See the C and C++ Compilers chapter in ADS Compilers and Libraries Guide for details of the effect on software library selection at link time.

softvfp

Selects software floating-point library (FPLib) with pure-endian doubles. This is the default if no -fpu option is specified.

softfpa

Selects software floating-point library with mixed-endian doubles.

-g

instructs the assembler to generate DWARF2 debug tables. For backwards compatibility, the following command line option is permitted, but not required:

-dwarf2

-help

instructs the assembler to display a summary of the assembler command-line options.

-idir,dir

adds directories to the source file search path so that arguments to GET, INCLUDE, or INCBIN directives do not need to be fully qualified (see GET or INCLUDE).

-keep

instructs the assembler to keep local labels in the symbol table of the object file, for use by the debugger (see KEEP).

-listlistingfileoptions

instructs the assembler to output a detailed listing of the assembly language produced by the assembler to listingfile. If - is given as listingfile, listing is sent to stdout. If no listingfile is given, listing is sent to inputfile.lst.

Use the following command-line options to control the behavior of -list:

-noterse

turns the terse flag off. When this option is on, lines skipped due to conditional assembly do not appear in the listing. If the terse option is off, these lines do appear in the listing. The default is on.

-width

sets the listing page width. The default is 79 characters.

-length

sets the listing page length. Length zero means an unpaged listing. The default is 66 lines.

-xref

instructs the assembler to list cross-referencing information on symbols, including where they were defined and where they were used, both inside and outside macros. The default is off.

-maxcache n

sets the maximum source cache size to n. The default is 8MB.

-memaccess attributes

Specifies memory access attributes of the target memory system. The default is to allow aligned loads and saves of bytes, halfwords and words. attributes modify the default. They can be any one of the following:

+L41

Allow unaligned LDRs.

-L22

Disallow halfword loads.

-S22

Disallow halfword stores.

-L22-S22

Disallow halfword loads and stores.

-nocache

turns off source caching. By default the assembler caches source files on the first pass and reads them from memory on the second pass.

-noesc

instructs the assembler to ignore C-style escaped special characters, such as \n and \t.

-noregs

instructs the assembler not to predefine register names. See Predefined register and coprocessor names for a list of predefined register names.

-nowarn

turns off warning messages.

-o filename

names the output object file. If this option is not specified, the assembler uses the second command-line argument that is not a valid command-line option as the name of the output file. If there is no such argument, the assembler creates an object filename of the form inputfilename.o.

-predefine "directive"

instructs the assembler to pre-execute one of the SET directives. You must enclose directive in quotes. See SETA, SETL, and SETS. The assembler executes a corresponding GBLL, GBLS, or GBLA directive to define the variable before setting its value.

The variable name is case-sensitive.

Note

The command line interface of your system might require you to enter special character combinations, such as \”, to include strings in directive. Alternatively, you can use -via file to include a -predefine argument. The command line interface does not alter arguments from -via files.

-split_ldm

This option instructs the assembler to fault LDM and STM instructions if the maximum number of registers transferred exceeds:

  • five, for all STMs, and for LDMs that do not load the PC

  • four, for LDMs that load the PC.

Avoiding large multiple register transfers can reduce interrupt latency on ARM systems that:

  • do not have a cache or a write buffer (for example, a cacheless ARM7TDMI)

  • use zero wait-state, 32-bit memory.

Note

Avoiding large multiple register transfers increases code size and decreases performance slightly.

Avoiding large multiple register transfers has no significant benefit for cached systems or processors with a write buffer.

Avoiding large multiple register transfers also has no benefit for systems without zero wait-state memory, or for systems with slow peripheral devices. Interrupt latency in such systems is determined by the number of cycles required for the slowest memory or peripheral access. This is typically much greater than the latency introduced by multiple register transfers.

-unsafe

allows assembly of a file containing instructions that are not available on the specified architecture and processor. It changes corresponding error messages to warning messages. It also suppresses warnings about operator precedence (see Binary operators).

-via file

instructs the assembler to open file and read in command-line arguments to the assembler. For further information see the Via File Syntax appendix in ADS Compilers and Libraries Guide.

inputfile

specifies the input file for the assembler. Input files must be ARM or Thumb assembly language source files.

Copyright © 2000, 2001 ARM Limited. All rights reserved.ARM DUI 0068B
Non-Confidential