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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Data models (<strong>MSP430</strong>X only)●means that the amount of memory allocated for this type of variable does notchange while the application is running.On the heap. Once memory has been allocated on the heap, it remains valid until itis explicitly released back to the system by the application. This type of memory isuseful when the number of objects is not known until the application executes. Notethat there are potential risks connected with using the heap in systems with a limitedamount of memory, or systems that are expected to run for a long time.Data models (<strong>MSP430</strong>X only)For the <strong>MSP430</strong>X architecture, the compiler supports three data models for applicationswith different data requirements.Technically, one property that the data model specifies is the default memory type,which controls the following:●The default placement of static and global variables, as well as constant literals● Dynamically allocated data, for example data allocated with malloc, or, in <strong>C++</strong>,the operator new● The default pointer type● The placement of the runtime stack.In the Small data model, only the data16 memory type is available. In the Medium andLarge data models, you can be explicitly override the default memory type by usingmemory attributes. For information about how to specify a memory type for individualobjects, see Using data memory attributes, page 16.SPECIFYING A DATA MODELThree data models are implemented: Small, Medium, and Large. These models arecontrolled by the --data_model option. Each model has a default memory type and adefault pointer size. If you do not specify a data model option, the compiler will use theSmall data model.Your project can only use one data model at a time, and the same model must be usedby all user modules and all library modules. However, you can override the defaultmemory type for individual data objects by explicitly specifying a memory attribute,using either keywords or the #pragma type_attribute directive.14<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!