Vault 7: Projects

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

Memory Allocation and Access
2012-2013 Microchip Technology Inc. DS50002071C-page 155
10.4.4 Changing Program Memory Variable Allocation
The variables allocated to program memory can, to some degree, be allocated to alter-
nate memory locations. Section 10.3.1.4 Changing Non-Auto Variable Allocation
describes alternate addresses and sections also applicable to objects in the program
memory space. Note that you cannot use the address attribute for objects that are in
the auto_psv space.
The space attribute can be used to define variables that are positioned for use in the
PSV window. To specify certain variables for allocation in the compiler-managed PSV
space, use attribute space(auto_psv). To allocate variables for PSV access in a
section not managed by the compiler, use attribute space(psv). For more information
on these attributes, see Chapter 7. Differences Between MPLAB XC16 and ANSI
C.
For example, to place a variable in the auto_psv space, which will cause storage to
be allocated in Flash in a convenient way to be accessed by a single PSVPAG setting,
specify:
unsigned int FLASH_variable __attribute__((space(auto_psv)));
Other user spaces that relate to Flash are available:
space(psv) - a PSV space that the compiler does not access automatically
space(prog) - any location in Flash that the compiler does not access automatically
Note that both the psv and auto_psv spaces are appropriately blocked or aligned so
that a single PSVPAG setting is suitable for accessing the entire variable.
For more on PSV usage, see the MPLAB XC16 Assembler, Linker and Utilities Users
Guide (DS52106).

e-Highlighter

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

Un-highlight all Un-highlight selectionu Highlight selectionh