- IAR Embedded Workbench for Arm 9.70.x
- IAR Assembler
- Assembler directives
- Description of assembler directives
- Assembler control directives
Assembler control directives
Syntax
$filename
/* comment */
// comment
CASEOFF
CASEON
INCLUDE filename
LTORG
RADIX expr
Parameters
| Comment ignored by the assembler. |
| Default base—default 10 (decimal). |
| Name of file to be included. The |
Description
These directives provide control over the operation of the assembler. For information about the restrictions that apply when using a directive in an expression, see Expression restrictions.
Directive | Description | Expression restrictions |
|---|---|---|
Includes a file. | ||
C-style comment delimiter. | ||
C++ style comment delimiter. | ||
Disables case sensitivity. | ||
Enables case sensitivity. | ||
Includes a file. | ||
Directs the current literal pool to be assembled immediately after the directive. | ||
Sets the default base on all numeric values. | No forward references No external references Absolute Fixed |
Use $ to insert the contents of a file into the source file at a specified point. $filename is an alias for #include "filename", see the section Including source files under C-style preprocessor directives. The $ character must be the first character on the line.
Use /*...*/ to comment sections of the assembler listing.
Use // to mark the rest of the line as comment.
Use INCLUDE to insert the contents of a file into the source file at a specified point. INCLUDE filename is an alias for #include <filename>, see the section Including source files under C-style preprocessor directives. Note that INCLUDE only searches in the system header directories.
Use LTORG to direct where the current literal pool is to be assembled. By default, this is performed at every END and RSEG directive. For an example, see LDR (ARM).
Use RADIX to set the default base for constants. The default base is 10.
Controlling case sensitivity
Use CASEON or CASEOFF to turn case sensitivity on or off for user-defined symbols. By default, case sensitivity is off.
When CASEOFF is active all symbols are stored in upper case, and all symbols used by ilink should be written in upper case in the ilink definition file.
When CASEOFF is set, label and LABEL are identical in this example:
module caseSensitivity1
section MYCODE:CODE(2)
caseoff
label nop ; Stored as "LABEL".
b LABEL
endThe following will generate a duplicate label error:
module caseSensitivity2
caseoff
label nop ; Stored as "LABEL".
LABEL nop ; Error, "LABEL" already defined.
endIncluding a source file
This example uses $ to include a file defining macros into the source file. For example, these macros could be defined in Macros.inc:
; Exchange registers a and b.
; Use register c for temporary storage.
xch macro a,b,c
movs c,a
movs a,b
movs b,c
endmThe macro definitions can be included with a $ directive, as in:
name includeFile
section MYCODE:CODE(2)
; Standard macro definitions.
$Macros.inc
xchRegs xch r0,r1,r2
bx lr
endDefining comments
This example shows how /*...*/ can be used for a multi-line comment:
/* Program to read serial input. Version 1: 19.2.11 Author: mjp */
See also the section Comments in C-style preprocessor directives under C-style preprocessor directives.
Changing the base
To set the default base to 16:
module radix
section MYCODE:CODE(2)
radix 16 ; With the default base set
movs r0,#12 ; to 16, the immediate value
;... ; of the mov instruction is
; interpreted as 0x12.
; To reset the base from 16 to 10 again, the argument must be
; written in hexadecimal format.
radix 0x0a ; Reset the default base to 10.
movs r0,#12 ; Now, the immediate value of
;... ; the mov instruction is
; interpreted as 0x0c.
end