[U-Boot] [PATCH 0/1] fix some SPL debug builds.

Some boards with SPL fail to build with DEBUG defined. This patch should fix the "undefined reference to `do_reset'".
before with -DDEBUG --------------------- SUMMARY ---------------------------- Boards compiled: 303 Boards with errors: 44 ( da850_am18xxevm da850evm spear300 spear300_nand spear300_usbtty spear300_usbtty_nand spear310 spear310_pnor spear310_nand spear310_usbtty spear310_usbtty_pnor spear310_usbtty_nand spear320 spear320_pnor spear320_nand spear320_usbtty spear320_usbtty_pnor spear320_usbtty_nand spear600 spear600_nand spear600_usbtty spear600_usbtty_nand am335x_evm omap3_overo am3517_evm am3517_crane omap3_beagle omap3_evm omap3_evm_quick_mmc devkit8000 mcx tricorder omap4_panda omap4_sdp4430 omap5_evm harmony seaboard ventana whistler plutux medcom tec paz00 trimslice )
Boards with warnings but no errors: 8 ( VCMA9 smdk2410 top9000eval_xe lschlv2 lsxhl omap5912osk qong top9000eval_xe ) ----------------------------------------------------------
after with -DDEBUG --------------------- SUMMARY ---------------------------- Boards compiled: 303 Boards with errors: 29 ( spear600_nand spear320_nand spear320_usbtty_nand spear310_pnor plutux medcom spear300_usbtty_nand spear320_usbtty_pnor spear300 spear320_pnor spear300_usbtty spear310_usbtty_nand spear320_usbtty spear310_usbtty_pnor spear600 seaboard trimslice spear600_usbtty tec whistler ventana harmony paz00 spear300_nand spear320 spear310 spear310_nand spear310_usbtty spear600_usbtty_nand )
Boards with warnings but no errors: 7 ( lsxhl qong top9000eval_xe lschlv2 VCMA9 omap5912osk smdk2410 ) ----------------------------------------------------------
Jeroen Hofstee (1): lib, panic: don't call do_reset in SPL (debug).
lib/vsprintf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

Several omap boards won't build when DEBUG is defined, SPL build error: "vsprintf.c:791: undefined reference to `do_reset'", since SPL has no commands. Therefore don't call do_reset in SPL. SPL panic will end in an endless loop or call hang if CONFIG_PANIC_HANG is defined.
cc: Tom Rini trini@ti.com Signed-off-by: Jeroen Hofstee jhofstee@victronenergy.com --- lib/vsprintf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index e38a4b7..4fa392d 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -18,7 +18,7 @@ #include <errno.h>
#include <common.h> -#if !defined (CONFIG_PANIC_HANG) +#if !defined(CONFIG_PANIC_HANG) && !defined(CONFIG_SPL_BUILD) #include <command.h> #endif
@@ -786,7 +786,7 @@ void panic(const char *fmt, ...) va_end(args); #if defined (CONFIG_PANIC_HANG) hang(); -#else +#elif !defined(CONFIG_SPL_BUILD) udelay (100000); /* allow messages to go out */ do_reset (NULL, 0, 0, NULL); #endif

On Tue, Aug 14, 2012 at 10:40:50PM +0200, Jeroen Hofstee wrote:
Several omap boards won't build when DEBUG is defined, SPL build error: "vsprintf.c:791: undefined reference to `do_reset'", since SPL has no commands. Therefore don't call do_reset in SPL. SPL panic will end in an endless loop or call hang if CONFIG_PANIC_HANG is defined.
cc: Tom Rini trini@ti.com Signed-off-by: Jeroen Hofstee jhofstee@victronenergy.com
OK, the problem I see with this is it forces a policy on everyone, even non-DEBUG cases. What I'd like to see, and I'll submit the patch, is to document that when debugging SPL one should also set CONFIG_PANIC_HANG as do_reset is often (but it could be defined!) undefined for SPL.

On 15/08/2012 19:11, Tom Rini wrote:
On Tue, Aug 14, 2012 at 10:40:50PM +0200, Jeroen Hofstee wrote:
Several omap boards won't build when DEBUG is defined, SPL build error: "vsprintf.c:791: undefined reference to `do_reset'", since SPL has no commands. Therefore don't call do_reset in SPL. SPL panic will end in an endless loop or call hang if CONFIG_PANIC_HANG is defined.
cc: Tom Rini trini@ti.com Signed-off-by: Jeroen Hofstee jhofstee@victronenergy.com
OK, the problem I see with this is it forces a policy on everyone, even non-DEBUG cases. What I'd like to see, and I'll submit the patch, is to document that when debugging SPL one should also set CONFIG_PANIC_HANG as do_reset is often (but it could be defined!) undefined for SPL.
Right, we have some kind of dependencies. It is always painful if the reason is unknown, and we should document it.
Best regards, Stefano

On 08/14/2012 01:40 PM, Jeroen Hofstee wrote:
Several omap boards won't build when DEBUG is defined, SPL build error: "vsprintf.c:791: undefined reference to `do_reset'", since SPL has no commands. Therefore don't call do_reset in SPL. SPL panic will end in an endless loop or call hang if CONFIG_PANIC_HANG is defined.
cc: Tom Rini trini@ti.com Signed-off-by: Jeroen Hofstee jhofstee@victronenergy.com
lib/vsprintf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index e38a4b7..4fa392d 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -18,7 +18,7 @@ #include <errno.h>
#include <common.h> -#if !defined (CONFIG_PANIC_HANG) +#if !defined(CONFIG_PANIC_HANG) && !defined(CONFIG_SPL_BUILD) #include <command.h> #endif
@@ -786,7 +786,7 @@ void panic(const char *fmt, ...) va_end(args); #if defined (CONFIG_PANIC_HANG) hang(); -#else +#elif !defined(CONFIG_SPL_BUILD) udelay (100000); /* allow messages to go out */ do_reset (NULL, 0, 0, NULL); #endif
Thinking about this more. The point is that today, no one that does SPL has reset ability. I would like to see this changed, slightly. Lets do: #if defined(CONFIG_PANIC_HANG) || defined(CONFIG_SPL_BUILD) #if defined(CONFIG_SPL_BUILD) puts("hanging\n"); #endif hang(); #else ...
And no need to not include command.h I think. This makes it clear that a panic results in hang in SPL so that in the future, should someone depend on other behavior it's at least saying why we aren't resetting which is my concern.

Dear Tom Rini,
In message 5037D648.1050808@ti.com you wrote:
And no need to not include command.h I think. This makes it clear that a panic results in hang in SPL so that in the future, should someone depend on other behavior it's at least saying why we aren't resetting which is my concern.
I think a panic should always reset by default. hang() is something the user has explicitly ask for, it should not be used as the default case.
Best regards,
Wolfgang Denk
participants (4)
-
Jeroen Hofstee
-
Stefano Babic
-
Tom Rini
-
Wolfgang Denk