25.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(5) char stop;

Differences

The 8-bit compilers have used the four qualifiers bank0, bank1, bank2 and bank3 to indicate the same, albeit more limited, memory placement.

Equivalent specifiers have never been defined for any other compiler.

Migration to the CCI

For 8-bit compilers, change any occurrence of the bankx qualifiers to __bank(), for example, from:

bank2 int logEntry;

to:

__bank(2) int logEntry;

Caveats

This feature is not yet implemented in MPLAB XC8.