[U-Boot] [PATCH] ppc: transform init_sequence into a function.

Joakim Tjernlund
2010-12-07T00:32:08Z

Wolfgang Denk <wd@denx.de> wrote on 2010/12/06 23:36:21:
>
> Dear Joakim Tjernlund,
>
> In message <OFEE7ADEEA.47556DD1-ONC12577F1.006FAF8D-C12577F1.0071C097@transmode.se> you wrote:
> >
> > > This is indeed much uglier. What exactly is your problem with
> > > debugging the existing code?
> >
> > Whenever I screw up so that one of the init funcs crashes, often without
> > any trace on the RS232 port you don't know which one. Single stepping
>
> Well, we turn on the serial ports as early as possible, so ther eis
> only a pretty small collection that is candidate for such a situation.

But that won't help much. When you don't have any output it can be any
reason. I really want to see where it breaks down. That will tell me more
about what I did wrong earlier. It is easy to guess where when
you a playing with these function, but when you are trying to understand why
your latest relocation fixes doesn't work, it is a different game.

>
> > though the loop is cumbersome and not easy as BDI tends to
> > flush the cache when it stops so you loose your stack.
>
> Does it? On which architecture / processor is this?

MPC8321 and BDI2000. I have to play games with some internal
BDI command called SAP. Maybe they have fixed this in later models?

>
> > The other way is to look up one those funs and set a BP there and hope
> > for the best. Then repeat with the next function and so on.
> > Compare that with just setting a BP in the new init_sequence(), it is
> > fast and easy to move around.
>
> ...but ugly to read. And if you really want to introduce this style,
> it has to be done for all architectures, as I want to see this code to
> become common across architectures.

That is the next issue, lets not stray from the path ..

>
> > I don't think you have been chasing bugs in this area for a long time,
> > if you had, you would appreciate how easy it is with functions
> > compared with a bunch of function ptrs.
>
> I haven't, lately, that's true, or when I had, I always knew pretty
> well where I had to expect the issues. But I've been there before,
> many, many times.

And you never found it annoying when you hit these function ptrs?

>
> > I don't think this is much uglier, just a bit, but far more
> > useful and I have a hard time buying into "beautiful trumps usefulness".
>
> I'm not convinced that your code is actually a general improvement. I
> understand that it's useful for you, and your style of debugging.
> If you are really hanging in this area, then maybe a debug() is more
> prowerfull - and less invasive.

Now you are proposing that I instrument the code, much like Scott and his
print of address idea. This is exactly what I want to avoid as it would
probably have to be adapted from case to case and there is always the
case when there is no output and then I am back to square zero again.

The argument that it is uglier alone is not a very good one.
Image the roles were reversed, I am sure you would dismiss me as
"less beautiful" is really not an argument alone.

Jocke