
In message 454BD9AB.1000303@freescale.com you wrote:
To me, a variable defined outside of a function is a global variable,
May I suggest we stick with ANSI C standard terminology instead of private interpretations?
Since you complained about a problem where I could not see any (at least none that was not clearly documented) I was not sure if your expectation of "global" was correct, i. e. if you were aware of the differences between "global" on file level versus "global" in the meaning of "external" to the linker.
THis is perfectly OK. Just check the variables after U-Boot has been relocated to RAM and BSS has been initialized.
I can't. This code is used to initialize the I2C bus, which is used to initialize SPD on DDR, which is obviously done before U-Boot is relocated.
These variables contain the I2C bus number. On some boards, SPD is on bus 0, on some they're on bus 1. So the compile-time initializer needs to be the right bus.
Then you must make sure that even zero-initialized data don't get placed in bss, and your approach was correct.
[It would have been good if you had mentioned this in the opriginal posting.]
Best regards,
Wolfgang Denk