Specifications

CAVR-4
78
Checking module consistency
AVR® IAR C/C++ Compiler
Reference Guide
Example
In the following table, the object files could (but do not have to) define the two runtime
attributes
color and taste. In this case, file1 cannot be linked with any of the other
files, since the runtime attribute color does not match. Also, file4 and file5 cannot
be linked together, because the taste runtime attribute does not match.
On the other hand,
file2 and file3 can be linked with each other, and with either
file4 or file5, but not with both.
USING RUNTIME MODEL ATTRIBUTES
Runtime model attributes can be specified in your C/C++ source code to ensure module
consistency with other object files by using the #pragma rtmodel directive. For
example:
#pragma rtmodel="__rt_version", "1"
For detailed syntax information, see #pragma rtmodel, page 223.
Runtime model attributes can also be specified in your assembler source code by using
the RTMODEL assembler directive. For example:
RTMODEL "color", "red"
For detailed syntax information, see the AVR® IAR Assembler Reference Guide.
Note: The predefined runtime attributes all start with two underscores. Any attribute
names you specify yourself should not contain two initial underscores in the name, to
eliminate any risk that they will conflict with future IAR runtime attribute names.
At link time, the IAR XLINK Linker checks module consistency by ensuring that
modules with conflicting runtime attributes will not be used together. If conflicts are
detected, an error is issued.
Object file Color Taste
file1 blue not defined
file2 red not defined
file3 red *
file4 red spicy
file5 red lean
Table 24: Example of runtime model attributes