Placing CODE in the MSP430 information memory

Technical Note 39271

Architectures:

MSP430

Component:

general

Updated:

11/6/2015 1:49 PM

Introduction

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 IAR XLINK Linker 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.)

  • Make a copy of the lnk430F1101.xcl from the \430\config\ directory.
  • Place the copy in the same folder as the .ewp (project) file.
  • Open IAR Embedded Workbench for MSP430. 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.

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

All product names are trademarks or registered trademarks of their respective owners.

We do no longer support Internet Explorer. To get the best experience of iar.com, we recommend upgrading to a modern browser such as Chrome or Edge.