[U-Boot] Build failures with older toolchain
Premi, Sanjeev
premi at ti.com
Tue Nov 30 15:25:50 CET 2010
> -----Original Message-----
> From: u-boot-bounces at lists.denx.de
> [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Premi, Sanjeev
> Sent: Monday, November 29, 2010 8:38 PM
> To: Wolfgang Denk
> Cc: u-boot at lists.denx.de
> Subject: Re: [U-Boot] Build failures with older toolchain
>
[snip]...[snip]
> > >
> > > I am process of downloading the 2009q3 version from
> > codesourcery
> > > Albert mentioned he is using it. Are you on the same
> version as
> > > well?
> >
> > No, I'm using ELDk 4.2
>
> [sp] Okay, so I downloaded both 2009-q3 and 2010.09-50 versions of the
> Codesourcery Lite edition.
>
> There is no difference in the observations between
> 2009q3 and 2010q1.
>
[sp] I have been able to narrow down the problem to one variable defined
in board/ti/evm.c - omap3_evm_version - declared as:
static u8 omap3_evm_version;
Any attempt to assign value this variable in omap3_evm_get_revision()
leads to the linker error I noted with Codesourcery 2010q1-202.
With 2009q1-203, definition of variable itself is sufficient to cause
the linker error.
I have pasted a patch below that constructs the testcase I have created
to explain these observations:
1) When macros both _EXCLUDE_ME_1 and _EXCLUDE_ME_2 are undefined, the
problem is - as described.
2) When only macro _EXCLUDE_ME_1 is defined, the compilation succeeds
with Codesourcery 2010q1-202; but fails with 2009q1-203.
3) When both macros _EXCLUDE_ME_1 and _EXCLUDE_ME_2 are defined, the
compilation succeeds with both codesourcery versions.
OMAP3EVM is obviously not the only file using statics. I see their usage
in many files including OMAP3Beagle as well - one reason I did not even
suspect this to be problem.
I haven't yet been able to conclude the cause of failure - but appears
to be related to handling of static variables across compiler versions.
Still need to investigate further on this...
Board revision needs to be detected early during initialization. How is
this handled for other boards? (I am currently trying to browse non-omap
boards for pointers). Any quick suggestions would be helpful.
[patch]
diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index 09d14f7..e766355 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -37,15 +37,30 @@
#include <asm/mach-types.h>
#include "evm.h"
+/* #define _EXCLUDE_ME_1 */ /* Uncomment - works with 2010q1 only */
+/* #define _EXCLUDE_ME_2 */ /* Uncomment - works with 2009q3 as well */
+
+#if !defined(_EXCLUDE_ME_2)
static u8 omap3_evm_version;
+#endif
u8 get_omap3_evm_rev(void)
{
+#ifdef _EXCLUDE_ME_2
+ return OMAP3EVM_BOARD_GEN_1; /* Debugging: Don't use the variable */
+#else
return omap3_evm_version;
+#endif
+
}
static void omap3_evm_get_revision(void)
{
+#ifdef _EXCLUDE_ME_COMPLETELY_
+ /*
+ * Original code in the function is being removed completely to reduce
+ * scope of the debug exercise.
+ */
#if defined(CONFIG_CMD_NET)
/*
* Board revision can be ascertained only by identifying
@@ -80,6 +95,20 @@ static void omap3_evm_get_revision(void)
omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
#endif
#endif /* CONFIG_CMD_NET */
+
+#else
+ /*
+ * Dummy implementation of function just for testing
+ */
+
+#if !defined(_EXCLUDE_ME_1) && !defined(_EXCLUDE_ME_2)
+ /*
+ * Dummy assignment just for testing
+ */
+ omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
+#endif
+
+#endif /* _EXCLUDE_ME_COMPLETELY_ */
}
#ifdef CONFIG_USB_OMAP3
[/patch]
[snip]
Removed my observations for Codesourcery 2010.09-50.
Did not get chance to look at them so far...
[/snip]
Best regards,
Sanjeev
More information about the U-Boot
mailing list