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.

Extended keywordsThe __regvar attribute can be used on integer types, pointers, 32-bit floating-pointnumbers, structures with one element and unions of all these. However, it is not possibleto point to an object that has been declared __regvar. An object declared __regvarcannot have an initial value.Note: If a module in your application has been compiled using --regvar_r4, it canonly be linked with modules that have been compiled with either --regvar_r4 or--lock_r4. The same is true for --regvar_r5/--lock_r5.ExampleTo declare a global register variable, use the following syntax:__regvar __no_init type variable_name @ locationwhere location is either __R4 or __R5, declared in intrinsics.h.This will create a variable called variable_name of type type, located in register R4or R5, for example:__regvar __no_init int counter @ __R4;See also --regvar_r4, page 164 and --regvar_r5, page 164.__rootSyntax Follows the generic syntax rules for object attributes, see Object attributes, page 191.DescriptionExampleSee alsoA function or variable with the __root attribute is kept whether or not it is <strong>reference</strong>dfrom the rest of the application, provided its module is included. Program modules arealways included and library modules are only included if needed.__root int myarray[10];To read more about modules, segments, and the link process, see the <strong>IAR</strong> Linker andLibrary Tools Reference Guide.__save_reg20Syntax Follows the generic syntax rules for object attributes, see Object attributes, page 191.DescriptionWhen compiling for the <strong>MSP430</strong>X architecture in the Small data model, use thiskeyword to save and restore all 20 bits of the registers that are used, instead of only 16bits, which are saved and restored by normal functions. This keyword will make thefunction save all registers and not only the ones used by the function to guarantee that20-bit registers are not destroyed by subsequent calls.Part 2. <strong>Compiler</strong> <strong>reference</strong>197

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

Saved successfully!

Ooh no, something went wrong!