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 code and dataCUSTOMIZING THE LINKER COMMAND FILEThe config directory contains one ready-made linker command file for each <strong>MSP430</strong>device. The file contains the information required by the linker, and is ready to be used.The only change you will normally have to make to the supplied linker command file isto customize it so it fits the target system memory map. If, for example, your applicationuses additional external RAM, you need to add details about the external RAM memoryarea.As an example, we can assume that the target system has the following memory layout:Range0x0200–0x09FF0x1000–0x10FF0x1100–0xFFFFTable 6: Memory layout of a target system (example)The ROM can be used for storing CONST and CODE segment memory types. The RAMmemory can contain segments of DATA type. The main purpose of customizing the linkercommand file is to verify that your application code and data do not cross the memoryrange boundaries, which would lead to application failure.Remember not to change the original file. We recommend that you make a copy in theworking directory, and modify the copy instead.The contents of the linker command fileAmong other things, the linker command file contains three different types of XLINKcommand line options:●The CPU used:-cmsp430This specifies your target microcontroller.● Definitions of constants used later in the file. These are defined using the XLINKoption -D.● The placement directives (the largest part of the linker command file). Segments canbe placed using the -Z and -P options. The former will place the segment parts inthe order they are found, while the latter will try to rearrange them to make betteruse of the memory. The -P option is useful when the memory where the segmentshould be placed is not continuous.In the linker command file, all numbers are specified in hexadecimal format. However,neither the prefix 0x nor the suffix h is used.Note: The supplied linker command file includes comments explaining the contents.TypeRAMROMRAMPart 1. Using the compiler33

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

Saved successfully!

Ooh no, something went wrong!