[U-Boot-Users] Why are some global vars part of the image, and some not?

Jerry Van Baren gerald.vanbaren at smiths-aerospace.com
Mon Nov 6 19:48:19 CET 2006

Timur Tabi wrote:
> Jerry Van Baren wrote:
>> You don't understand, u-boot _is_ what zeros bss so, until u-boot is 
>> running enough to zero bss, bss will be random garbage. 
> If BSS were merged into the DATA segment, then the compiler would be the 
> one that zeros BSS.  Basically, BSS would go away, and all global 
> variables (static or otherwise) would be placed into DATA.  They would 
> be initialized to zeros by the compiler, and when the image is burned 
> into flash, that image would have zeros in those memory locations.
> This would also allow us to delete the BSS-initialization code in U-Boot.
> I'm not advocating that we should implement this idea.  I just wanted to 
> clarify things.

In theory, yes.  In practice, I have my doubts that it is workable, let 
alone a better way.  Writing "then the compiler would be the one that 
zeros BSS" is easy, actually making it work may be tricky.  IMHO, there 
are more profitable windmills to tilt.  :-)


More information about the U-Boot mailing list