|mspgcc: A port of the GNU tools to the Texas Instruments MSP430 microcontrollers|
|<<< Previous||mspgcc's ABI||Next >>>|
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.
is defined. For example:
.L__FrameSize_[function name]=[frame size]
It can be used as an immediate variable in in line assembly code. For example
__asm__ __volatile__("bic #0xf0, .L__FrameSize_main(r1)"::);
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
The function "main" is handled specially:
main() sets the stack pointer, unless -mno-stack-init is specified on the GCC command line.
main() does not save registers.
main() does not return.
main() jumps to "__stop_progExec__" at the end unless "-mendup-at=" is specified on the GCC command line.