SLAA380B December 2007 – September 2018 MSP430F2616 , MSP430F2617 , MSP430F2618 , MSP430F2619
This consideration regards passing parameters to and from assembler functions or precompiled library functions from a higher-level language such as C. For data exchange with a function, a compiler typically allocates and uses certain CPU registers. However, in the case that the parameters cannot all fit into CPU registers, additional data is pushed onto the stack before the subroutine is called. Programs that take advantage of the larger memory available on a MSP430X device (MSP430F261x) perform the subroutine call via the CALLA instruction, thus placing an additional 16-bit word onto the stack caused by the 20-bit wide program counter (see Figure 1).
When the subroutine wants to access the data placed on the stack by the caller, it is important to adjust all the offsets used for accessing the parameters using stack pointer (SP) offset indirect addressing to take the additional word on the stack into account. Therefore, assembler routines ported from the MSP430F16x need to be reviewed and changed if required, and precompiled libraries need to be rebuilt.
As a side note, if a different or newer version compiler is used during migration to an MSP430F261x to take better advantage of the larger memory, it should be verified that the subroutine calling conventions are compatible. This affects the porting of assembler routines as well as the reuse of precompiled libraries. More information on subroutine parameter passing and stack frame can be found in the compiler documentation.