Skip to main content

IAR Embedded Workbench for RX 5.20

Predefined symbols

In this section:

These predefined symbols are available:

Symbol

Value

__BASE_FILE__

The name of the base source file being assembled (string).

__BIG_ENDIAN__

An integer that identifies the setting of the option --endian. If --endian=b has been specified, the value of this symbol is defined to 1 (TRUE). If --endian=l has been specified, the value of this symbol is defined to 0 (FALSE).

__BUILD_NUMBER__

A unique integer that identifies the build number of the assembler currently in use. The build number does not necessarily increase with an assembler that is released later.

__CORE__

An integer that identifies the chip core in use. The value reflects the setting of the --core option and is defined to 1 for the RXv1 architecture. 2 for the RXv2 architecture, or 3 for the RXv3 architecture.

__DATA_MODEL__

An integer that identifies the data model in use. The symbol reflects the --data_model option and can be defined to __NEAR__, __FAR__, or __HUGE__.

__DATE__

The current date in dd/Mmm/yyyy format (string).

__DOUBLE__

Either 32 or 64, depending on the setting of the option --double.

__FPU__

An integer that is set to 1 when the code is assembled with support for a hardware floating-point unit, and to 0 otherwise.

__FILE__

The name of the current source file (string).

__IAR_SYSTEMS_ASM__

IAR assembler identifier (number). The current value is 8. Note that the number could be higher in a future version of the product. This symbol can be tested with #ifdef to detect whether the code was assembled by an assembler from IAR.

__IASMRX__

An integer that is set to 1 when the code is assembled with the IAR Assembler for RX.

__INTSIZE__

Either 16 or 32, depending on the setting of the option --int.

__LINE__

The current source line number (number).

__LITTLE_ENDIAN__

An integer that identifies the setting of the option --endian. If --endian=l has been specified, the value of this symbol is defined to 1 (TRUE). If --endian=b has been specified, the value of this symbol is defined to 0 (FALSE).

__TIME__

The current time in hh:mm:ss format (string).

__VER__

The version number in integer format; for example, version 4.17 is returned as 417 (number).

Table 118. Predefined symbols


Including symbol values in code

Several data definition directives make it possible to include a symbol value in the code. These directives define values or reserve memory. To include a symbol value in the code, use the symbol in the appropriate data definition directive.

For example, to include the time of assembly as a string for the program to display:

            name    timeOfAssembly
            extern  printStr
            public  printTime
            section CODE:CODE
            data8             ; select data mode
                              ; (required for big-endian)
time:       dc8 __TIME__      ; String representing the
                              ; time of assembly.
            code              ; select code mode
                              ; (required for big-endian)
printTime:
            mov.l #time,R1    ; Load address of time
                              ; string in R1.
            bsr printStr      ; Call string output routine.
            end
Testing symbols for conditional assembly

To test a symbol at assembly time, use one of the conditional assembly directives. These directives let you control the assembly process at assembly time.

For example, if you want to assemble separate code sections depending on whether you are using an old assembler version or a new assembler version, do as follows:

#if (__VER__ > 300)                 ; New assembler version
;…
;…
#else                               ; Old assembler version
;…
;…
#endif

For more information, see Conditional assembly directives.