Specifications
CAVR-4
32
Special function types
AVR® IAR C/C++ Compiler
Reference Guide
void f()
{
static long next_stop = 100;
extern void do_stuff();
long tick;
/* A critical block */
{
Mutex m;
/* Read volatile variable 'tick_count' in a safe way
and put the value in a local variable */
tick = tick_count;
}
if (tick >= next_stop)
{
next_stop += 100;
do_stuff();
}
}
C++ AND SPECIAL FUNCTION TYPES
C++ member functions can be declared using special function types. However, the
following restriction apply:
Interrupt member functions must be static. When calling a non-static member
function, it must be applied to an object. When an interrupt occurs and the interrupt
function is called, there is no such object available.
FUNCTION DIRECTIVES
Note: This type of directives are primarily intended to support static overlay, a feature
which is useful in some smaller microcontrollers. The AVR IAR C/C++ Compiler does
not use static overlay, as it has no use for it.
The function directives
FUNCTION, ARGFRAME, LOCFRAME, and FUNCALL are generated
by the AVR IAR C/C++ Compiler to pass information about functions and function calls
to the IAR XLINK Linker. These directives can be seen if you use the compiler option
Assembler file (
-lA) to create an assembler list file.
For reference information about the function directives, see the AVR® IAR Assembler
Reference Guide.