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.

General syntax rules for extended keywordsType attributes can be further divided into memory attributes and general typeattributes.Memory attributesA memory attribute corresponds to a certain logical or physical memory in themicrocontroller.Available data memory attributes: __data16, __data20, and __regvarData objects, functions, and destinations of pointers or <strong>C++</strong> <strong>reference</strong>s always have amemory attribute. If no attribute is explicitly specified in the declaration or by thepragma directive #pragma type_attribute, an appropriate default attribute is used.You can only specify one memory attribute for each level of pointer indirection.General type attributesThe following general type attributes are available:●●Function type attributes affect how the function should be called: __interrupt,__monitor, __task, __cc_version1, and __cc_version2Data type attributes: const and volatileYou can specify as many type attributes as required for each level of pointer indirection.To read more about the type qualifiers const and volatile, see Type qualifiers, page176.Syntax for type attributes used on data objectsIn general, type attributes for data objects follow the same syntax as the type qualifiersconst and volatile.The following declaration assigns the __data20 type attribute to the variables i and j;in other words, the variable i and j is placed in data20 memory. The variables k and lbehave in the same way:__data20 int i, j;int __data20 k, l;Note that the attribute affects both identifiers.The following declaration of i and j is equivalent with the previous one:#pragma type_attribute=__data20int i, j;The advantage of using pragma directives for specifying keywords is that it offers you amethod to make sure that the source code is portable. Note that the pragma directive hasno effect if a memory attribute is already explicitly declared.190<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!