5.10.2.2 Clearing Objects

Those objects with static storage duration which are not assigned a value must be cleared before the main() function begins by the runtime startup code, for example.

int output;

The runtime startup code will clear all the memory locations occupied by uninitialized objects so they will contain zero before main() is executed.

Absolute variables are never cleared and must be explicitly assigned a value of zero if that is required for correct program execution.

The clearing of objects can be disabled using -Wl,--no-data-init; however, code that relies on objects containing their initial value will fail.

Objects whose contents should be preserved over a Reset should be qualified with __persistent. Such objects are linked at a different area of memory and are not altered by the runtime startup code.

The runtime startup code that clears objects will clobber the content of the STATUS register. If you need to use this register to determine the cause of reset, the register's content can be preserved.