Skip to main content

IAR Embedded Workbench for Arm 9.70.x

External interface details

In this section:

You can use the assembler either from the IAR Embedded Workbench IDE or from the command line. Refer to the IDE Project Management and Building documentation for information about using the assembler from the IAR Embedded Workbench IDE.

Assembler invocation syntax

The invocation syntax for the assembler is:

iasmarm [options][sourcefile][options]

For example, when assembling the source file prog.s, use this command to generate an object file with debug information:

iasmarm prog -r

By default, the IAR Assembler for Arm recognizes the filename extensions s, asm, and msa for source files. The default filename extension for assembler output is o.

Generally, the order of options on the command line, both relative to each other and to the source filename, is not significant. However, there is one exception—when you use the -I option—the directories are searched in the same order that they are specified on the command line.

If you run the assembler from the command line without any arguments, the assembler version number and all available options, including brief descriptions, are directed to stdout and displayed on the screen.

Passing options

You can pass options to the assembler in three different ways:

  • Directly from the command line

    Specify the options on the command line after the iasmarm command, see Assembler invocation syntax.

  • Via environment variables

    The assembler automatically appends the value of the environment variables to every command line, so it provides a convenient method of specifying options that are required for every assembly, see Environment variables.

  • Via a text file by using the -f option, see -f.

For general guidelines for the option syntax, an options summary, and more information about each option, see Assembler options.

Environment variables

You can use these environment variables with the IAR Assembler:

Environment variable

Description

IASMARM

Specifies command line options, for example:

set IASMARM=-L -ws
          

IASMARM_INC

Specifies directories to search for include files, for example:

set IASMARM_INC=c:\myinc\
Table 133. Assembler environment variables


For example, setting this environment variable always generates a list file with the name temp.lst:

set IASMARM=-l temp.lst

For information about the environment variables used by the compiler and linker, see Environment variables.

Error return codes

When using the IAR Assembler from within a batch file, you might have to determine whether the assembly was successful to decide what step to take next. For this reason, the assembler returns these error return codes:

Return code

Description

0

Assembly successful, warnings might appear.

1

Warnings occurred (only if the -ws option is used).

2

Errors occurred.

3

Fatal errors occurred (making the assembler abort).

Table 134. Assembler error return codes