[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:03:02 CET 2006
Scott Wood wrote:
> Wolfgang Denk wrote:
>> In message <454BEF23.1020909 at freescale.com> you wrote:
>>
>>> What about modifying the linker script so that all of bss is merged into
>>> the image, i.e. treat it like 'data'?
>>
>> That would mean that you have to allocate flash memory for all this
>> stuff, which is typically in the 100...150 kB range, i. e. you would
>> double the memory footprint of U-Boot in flash memory.,
>
> That seems rather ridiculously large... perhaps some of the larger
> chunks of that could be dynamically allocated, rather than leaving a
> giant welcome mat for bugs by executing C code before the BSS is cleared
> (especially if, as it appears to be in this case, the compiler and/or
> linker is putting things in the BSS even when explicitly initialized to
> zero, rather than just left uninitialized)?
>
> BTW, I'm only seeing about 19kB of BSS on an 8349EMDS build from the
> current git head.
>
>> No, this is NOT acceptable. Don't even think of it.
>
> I don't think refusing to think about alternatives is conducive to good
> software engineering.
>
> -Scott
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. The stuff you
are doing is very early initialization - using I2C to read SPD, which is
before you even _have_ a normal bss because you don't even have your
SDRAM active at this point.
Welcome to the Wacky World of Embedded where you must do everything
yourself, and the world is populated with very sharp objects waiting to
nail you if you do anything wrong.
gvb
More information about the U-Boot
mailing list