SLAA534A June 2013 – June 2020
Some MSP family devices support multiple data and code memory models. These models differ by the allowed size of objects and pointers. The compiler uses different instructions and relocations to implement these models.
Section 1.10 provides an overview of the code and data models supported by the MSP family. For more about memory models and placement conventions, see Section 4.4.2.1.
The sizes of pointers vary depending on the code and data model you are using. The code and data model affects the size, alignment, and storage space used for function pointers, data pointers, the size_t type, and the ptrdiff_t type. Pointers with sizes that are not a power of 2 are always stored in a container with a size of a power of 2 bits. That is, 20-bit types are stored in 32 bits.
Code or Data Model | Type | Size | Storage | Alignment |
---|---|---|---|---|
small code model | function pointer | 16 | 16 | 16 |
large code model | function pointer | 20 | 32 | 16 |
small data model | data pointer | 16 | 16 | 16 |
small data model | size_t | 16 | 16 | 16 |
small data model | ptrdiff_t | 16 | 16 | 16 |
restricted data model | data pointer | 20 | 32 | 16 |
restricted data model | size_t | 16 | 16 | 16 |
restricted data model | ptrdiff_t | 16 | 16 | 16 |
large data model | data pointer | 20 | 32 | 16 |
large data model | size_t | 20 | 32 | 16 |
large data model | ptrdiff_t | 20 | 32 | 16 |