SLAU646F September 2015 – June 2020
For MSP430X devices that have an “upper” memory region (memory above the 0xFFFF boundary), the large memory model (-mlarge) is supported.
If a program built for one of these MSP430X devices is too large to fit exclusively in the lower memory region using the small memory model, rebuilding the program for the large memory model (-mlarge) with -mcode-region=either and possibly -mdata-region=either can help it to fit.
There is a code size and performance penalty when using -mdata-region=either. MSP430X instructions must be generated to address data, even in cases where an MSP430 instruction would suffice, since the compiler must assume that data might be placed in the upper memory region. Therefore, -mdata-region=either should be used only if it is necessary—that is, if the program would not otherwise fit on the device.
Note that the -mlarge option alone forces the compiler to generate CALLA and RETA instructions for all subroutine calls and returns. While there is no code size penalty for using these instructions instead of CALL and RET, there is some performance overhead. There is no additional penalty to using -mcode-region=either if -mlarge is in use.
See Table 4-2 for details on how the "either" options shuffle code and data sections between upper and lower memory. For best results, use these options with the -ffunction-sections and -fdata-sections options, so that the sections available to be shuffled are smaller.