Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

MPLAB
®
XC16 C Compiler Users Guide
DS50002071C-page 164 2012-2013 Microchip Technology Inc.
10.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 program address offset.
The remapped addressing scheme for __pack_upper_byte objects prevents the
compiler from accepting fixed address requests.

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh