??? 11/10/11 13:40 Read: times |
#184610 - Global Variable Initiaization Responding to: ???'s previous message |
In the past I have experienced similar problems. This has led me to generally always write specific code lines, in my initialization procedures, to set the values of volatile storage (RAM based) global variables that need to have a set value.
My general practice is to only depend on initializers that set values for data elements that are explicitly declared in the "code" region. This type of initializer is handled at build time by the compiler and linker whilst the code image is being built. On the other hand any RAM based global variables that have initializers require work by the compiler and linker to properly build an initialize a table in the code space that then gets copied out to the data or xdata areas by the startup code. Michael Karas |