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.

Data storageThe following table summarizes the available memory types and their correspondingkeywords:Memory type Keyword Address range Pointer sizeDefault in datamodelData16 __data16 0x0-0xFFFF 16 bits Small and MediumData20 __data20 0x0-0xFFFFF 32 bits LargeTable 4: Memory types and their corresponding memory attributesThe keywords are only available if language extensions are enabled in the <strong>MSP430</strong> <strong>IAR</strong>C/<strong>C++</strong> <strong>Compiler</strong>.In the <strong>IAR</strong> Embedded Workbench IDE, language extensions are enabled by default.Use the -e compiler option to enable language extensions. See -e, page 150 foradditional information.For <strong>reference</strong> information about each keyword, see Descriptions of extended keywords,page 193.SyntaxThe keywords follow the same syntax as the type qualifiers const and volatile. Thememory attributes are type attributes and therefore they must be specified both whenvariables are defined and in the declaration, see General syntax rules for extendedkeywords, page 189.The following declarations place the variable i and j in data20 memory. The variablesk and l will also be placed in data20 memory. The position of the keyword does not haveany sffect in this case:__data20 int i, j;int __data20 k, l;Note that the keyword affects both identifiers. If no memory type is specified, the defaultmemory type is used.In addition to the rules presented here—to place the keyword directly in the code—thedirective #pragma type_attribute can be used for specifying the memory attributes.The advantage of using pragma directives for specifying keywords is that it offers you amethod to make sure that the source code is portable. Refer to the chapter Pragmadirectives for details about how to use the extended keywords together with pragmadirectives.Part 1. Using the compiler17

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

Saved successfully!

Ooh no, something went wrong!