SLAA380B December   2007  – September 2018 MSP430F2616 , MSP430F2617 , MSP430F2618 , MSP430F2619

 

  1.   Migrating From MSP430F16x MCUs to MSP430F261x MCUs
    1.     Trademarks
    2. 1 Comparison of MSP430F1xx and MSP430F2xx Families
    3. 2 Hardware Considerations for MSP430F16x to MSP430F261x Migration
      1. 2.1 Device Package and Pinout
      2. 2.2 Current Consumption
      3. 2.3 Operating Frequency and Supply Voltage
      4. 2.4 Device Errata
    4. 3 MSP430F16x to MSP430F261x Migration – Firmware Considerations
      1. 3.1 CPU and Memory Considerations
        1. 3.1.1 Extended Memory Architecture
        2. 3.1.2 Subroutine Parameter Passing and Stack Frame
        3. 3.1.3 MSP430X Instruction Cycle Count Optimizations
        4. 3.1.4 Device Memory Map
        5. 3.1.5 Information Flash Memory
      2. 3.2 Serial Communication – USART Versus USCI
        1. 3.2.1 UART Mode
        2. 3.2.2 SPI Mode
        3. 3.2.3 I2C Mode
      3. 3.3 Clock System
        1. 3.3.1 LFXT1 and XT2 Oscillators
        2. 3.3.2 Digitally Controlled Oscillator (DCO)
      4. 3.4 Bootloader
      5. 3.5 Interrupt Vectors
      6. 3.6 Beware of Reserved Bits!
      7. 3.7 Timers
      8. 3.8 Analog Comparator
    5. 4 References
  2.   Revision History

Subroutine Parameter Passing and Stack Frame

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).

pc_storage_calla_laa380.gifFigure 1. Program Counter Storage on the Stack for CALLA

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.