
Dear Andreas,
In message 516D52EE.1040402@gmail.com you wrote:
Yes it is independent (or should at least). But there are still slightly different versions:
Yes, I know :-(
---8<--- arch/powerpc/lib/board.c:void __hang(void) arch/powerpc/lib/board.c-{ arch/powerpc/lib/board.c- puts("### ERROR ### Please RESET the board ###\n"); arch/powerpc/lib/board.c- bootstage_error(BOOTSTAGE_ID_NEED_RESET); arch/powerpc/lib/board.c- for (;;) --->8---
This is probably what the generic code should look like.
Note that hang() is not supposed to do anything else, it just hangs the system. If you have a debugger attached, you will be able to do a simple stack backtrace and see exactly where you are hanging, and why.
Well, for this specific board I plan to panic() on wrong hardware detection (which will in turn call hang()). My requirements say that I have to visualize this state then, I thought it would be a good idea to blink some lights in the endless loop in hang() for this specific board.
If you think you need to have specialized code, you are doing something wrong.
Really? How would you solve this requirement?
Turn on the blinking in panic(), before calling hang(). This requires that you have some way to blink a LED when the CPU is hanging in an endlss loop, though.
In general, panic() and hang() are for fatal errors where no way of recovery is possible and where you cannot make any assumptions about remaining (or even allowed) functionality. The puts() and bootstage_*() calls above are already stretching the design pretty far. We should not add more functionality here.
Best regards,
Wolfgang Denk