5.4.3.2 Changing The Default Allocation
You can change the default memory allocation of
const
-specified objects by either:
- Reserving memory locations
- Making the objects absolute
- Placing objects in their own section and linking that section
- Using the caching optimization
If you wish to prevent variables from using one or more program memory locations so the locations can be used for some other purpose, it is recommended to reserve the memory using the memory adjust options. See 4.6.1.18 Reserve Option for information on how to do this.
If only a few const
objects are to be located at specific
addresses in program space memory, then the objects can be made absolute. Absolute
variables are described in 5.4.4 Absolute Variables.
Objects in program memory can also be placed in their own section by using
the __section()
specifier, allowing this section to be linked at the
required location (see 5.15.3 Changing and Linking the Allocated Section).
Some objects in program memory can be cached in data memory by enabling the caching optimization (see 4.6.6.8 Cacheconst Option). It is not possible to cache individual objects, and which objects are cached by this optimization can vary from build to build as the program is changed.