Technical Note 39271

Placing CODE in the MSP430 information memory

EW targets: 430
EW component: General issues
Keywords: flash
Last update: June 14, 2013

Background

The MSP430 family have (up to) 256 bytes of flash memory in an area with the name "Information Memory". If your application is made for one of the smaller MSP430 derivatives then it can be useful to place parts of the application in the "Information Memory".


Solutions

You can use the quick solution Using "Function placement into named segments" or you can use the more efficient solution Change the .xcl file.


Using "Function placement into named segments"

You can either use the @-operator or the “#pragma location” directive to place a specific function in the INFO memory. It would look like:

void g(void) @ "INFO"
{
}

#pragma location="INFO"
void h(void)
{
}



Change the .xcl file

The above suggestion is quick and simple, but it does not allow the linker to place the code for you. To make the XLINK linker to optimize the placement (i.e. select and place functions to fill out the Information Memory) you need to edit (your own copy of) the .xcl file for your derivative.

(This example is based on the MSP430F1101A, Program Memory 1 kB flash, Information Memory 128 B flash, 128 B RAM.)

Take a copy of the lnk430F1101.xcl from the \430\config\ directory.

Place the copy in the same folder as the .ewp (project) file.

Open the EW430. Select: Project > Options > Linker > Config > Linker command file > mark "Override Default"
Change from...

$TOOLKIT_DIR$\CONFIG\lnk430F1101.xcl

...to...

$PROJ_DIR$\lnk430F1101.xcl

Open the copied lnk430F1101.xcl file. Change from....

-Z(CODE)CODE=FC00-FFDF

...to...

-Z(CODE)CODE=1080-10FF,FC00-FFDF

... and save the changes.

The XLINK linker will now also place CODE in the Information Memory.

( Note: If the .xcl file is not changed in any other way, then will symbols (data and/or functions) placed in the segment INFO have precedence over symbols placed in the segment CODE. The reason for this is that the -Z option for INFO is placed earlier in the .xcl file, than the -Z option for CODE.)