The previous sections describe the placement of code and data in a scatter-loading description file. However, the location of target hardware peripherals and the stack and heap limits are assumed to be hard-coded in source or header files. It is better to locate all information about the memory map of a target in your description file, and remove all references to absolute addresses from your source code.
Conventionally, addresses of peripheral registers are hard-coded in project source or header files. You can also declare structures that map on to peripheral registers, and place these structures in the scatter-loading description file.
For example, if a target has a timer peripheral with two memory mapped 32-bit registers, a C structure that maps to these registers is:
To place this structure at a specific address in the memory
map, you can create an execution region containing the module that
defines the structure. The following example shows an execution
TIMER that locates the
It is important that the contents of these registers are not
zero initialized during application startup, because this is likely
to change the state of your system. Marking an execution region with
UNINIT attribute prevents ZI data in that
region from being zero initialized by