Variable Attributes

The following variable attributes are supported:

The aligned attribute when used on a variable has the same effect as the DATA_ALIGN pragma. See Section 5.12.7

The location attribute has the same effect as the LOCATION pragma. See Section 5.12.21.

The noinit and persistent attributes apply to the ROM initialization model and allow an application to avoid initializing certain global variables during a reset. The alternative RAM initialization model initializes variables only when the image is loaded; no variables are initialized during a reset. See the "RAM Model vs. ROM Model" section and its subsections in the MSP430 Assembly Language Tools User's Guide.

The noinit attribute can be used on uninitialized variables; it prevents those variables from being set to 0 during a reset. The persistent attribute can be used on initialized variables; it prevents those variables from being initialized during a reset. By default, variables marked noinit or persistent will be placed in sections named .TI.noinit and .TI.persistent, respectively. The location of these sections is controlled by the linker command file. Typically .TI.persistent sections are placed in FRAM for devices that support FRAM and .TI.noinit sections are placed in RAM. Also see Section 5.12.22.

The packed attribute may be applied to individual fields within a struct or union. The behavior of the packed attribute for structure and union fields is described in Section 5.17.4.

The retain attribute has the same effect as the RETAIN pragma (Section 5.12.29). That is, the section that contains the variable will not be omitted from conditionally linked output even if it is not referenced elsewhere in the application.

The section attribute when used on a variable has the same effect as the DATA_SECTION pragma. See Section 5.12.8

The used attribute is defined in GCC 4.2 (see https://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Variable-Attributes.html#Variable-Attributes).

The weak attribute has the same effect as the WEAK pragma (Section 5.12.32).