Skip to main content

IAR Embedded Workbench for RH850 3.20.x

Predefined symbols

In this section:

The IAR Assembler for RH850 defines a set of symbols for use in assembler source files. The symbols provide information about the current assembly, allowing you to test them in preprocessor directives or include them in the assembled code.

These predefined symbols are available:

Symbol

Value

__IASMRH850__

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

__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 processor core in use. It is defined to __CORE_G3K__, __CORE_G3KH__, __CORE_G3M__, __CORE_G3MH__, or __CORE_G4MH__. For portability reasons, these definitions also exist: __CORE_V850__, __CORE_V850E__, __CORE_V850E2__, __CORE_V850E2M__, __CORE_V850E2S__ and __CORE_V850E2H__.

__CODE_MODEL__

An integer that identifies the code model in use. The symbol reflects the --code_model option and can be defined to __CODE_MODEL_NORMAL__, __CODE_MODEL_PIC__ (for backward compatibility), or __CODE_MODEL_LARGE__ (for backward compatibility).

__DATA_MODEL__

An integer that identifies the data model in use. The symbol reflects the --data_model option and can be defined to __DATA_MODEL_SMALL__, __DATA_MODEL_MEDIUM__, __DATA_MODEL_LARGE__, or __DATA_MODEL_TINY__ (for backward compatibility).

__DATE__

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

__FILE__

The name of the current source file (string).

__FPU__

The symbol reflects the --fpu option and is defined to __FPU_NONE__, __FPU_SINGLE__, or __FPU_DOUBLE__. If this symbol is defined to __FPU_NONE__, an error message will be emitted if FPU instructions are used. If the symbol is defined to __FPU_SINGLE__, an error message will be emitted if double-precision FPU instructions are used.

__IAR_SYSTEMS_ASM__

IAR assembler identifier (number). The current value is 9. 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 Systems.

__LINE__

The current source line number (number).

__SUBVERSION__

An integer that identifies the subversion number of the assembler version number, for example 3 in 1.2.3.4.

__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 117. 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
        section .text:CODE(2)
        extern  printStr
        code
time:   dc8         __TIME__        ; String representing the
                                    ; time of assembly.
        align       1
        mov         time,r6         ; Load address of time
                                    ; string in r6.
        jarl        printStr,lp     ; 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.