[U-Boot-Users] Side-effects when adding debug output

Wolfgang Denk wd at denx.de
Wed Jul 13 10:42:20 CEST 2005

In message <2D9AB865A49FD511914700105A0EF6790252BD31 at morse.smart.lfk.eads.net> you wrote:
> I want to add some extra output to the functions do_bootm and do_bootm_linux
> because I have problems with the kernel parameters. So i added a few
> printf's to the functions mentioned above. The things that happen now, I do
> not understand:

Don't use printf for debugging here. Use a debugger.

> Parameters of called functions (e.g. like the "int argc" parameter) suddenly
> change to random values. How could that be caused? Has it something to do
> with the stack (overflow or undefined behaviour when using "printf")? 

Passing control to the Linux kernel invoves giving up more  and  more
function  in  U-Boot, including things like overwriting the exception
vector table or so. Adding printf() to the wrong place may have funny
effects. You better know exactly what yuou are doing.

> Or should I use any other function for creating output? (instead of using
> the BDI2k)

Use the BDI2000. That's what it was made for.

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
I wrote my name at the top of the page. I wrote down  the  number  of
the  question  ``1''.  After much reflection I put a bracket round it
thus ``(1)''. But thereafter I could not think of anything  connected
with it that was either relevant or true.
                        - Sir Winston Churchill _My Early Life_ ch. 2

More information about the U-Boot mailing list