5.4.2.1 Static Storage Duration Objects

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 5.15.1 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 5.15.1 Compiler-Generated Psects), which are tabulated below.

nv
These sections are used to store objects qualified __persistent, whose values are not cleared by the runtime startup code.
bss
These sections contain any uninitialized objects, which will be cleared by the runtime startup code.
data
These sections contain the RAM image of initialized objects, whose non-zero value is copied to them by the runtime startup code.

5.10 Main, Runtime Startup and Reset has information on how the runtime startup code operates.