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.

Getting startedPOSITION-INDEPENDENT CODEMost applications are designed to be placed at a fixed position in memory. However, byenabling the compiler option --pic and choosing a dedicated runtime library objectfile, you will enable support for a feature known as position-independent code, thatallows the application to be placed anywhere in memory. This is useful, for example,when developing modules that should be loaded dynamically at runtime.The drawback of position-independent code is that the size of the code will be somewhatlarger, and that interrupt vectors cannot be specified directly. Also note that global datais not position-independent.Note: Position-independent code is not supported for the <strong>MSP430</strong>X architecture.DATA MODEL (<strong>MSP430</strong>0X ONLY)For the <strong>MSP430</strong>X architecture, there is a trade-off regarding the way memory isaccessed, ranging from cheap access to small memory areas, up to more expensiveaccess methods that can access any location.In the <strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong>, you can set a default memory access method byselecting a data model. However, it is possible to override the default access method foreach individual variable. The following data models are supported:● The Small data model specifies data16 as default memory type, which means thefirst 64 Kbytes of memory can be accessed. The only way to access the full 1-Mbytememory range is to use intrinsic functions.● The Medium data model specifies data16 as default memory type, which means dataobjects by default are placed in the first 64 Kbytes of memory. If required, the entire1 Mbyte of memory can be accessed.● The Large data model specifies data20 as default memory type, which means theentire memory can be accessed.The chapter Data storage covers data models in greater detail. The chapter also covershow to fine-tune the access method for individual variables.SIZE OF DOUBLE FLOATING-POINT TYPEFloating-point values are represented by 32- and 64-bit numbers in standard IEEE754format. By using the compiler option --double={32|64}, you can choose whetherdata declared as double should be represented with 32 bits or 64 bits. The data typefloat is always represented using 32 bits.Part 1. Using the compiler7

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

Saved successfully!

Ooh no, something went wrong!