Skip to main content

IAR Embedded Workbench for RL78 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).

__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.

__CODE_MODEL__

Identifies the setting of the option --code_model, either __CODE_MODEL_NEAR__ or __CODE_MODEL_FAR__.

__CORE__

Identifies the setting of the --core option and is defined to __S1__, __S2__, or __S3__. These symbolic names can be used when testing the __CORE__ symbol. For backward compatibility, this symbol can also be tested against the values __RL78_0__, __RL78_1__, and __RL78_2__.

__DATA_MODEL__

Identifies the setting of the option --data_model, either __DATA_MODEL_NEAR__, __DATA_MODEL_FAR__ or __DATA_MODEL_HUGE__.

__DATE__

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

__FILE__

The name of the current source file (string).

__IAR_SYSTEMS_ASM__

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

__IASMRL78__

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

__LINE__

The current source line number (number).

__SUBVERSION__

An integer that identifies the version letter of the assembler version number, for example the C in 4.21C, as an ASCII character.

__TIME__

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

__USE_FAR_RT_CALLS__

An integer that is set to 1 when the ‑‑generate_far_runtime_library_calls option is used.

__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  printString
       public  printTime
       section CODE:CODE
       data8                          ; select data model
timdat DC8    __TIME__,",",__DATE__,0 ; timd for big-endian
       code
printTime:
       MOVW    AX,#timdat             ; load address of string
       CALL    printString            ; routine to print string
       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.