11.07.2015 Views

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Placing segments in memorySee the <strong>IAR</strong> Linker and Library Tools Reference Guide for more details.Using the -Z command for sequential placementUse the -Z command when you need to keep a segment in one consecutive chunk, whenyou need to preserve the order of segment parts in a segment, or, more unlikely, whenyou need to put segments in a specific order.The following illustrates how to use the -Z command to place the segment MYSEGMENTAfollowed by the segment MYSEGMENTB in CONST memory (that is, ROM) in the memoryrange 0x2000-0xCFFF.-Z(CONST)MYSEGMENTA,MYSEGMENTB=2000-CFFFTwo segments of different types can be placed in the same memory area by notspecifying a range for the second segment. In the following example, the MYSEGMENTAsegment is first located in memory. Then, the rest of the memory range could be used byMYCODE.-Z(CONST)MYSEGMENTA=2000-CFFF-Z(CODE)MYCODETwo memory ranges may overlap. This allows segments with different placementrequirements to share parts of the memory space; for example:-Z(CONST)MYSMALLSEGMENT=2000-20FF-Z(CONST)MYLARGESEGMENT=2000-CFFFEven though it is not strictly required, make sure to always specify the end of eachmemory range. If you do this, the <strong>IAR</strong> XLINK Linker will alert you if your segments donot fit.Using the -P command for packed placementThe -P command differs from -Z in that it does not necessarily place the segments (orsegment parts) sequentially. With -P it is possible to put segment parts into holes left byearlier placements.The following example illustrates how the XLINK -P option can be used for makingefficient use of the memory area. The command will place the data segment MYDATA inDATA memory (that is, in RAM) in a fictitious memory range:-P(DATA)MYDATA=0-1FFF,10000-11FFFIf your application has an additional RAM area in the memory range 0xF000-0xF7FF,you just add that to the original definition:-P(DATA)MYDATA=0-1FFF,F000–F7FF,10000-11FFF34<strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong>Reference Guide

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!