Objects which are allocated a memory location that remains fixed for the duration of the program (i.e. not allocated space on a stack) are said to have static storage duration and are located by the compiler into any of the available data banks.
Allocation is performed in two steps. The code generator places each object into a specific section, then the linker places these sections into their predetermined memory areas. See Compiler-Generated Psects for an introductory guide to sections. Thus, during compilation, the code generator can determine the bank in which each object will reside, so that it can efficiently handle bank selection, but it will not know the object’s exact address.
The compiler considers three broad categories of object, which relate to the value the object should contain at the time the program begins. Each object category has a corresponding family of sections (see Compiler-Generated Psects), which are tabulated below.
nv
__persistent
,
whose values are not cleared by the runtime startup code.bss
data
Main, Runtime Startup and Reset has information on how the runtime startup code operates.