25.4.9 EEPROM Objects

The __eeprom qualifier can be used to indicate that variables should be positioned in EEPROM.

Use the native keywords discussed in the Differences section to look up information on the semantics of this qualifier.

Some devices may not implement EEPROM. Use of this qualifier for such devices generates a warning. Stack-based (auto and parameter) variables cannot use the __eeprom specifier.

Example

The following shows a variable qualified using __eeprom.

__eeprom int serialNos[4];

Differences

The 8-bit compilers have used the qualifier, eeprom, to indicate this meaning for some devices.

The 16-bit compilers have used the space attribute to allocate variables to the memory space used for EEPROM.

Migration to the CCI

For 8-bit compilers, change any occurrence of the eeprom qualifier to __eeprom, for example, from:

eeprom char title[20];

to:

__eeprom char title[20];

For 16-bit compilers, change any occurrence of the eedata space attribute to __eeprom, for example, from:

int mainSw __attribute__ ((space(eedata)));

to:

int __eeprom mainSw;

Caveats

MPLAB XC8 does not implement the __eeprom qualifiers for any PIC18 devices; this qualifier works as expected for other 8-bit devices.