8.7.1 Memory Models and Address Spaces
By default, the compiler uses the const-in-code
memory model, which will
allocate const
qualified objects into a single PSV window, limited to
32K in size. This window will be the default page that is mapped into the EDS area in
the address map. The compiler requires that this page always be available if it is
setup. This is often referred to as the auto PSV memory model because the compiler
automatically manages the PSV.
Other objects can be explicitly placed into different areas of memory using a
space
attribute, such as
__attribute__((space(psv)))
for a windowed Flash area or
__attribute__((space(eds)))
for a RAM area in the EDS space. When there is
a need to nominate a Y memory space and have that be in EDS, use
__attribute__((space(eds)))
, which is equivalent to
__attribute__((eds))
.
When specifying an address space it is normal, but not required, to also use an address space qualifier. Doing so will ask the compiler to manage the access to the named address space for you, which will mean always maintaining the const-in-code page access if it is enabled.