10.3.4.4 User-Defined Constants in Program Memory - dsPIC33C/E/F Devices Only

A comment block is included that describes how to define sections that will be accessed via the PSV window or the EDS window.

Note: This type of access is used on dsPIC33C/E/F architectures. The dsPIC33A architecture has a unified addressing model so this method of accessing program memory in a data context is not required.

Such sections are defined with the psv attribute. The syntax used to represent a PSV section address is different from other type sections. In particular, the Load Memory Address (LMA) should be defined, not the Virtual Memory Address (VMA). The LMA is unique and describes where the section is located in program memory. The VMA describes a location in the data window that may be shared by multiple pages of program memory, and is therefore not unique.

/*
** User-Defined Constants in Program Memory
**
** For PSV-type sections, the Load Memory Address (LMA)
** should be specified as follows:
**
**       userconst : AT(0x1234)
**         {
**           *(userconst);
**         } >program
**
** Note that mapping PSV sections in linker scripts
** is not generally recommended.
**
** Because of page alignment restrictions, memory is
** often used more efficiently when PSV sections
** do not appear in the linker script.
**
** For more information on memory allocation,
** please refer to chapter 10, "Linker Processing"
** in the Assembler, Linker manual (DS50001317).
*/

As noted, defining PSV-type sections in the linker script is not generally recommended. This is because sections that appear in the linker script are allocated sequentially, and PSV sections have significant page alignment restrictions. For more information on memory allocation and PSV sections, see Linker Processing.