Atmel CAVR-4 Manual De Usuario

Descargar
Página de 323
CAVR-4
Part 2. Compiler reference
Pragma directives
223
#pragma required
#pragma required=symbol
Use the 
#pragma
 
required
 directive to ensure that a symbol which is needed by 
another symbol is present in the linked output. The 
symbol
 can be any statically linked 
function or variable, and the pragma directive must be placed immediately before a 
symbol definition.
Use the directive if the requirement for a symbol is not otherwise visible in the 
application, for example if a variable is only referenced indirectly through the segment 
it resides in.
Example
void * const myvar_entry @ "MYSEG" = &myvar;
...
#pragma required=myvar_entry
long myvar;
#pragma rtmodel
#pragma rtmodel="key","value"
Use the 
#pragma
 
rtmodel
 directive to add a runtime model attribute to a module. Use 
a text string to specify 
key
 and 
value.
This pragma directive is useful to enforce consistency between modules. All modules 
that are linked together and define the same runtime attribute key must have the same 
value for the corresponding key value, or the special value 
*
. Using the special value 
*
 
is equivalent to not defining the attribute at all. It can, however, be useful to state 
explicitly that the module can handle any runtime model.
A module can have several runtime model definitions.
Note: The predefined compiler runtime model attributes start with a double underscore. 
In order to avoid confusion, this style must not be used in the user-defined attributes. 
Example
#pragma rtmodel="I2C","ENABLED"
The linker will generate an error if a module that contains this definition is linked with 
a module that does not have the corresponding runtime model attributes defined.
For more information about runtime model attributes and module consistency, see 
Checking module consistency, page 77.