8.11.11 Persistent Variable Attribute

The persistent attribute specifies that the variable should not be initialized or cleared at startup. Use a variable with the persistent attribute to store state information that will remain valid after a device Reset. For example:
int last_mode __attribute__((persistent));

The persistent attribute typically causes the compiler to place the variable in the .pbss section, which does not get cleared by the default runtime startup code; however, that might not be the case if the object is defined using other attributes. For example, use of either the address or section attributes in addition to persistent will place the object in sections with different names. Because the section used for persistent objects must be placed in data space, this attribute is not compatible with the space attribute. The persistent attribute implies the coherent attribute. That is, persistent attributed variables are accessed via the uncached address. The const qualifier can be used with the persistent attribute provided the object is not initialized. Any attempt to initialize such an object will result in a warning and the initial value ignored.