11.6 Extended Data Space Access
Qualifying a variable or pointer target as being accessible through the
extended data space window allows you to easily access objects that have been placed in a
variety of different memory spaces. These include: space(data)
(and its
subsets), eds
, space(eedata)
,
space(prog)
, space(psv)
,
space(auto_psv)
, and on some devices space(pmp)
. Not
all devices support all memory spaces.
To use this feature:
- declare an object in an appropriate memory space
- qualify the object with the
__eds__
qualifier
For example:
__eds__ int var_a __attribute__((space(prog)));
__eds__ int var_b [10] __attribute__((eds));
__eds__ int *var_c;
__eds__ int *__eds__ var_d __attribute__((space(psv)));
var_a
- declares an int
in Flash that is
automatically accessed
var_b
- declares an array of ints
,
located in eds
; the elements of the array are automatically accessed
var_c
- declares a pointer to an int
,
where the destination may exist in any one of the memory spaces supported by Extended Data
Space pointers and will be automatically accessed upon dereference; the pointer itself must
live in a normal data space
var_d
- declares a pointer to an int
,
where the destination may exist in any one of the memory spaces supported by Extended Data
Space pointers and will be automatically accessed upon dereference; the pointer value
exists in Flash and is also automatically accessed.
The compiler will automatically assert the page
attribute
to scalar variable declarations; this allows the compiler to generate more efficient code
when accessing larger data types. Remember, scalar variables do not include structures or
arrays. To force paging of a structure or array, please manually use the
page
attribute and the compiler will prevent the object from crossing a
page boundary.
For read access to __eds__
qualified variables, the
compiler will automatically manipulate the PSVPAG
or
DSRPAG
register as appropriate. For devices that support extended data
space memory, the compiler will also manipulate the DSWPAG
register.