[U-Boot-Users] Why are some global vars part of the image, and some not?
Wolfgang Denk
wd at denx.de
Mon Nov 6 22:15:21 CET 2006
In message <454F9FB2.8090009 at freescale.com> you wrote:
>
> However, with the current u-boot linker scripts (some of them, at least;
> I'm not going to make a sweeping statement about all 270), data
> *explicitly* initialized to zero is also going in the bss. Combined
Yes, and this is perfectly fine from the ANSI C standard point of
view. The situation is that we don;t have a standard C environment
yet, so you must not insist on being able to use standard C.
> with the fact that some C code is executed before the bss is cleared,
> that is simply evil.
It is one of several restrictions. There are many more. For example,
you cannot write any data in the data segment either. And you cannot
put big data structures on the stack. And you have to keep in mind
that you must not nest function calls too deeply because thestack
size is very limited. And... and...
It's IMHO nensense to figt this situation, you just make it worse.
Insted, please focus on moving all complex code *after* relocation,
where all these problems go away automagically.
> I have stated the reason. If you prefer an environment that invites
> bugs and ugly workarounds thereto, then suit yourself.
You don't fix anything but one special case (the initial assignment
of a zero). Any later assignments to the same variable will still
fail. If this deems OK to you, then please just use "#define foo 0"
instead of "int foo=0;"
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Software suppliers are trying to make their software packages more
``user-friendly''. . . . Their best approach, so far, has been to
take all the old brochures, and stamp the words, ``user-friendly'' on
the cover. - Bill Gates
More information about the U-Boot
mailing list