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.

Memory types (<strong>MSP430</strong>X only)The <strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong> uses different memory types to access data that isplaced in different areas of the memory. There are different methods for reachingmemory areas, and they have different costs when it comes to code space, executionspeed, and register usage. The access methods range from generic but expensivemethods that can access the full memory space, to cheap methods that can access limitedmemory areas. Each memory type corresponds to one memory access method. Bymapping different memories—or part of memories—to memory types, the compiler cangenerate code that can access data efficiently.For example, the memory accessible using the data16 memory access method is calledmemory of data16 type, or simply data16 memory.By selecting a data model, you have selected a default memory type that yourapplication will use. However, it is possible to specify—for individual variables orpointers—different memory types. This makes it possible to create an application thatcan contain a large amount of data, and at the same time make sure that variables thatare used often are placed in memory that can be efficiently accessed.DATA16The data16 memory consists of the low 64 Kbytes of data memory. In hexadecimalnotation, this is the address range 0x0000-0xFFFF.A data16 object can only be placed in data16 memory, and the size of such an object islimited to 64 Kbytes-1. By using objects of this type, the code generated by the compilerto access them is minimized. This means a smaller footprint for the application, andfaster execution at run-time.DATA20Using this memory type, you can place the data objects anywhere in the entire memoryrange 0x00000–0xFFFFF. This requires the extended instructions of the <strong>MSP430</strong>Xarchitecture, which are more expensive. Note that a pointer to data20 memory willoccupy four bytes of memory, which is twice the amount needed for data16 memory.USING DATA MEMORY ATTRIBUTESThe <strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong> provides a set of extended keywords, which can beused as data memory attributes. These keywords let you override the default memorytype for individual data objects, which means that you can place data objects in othermemory areas than the default memory. This also means that you can fine-tune theaccess method for each individual data object, which results in smaller code size.16<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!