
On Mon, 6 Dec 2010 21:42:28 +0100 Joakim Tjernlund joakim.tjernlund@transmode.se wrote:
Wolfgang Denk wd@denx.de wrote on 2010/12/06 21:09:47:
Dear Joakim Tjernlund,
In message 1291658370-26367-1-git-send-email-Joakim.Tjernlund@transmode.se you wrote:
init_sequence is an array with function pointers which are really hard to follow when you need to debug this area. Turn it into plain function calls instead which makes the code a bit uglier but I find the simpler debugging much more valuable.
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 though the loop is cumbersome and not easy as BDI tends to flush the cache when it stops so you loose your stack. 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.
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 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 think it's easier with the function pointers -- if you want to debug a hang in that phase of the boot, just have the loop print the address of each function before it calls it.
-Scott