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 dataThis chapter describes how the linker handles memory and introduces theconcept of segments. It also describes how they correspond to the memoryand function types, and how they interact with the runtime environment. Themethods for placing segments in memory, which means customizing a linkercommand file, are described.The intended readers of this chapter are the system designers that areresponsible for mapping the segments of the application to appropriatememory areas of the hardware system.Segments and memoryIn an embedded system, there are many different types of physical memory. Also, it isoften critical where parts of your code and data are located in the physical memory. Forthis reason it is important that the development tools meet these requirements.WHAT IS A SEGMENT?A segment is a logical entity containing a piece of data or code that should be mappedto a physical location in memory. Each segment consists of many segment parts.Normally, each function or variable with static storage duration is placed in a segmentpart. A segment part is the smallest linkable unit, which allows the linker to include onlythose units that are referred to. The segment could be placed either in RAM or in ROM.Segments that are placed in RAM do not have any content, they only occupy space.Note: Here, ROM memory means all types of read-only memory including flashmemory.The <strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong> has a number of predefined segments for differentpurposes. Each segment has a name that describes the contents of the segment, and asegment memory type that denotes the type of content. In addition to the predefinedsegments, you can define your own segments.At compile time, the compiler assigns each segment its contents. The <strong>IAR</strong> XLINKLinker is responsible for placing the segments in the physical memory range, inaccordance with the rules specified in the linker command file. There are ready-madelinker command files, but, if necessary, they can be easily modified according to therequirements of your target system and application. It is important to remember that,Part 1. Using the compiler 31

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

Saved successfully!

Ooh no, something went wrong!