Microchip Technology SW006022-2N Data Sheet

Page of 338
MPLAB
®
 XC16 C Compiler User’s Guide
DS52071B-page 138
 2012 Microchip Technology Inc.
7.8.3
Addressing Information
The upper byte of Flash does not have a unique address, which is a requirement for C.  
Therefore, the compiler has to invent one. The tool chain remaps Flash to linear 
addresses for all bytes starting with program address word 0.  This means that the real 
Flash address of a __pack_upper_byte variable will not be the address that is stored 
in a pointer or symbol table.  The Flash address can be determined by: 
1.
word offset = address div 3 
2.
program address offset = word offset * 2
3.
byte offset = address mod 3
The byte to reference is located in Flash at <it>program address offset</it>.
The remapped addressing scheme for __pack_upper_byte objects prevents the 
compiler from accepting fixed address requests.