7.4.7 Banked Data Objects
The __bank(num)
qualifier can be used to indicate that
variables are 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 is ignored. The number of data banks implemented will vary from one device to another.
Example
The following shows a variable qualified using __bank()
.
__bank(0) char start;
__bank(3) char stop;
Differences
When targeting PIC devices, the MPLAB XC8 compiler has used the four qualifiers
bank0
, bank1
, bank2
and
bank3
to indicate memory placement in a specific data bank.
Equivalent specifiers have never been defined for any other compiler.
Migration to the CCI
When building for PIC devices using MPLAB XC8, change any occurrence of the
banknum
qualifiers to
__bank(num)
, for example, from:
bank2 int logEntry;
to:
__bank(2) int logEntry;
Caveats
Only banks 0 through 3 are currently supported.