Техническая Спецификация для Microchip Technology SW006022-1N
MPLAB
®
XC16 C COMPILER
USER’S GUIDE
2012 Microchip Technology Inc.
DS52071B-page 117
Chapter 7. Memory Allocation and Access
7.1
INTRODUCTION
There are two broad groups of RAM-based variables: auto/parameter variables, which
are allocated to some form of stack, and global/static variables, which are positioned
freely throughout the data memory space. The memory allocation of these two groups
is discussed separately in the following sections.
are allocated to some form of stack, and global/static variables, which are positioned
freely throughout the data memory space. The memory allocation of these two groups
is discussed separately in the following sections.
7.2
ADDRESS SPACES
The 16-bit devices are a combination of traditional PIC
®
Microcontroller (MCU) fea-
tures (peripherals, Harvard architecture, RISC) and new DSP capabilities (dsPIC DSC
devices). These devices have two distinct memory regions:
devices). These devices have two distinct memory regions:
• Program Memory contains executable code and optionally constant data.
• Data Memory contains external variables, static variables, the system stack and
file registers. Data memory consists of near data, which is memory in the first 8
KB of the data memory space, and far data, which is in the upper 56 KB of data
memory space.
KB of the data memory space, and far data, which is in the upper 56 KB of data
memory space.
Although the program and data memory regions are distinctly separate, the
dsPIC30F/33F and PIC24F/H families of processors contain hardware support for
accessing data from within program Flash using a hardware feature that is commonly
called Program Space Visibility (PSV). More detail about how PSV works can be found
in device data sheets or family reference manuals. Also, see Section 7.3 “Variables
in Data Space Memory” and Section 11.8.2 “PSV Usage with Interrupt Service
Routines”.
dsPIC30F/33F and PIC24F/H families of processors contain hardware support for
accessing data from within program Flash using a hardware feature that is commonly
called Program Space Visibility (PSV). More detail about how PSV works can be found
in device data sheets or family reference manuals. Also, see Section 7.3 “Variables
in Data Space Memory” and Section 11.8.2 “PSV Usage with Interrupt Service
Routines”.
Briefly, the architecture allows the mapping of one 32K page of Flash into the upper
32K of the data address space via the Special Function Register (SFR) PSVPAG.
Devices that support Extended Data Space (EDS) map using the DSRPAG register
instead. Also it is possible to map FLASH and other areas. See
Section 7.7 “Extended Data Space Access” for more details.
32K of the data address space via the Special Function Register (SFR) PSVPAG.
Devices that support Extended Data Space (EDS) map using the DSRPAG register
instead. Also it is possible to map FLASH and other areas. See
Section 7.7 “Extended Data Space Access” for more details.
By default the compiler only supports direct access to one single PSV page, referred
to as the auto_psv space. In this model, 16-bit data pointers can be used. However,
on larger devices, this can make it difficult to manage large amounts of constant data
stored in Flash.
to as the auto_psv space. In this model, 16-bit data pointers can be used. However,
on larger devices, this can make it difficult to manage large amounts of constant data
stored in Flash.