Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 ユーザーズマニュアル

製品コード
SW006021-1
ページ / 518
Common C Interface
 2012 Microchip Technology Inc.
DS52053A-page 29
2.5.6
X and Y Data Objects
The __xdata and __ydata qualifiers may be used to indicate that variables may be 
located in special memory regions. Exactly what constitutes X and Y memory is depen-
dent 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 will be ignored.
2.5.6.1
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];
2.5.6.2
DIFFERENCES
The 16-bit compilers have used the xmemory and ymemory space attribute with 
variables.
Equivalent specifiers have never been defined for any other compiler.
2.5.6.3
MIGRATION TO THE CCI
For 16-bit compilers, change any occurrence of the space attributes xmemory or 
ymemory
, as in the following example:
char __attribute__((space(xmemory)))template[20];
to __xdata, or __ydata, i.e., __xdata char template[20];
2.5.6.4
CAVEATS
None.
2.5.7
Banked Data Objects
The __bank(num) qualifier may be used to indicate that variables may be located in 
a particular data memory bank. The number, num, represents the bank number. Exactly 
what constitutes banked memory is dependent on the target device, but it is typically a 
subdivision of data memory to allow for assembly instructions with a limited address 
width field.
Use the native keywords discussed in the Differences section to look up information on 
the semantics of these qualifiers.
Some devices may not have banked data memory implemented, in which case, use of 
this qualifier will be ignored. The number of data banks implemented will vary from one 
device to another.
2.5.7.1
EXAMPLE
The following shows a variable qualified using __bank().
__bank(0) char start;
__bank(5) char stop;