4.4.2.1 Static Storage Duration Objects
Objects which are not allocated space on a stack (all objects excluding
auto, parameter and const
-qualified objects) have a static (permanent)
storage duration and are located by the compiler into the data memory.
Allocation is performed in two steps. The compiler places each object into a specific section and then the linker places these sections into the relevant memory areas. After placement, the addresses of the objects in those sections can be fully resolved.
The compiler considers two object categories, which relate to the value the object should contain when the program begins execution. Each object category has a corresponding family of sections (see 4.14.1 Compiler-Generated Sections), which are tabulated below.
- 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.
See 4.9 Main, Runtime Startup and Reset has information on how the runtime startup code operates.