24.4.6 X and Y Data Objects

The __xdata and __ydata qualifiers can be used to indicate that variables are located in special memory regions. Exactly what constitutes X and Y memory is dependent on the target device, but it is typically memory that can be accessed independently on separate buses. Such memory is often required for some DSP instructions.

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

Some devices may not have such memory implemented; in which case, use of these qualifiers is ignored.

Example

The following shows a variable qualified using __xdata, as well as another variable qualified with __ydata.

__xdata char data[16];

__ydata char coeffs[4];

Differences

The MPLAB XC16 and XC-DSC compilers have used the xmemory and ymemory space attribute with variables.

Equivalent specifiers have never been defined for any other compiler.

Migration to the CCI

For MPLAB XC16 and XC-DSC compilers, change any occurrence of the space attributes xmemory or ymemory to __xdata, or __ydata respectively, for example, from:

char __attribute__((space(xmemory)))template[20];

to:

__xdata char template[20];

Caveats

None.