Call definitions

Variables names are not transformed in any way, except those with the names r0 to r15. For these a '_' is prepended to the name. Aliasing a declaration (int A asm("M");) will not change the alias. If "M "is specified as a direct address (see the SFR definitions for example), GCC will not 'globalize' the symbol. So, you can include these 'address' definitions in any header file.

Each function call starts with a function prologue. The prologue pushes caller used registers (r4-r11, or r4-r15 for interrupt functions) onto the stack. The stack pointer is then adjusted by subtracting the frame size from r1. Naked functions do not issue a prologue. The 'interrupt' attribute forces all registers used within the function to be saved on the stack.

In every function definition

.L__FrameSize_[function name]=[frame size]

is defined. For example:

main:
.L__FrameSize_main=0x12

It can be used as an immediate variable in in line assembly code. For example
__asm__ __volatile__("bic #0xf0, .L__FrameSize_main(r1)"::);
is similar to using the _BIC_SR_IRQ function.

Every function call ends with a function epilogue. Here, the stack pointer is adjusted by adding the frame size to r1. The registers save registers are the popped from the stack. The function then returns. Normal functions just issue a "ret" instruction. Functions with the interrupt attribute issue a "reti" instruction. For wake-up interrupts the sequence:

bic #0xf0,0(r1) 
reti
is used.

The function "main" is handled specially: