5.4.2.1.4 Changing the Default Allocation
You can change the default memory allocation of objects with static storage duration by either:
- Reserving memory locations
- Using specifiers
- Making the objects absolute; or
- Placing objects in their own section and linking that section
If you wish to prevent objects from using one or more data memory locations so that these locations can be used for some other purpose, you are best reserving the memory using the memory adjust options. See 4.6.1.18 Reserve Option for information on how to do this.
Objects can be placed in specific memory banks using the
__bank()
specifier (see 5.3.9.1 Bank Type Qualifier).
If only a few objects are to be located at specific addresses in data space memory, then those objects can be made absolute (described in 5.4.4 Absolute Variables). Since absolute objects have a known address, they do not follow the normal memory allocation procedure.
Objects 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).