diff mbox

[U-Boot] printf("%d") breaks u-boot 2015.01+

Message ID 20150408120957.GA22895@amd
State RFC
Delegated to: Tom Rini
Headers show

Commit Message

Pavel Machek April 8, 2015, 12:09 p.m. UTC
Hi!

> >>maybe this helps? I just stepped into same problem on an am335x,
> >>but had not yet time to look deeper in it ...
> >
> >I did not try the cleanup_before_linux(), but "dcache off" should have
> >same effect, right?
> 
> Hmm.. not exactly... cleanup_before_linux() does also disable the mmu.

Seems like I found the reason. CONFIG_THUMB_BUILD was set, and 
that causes problems in put_dec_trunc() function (and elsewhere).

commit 1602a502985d42bafb58cc6862b469ac03a7d634
Author: Pavel <pavel@ucw.cz>
Date:   Wed Apr 8 14:08:18 2015 +0200

    Disable thumb build; it breaks put_dec_trunc() function on toolchain
    from eldk-5.6 and eldk-5.4, and some other place, too.
    
    Signed-off-by: Pavel Machek <pavel@denx.de>

Comments

Marek Vasut April 8, 2015, 1:13 p.m. UTC | #1
On Wednesday, April 08, 2015 at 02:09:57 PM, Pavel Machek wrote:
> Hi!
> 
> > >>maybe this helps? I just stepped into same problem on an am335x,
> > >>but had not yet time to look deeper in it ...
> > >
> > >I did not try the cleanup_before_linux(), but "dcache off" should have
> > >same effect, right?
> > 
> > Hmm.. not exactly... cleanup_before_linux() does also disable the mmu.
> 
> Seems like I found the reason. CONFIG_THUMB_BUILD was set, and
> that causes problems in put_dec_trunc() function (and elsewhere).
> 
> commit 1602a502985d42bafb58cc6862b469ac03a7d634
> Author: Pavel <pavel@ucw.cz>
> Date:   Wed Apr 8 14:08:18 2015 +0200
> 
>     Disable thumb build; it breaks put_dec_trunc() function on toolchain
>     from eldk-5.6 and eldk-5.4, and some other place, too.
> 
>     Signed-off-by: Pavel Machek <pavel@denx.de>
> 
> diff --git a/include/configs/socfpga_common.h
> b/include/configs/socfpga_common.h index 6d93472..6608d7d 100644
> --- a/include/configs/socfpga_common.h
> +++ b/include/configs/socfpga_common.h
> @@ -11,7 +11,7 @@
>  /* Virtual target or real hardware */
>  #undef CONFIG_SOCFPGA_VIRTUAL_TARGET
> 
> -#define CONFIG_SYS_THUMB_BUILD
> +#undef CONFIG_SYS_THUMB_BUILD
> 
>  #define CONFIG_SOCFPGA

Disabling thumb build to paper over the problem is certainly not
a solution, right? What is the root cause for those problems and
how can we fix it in the right place ?

Best regards,
Marek Vasut
Tom Rini April 8, 2015, 1:49 p.m. UTC | #2
On Wed, Apr 08, 2015 at 02:09:57PM +0200, Pavel Machek wrote:
> Hi!
> 
> > >>maybe this helps? I just stepped into same problem on an am335x,
> > >>but had not yet time to look deeper in it ...
> > >
> > >I did not try the cleanup_before_linux(), but "dcache off" should have
> > >same effect, right?
> > 
> > Hmm.. not exactly... cleanup_before_linux() does also disable the mmu.
> 
> Seems like I found the reason. CONFIG_THUMB_BUILD was set, and 
> that causes problems in put_dec_trunc() function (and elsewhere).
> 
> commit 1602a502985d42bafb58cc6862b469ac03a7d634
> Author: Pavel <pavel@ucw.cz>
> Date:   Wed Apr 8 14:08:18 2015 +0200
> 
>     Disable thumb build; it breaks put_dec_trunc() function on toolchain
>     from eldk-5.6 and eldk-5.4, and some other place, too.
>     
>     Signed-off-by: Pavel Machek <pavel@denx.de>
> 
> diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
> index 6d93472..6608d7d 100644
> --- a/include/configs/socfpga_common.h
> +++ b/include/configs/socfpga_common.h
> @@ -11,7 +11,7 @@
>  /* Virtual target or real hardware */
>  #undef CONFIG_SOCFPGA_VIRTUAL_TARGET
>  
> -#define CONFIG_SYS_THUMB_BUILD
> +#undef CONFIG_SYS_THUMB_BUILD
>  
>  #define CONFIG_SOCFPGA

OK, this is kind of scary.  What is wrong with those toolchains OR how
we're telling them to build things as no, we should be able to use thumb
mode just fine and need to for size reasons in various cases.  If this
is a generic problem then for example, omap4_panda + ELDK 5.4/5.6 just
shouldn't work either and we _must_ use thumb there for at least SPL.
Pavel Machek April 8, 2015, 2 p.m. UTC | #3
On Wed 2015-04-08 15:13:27, Marek Vasut wrote:
> On Wednesday, April 08, 2015 at 02:09:57 PM, Pavel Machek wrote:
> > Hi!
> > 
> > > >>maybe this helps? I just stepped into same problem on an am335x,
> > > >>but had not yet time to look deeper in it ...
> > > >
> > > >I did not try the cleanup_before_linux(), but "dcache off" should have
> > > >same effect, right?
> > > 
> > > Hmm.. not exactly... cleanup_before_linux() does also disable the mmu.
> > 
> > Seems like I found the reason. CONFIG_THUMB_BUILD was set, and
> > that causes problems in put_dec_trunc() function (and elsewhere).
> > 
> > commit 1602a502985d42bafb58cc6862b469ac03a7d634
> > Author: Pavel <pavel@ucw.cz>
> > Date:   Wed Apr 8 14:08:18 2015 +0200
> > 
> >     Disable thumb build; it breaks put_dec_trunc() function on toolchain
> >     from eldk-5.6 and eldk-5.4, and some other place, too.
> > 
> >     Signed-off-by: Pavel Machek <pavel@denx.de>
> > 
> > diff --git a/include/configs/socfpga_common.h
> > b/include/configs/socfpga_common.h index 6d93472..6608d7d 100644
> > --- a/include/configs/socfpga_common.h
> > +++ b/include/configs/socfpga_common.h
> > @@ -11,7 +11,7 @@
> >  /* Virtual target or real hardware */
> >  #undef CONFIG_SOCFPGA_VIRTUAL_TARGET
> > 
> > -#define CONFIG_SYS_THUMB_BUILD
> > +#undef CONFIG_SYS_THUMB_BUILD
> > 
> >  #define CONFIG_SOCFPGA
> 
> Disabling thumb build to paper over the problem is certainly not
> a solution, right?

Well. First questions first: does it work for you? What version and
what compiler?

> What is the root cause for those problems and
> how can we fix it in the right place ?

If I knew what is the root cause, do you think I'd do this?

									Pavel
Pavel Machek April 8, 2015, 2:06 p.m. UTC | #4
On Wed 2015-04-08 09:49:53, Tom Rini wrote:
> On Wed, Apr 08, 2015 at 02:09:57PM +0200, Pavel Machek wrote:
> > Hi!
> > 
> > > >>maybe this helps? I just stepped into same problem on an am335x,
> > > >>but had not yet time to look deeper in it ...
> > > >
> > > >I did not try the cleanup_before_linux(), but "dcache off" should have
> > > >same effect, right?
> > > 
> > > Hmm.. not exactly... cleanup_before_linux() does also disable the mmu.
> > 
> > Seems like I found the reason. CONFIG_THUMB_BUILD was set, and 
> > that causes problems in put_dec_trunc() function (and elsewhere).
> > 
> > commit 1602a502985d42bafb58cc6862b469ac03a7d634
> > Author: Pavel <pavel@ucw.cz>
> > Date:   Wed Apr 8 14:08:18 2015 +0200
> > 
> >     Disable thumb build; it breaks put_dec_trunc() function on toolchain
> >     from eldk-5.6 and eldk-5.4, and some other place, too.
> >     
> >     Signed-off-by: Pavel Machek <pavel@denx.de>
> > 
> > diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
> > index 6d93472..6608d7d 100644
> > --- a/include/configs/socfpga_common.h
> > +++ b/include/configs/socfpga_common.h
> > @@ -11,7 +11,7 @@
> >  /* Virtual target or real hardware */
> >  #undef CONFIG_SOCFPGA_VIRTUAL_TARGET
> >  
> > -#define CONFIG_SYS_THUMB_BUILD
> > +#undef CONFIG_SYS_THUMB_BUILD
> >  
> >  #define CONFIG_SOCFPGA
> 
> OK, this is kind of scary.  What is wrong with those toolchains OR how
> we're telling them to build things as no, we should be able to use thumb
> mode just fine and need to for size reasons in various cases.

Well.. it is scary, as put_dec_trunc() is very straightforward
function. It works in 2014.10, even with thumb on.

> If this
> is a generic problem then for example, omap4_panda + ELDK 5.4/5.6 just
> shouldn't work either and we _must_ use thumb there for at least SPL.

I don't know enough about thumb in u-boot. And yes, I'd like people to
confirm if u-boot works for them on socfpga...

									Pavel
Tom Rini April 8, 2015, 3:53 p.m. UTC | #5
On Wed, Apr 08, 2015 at 04:06:34PM +0200, Pavel Machek wrote:
> On Wed 2015-04-08 09:49:53, Tom Rini wrote:
> > On Wed, Apr 08, 2015 at 02:09:57PM +0200, Pavel Machek wrote:
> > > Hi!
> > > 
> > > > >>maybe this helps? I just stepped into same problem on an am335x,
> > > > >>but had not yet time to look deeper in it ...
> > > > >
> > > > >I did not try the cleanup_before_linux(), but "dcache off" should have
> > > > >same effect, right?
> > > > 
> > > > Hmm.. not exactly... cleanup_before_linux() does also disable the mmu.
> > > 
> > > Seems like I found the reason. CONFIG_THUMB_BUILD was set, and 
> > > that causes problems in put_dec_trunc() function (and elsewhere).
> > > 
> > > commit 1602a502985d42bafb58cc6862b469ac03a7d634
> > > Author: Pavel <pavel@ucw.cz>
> > > Date:   Wed Apr 8 14:08:18 2015 +0200
> > > 
> > >     Disable thumb build; it breaks put_dec_trunc() function on toolchain
> > >     from eldk-5.6 and eldk-5.4, and some other place, too.
> > >     
> > >     Signed-off-by: Pavel Machek <pavel@denx.de>
> > > 
> > > diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
> > > index 6d93472..6608d7d 100644
> > > --- a/include/configs/socfpga_common.h
> > > +++ b/include/configs/socfpga_common.h
> > > @@ -11,7 +11,7 @@
> > >  /* Virtual target or real hardware */
> > >  #undef CONFIG_SOCFPGA_VIRTUAL_TARGET
> > >  
> > > -#define CONFIG_SYS_THUMB_BUILD
> > > +#undef CONFIG_SYS_THUMB_BUILD
> > >  
> > >  #define CONFIG_SOCFPGA
> > 
> > OK, this is kind of scary.  What is wrong with those toolchains OR how
> > we're telling them to build things as no, we should be able to use thumb
> > mode just fine and need to for size reasons in various cases.
> 
> Well.. it is scary, as put_dec_trunc() is very straightforward
> function. It works in 2014.10, even with thumb on.
> 
> > If this
> > is a generic problem then for example, omap4_panda + ELDK 5.4/5.6 just
> > shouldn't work either and we _must_ use thumb there for at least SPL.
> 
> I don't know enough about thumb in u-boot. And yes, I'd like people to
> confirm if u-boot works for them on socfpga...

I'll fire up ELDK 5.4 + Pandaboard later today (which uses thumb) but I
think you need to bisect down to when exactly things break since my gut
is telling me it's not toolchain / thumb but something else that broke
things.
Pavel Machek April 8, 2015, 4:06 p.m. UTC | #6
On Wed 2015-04-08 11:53:38, Tom Rini wrote:
> On Wed, Apr 08, 2015 at 04:06:34PM +0200, Pavel Machek wrote:
> > On Wed 2015-04-08 09:49:53, Tom Rini wrote:
> > > On Wed, Apr 08, 2015 at 02:09:57PM +0200, Pavel Machek wrote:
> > > > Hi!
> > > > 
> > > > > >>maybe this helps? I just stepped into same problem on an am335x,
> > > > > >>but had not yet time to look deeper in it ...
> > > > > >
> > > > > >I did not try the cleanup_before_linux(), but "dcache off" should have
> > > > > >same effect, right?
> > > > > 
> > > > > Hmm.. not exactly... cleanup_before_linux() does also disable the mmu.
> > > > 
> > > > Seems like I found the reason. CONFIG_THUMB_BUILD was set, and 
> > > > that causes problems in put_dec_trunc() function (and elsewhere).
> > > > 
> > > > commit 1602a502985d42bafb58cc6862b469ac03a7d634
> > > > Author: Pavel <pavel@ucw.cz>
> > > > Date:   Wed Apr 8 14:08:18 2015 +0200
> > > > 
> > > >     Disable thumb build; it breaks put_dec_trunc() function on toolchain
> > > >     from eldk-5.6 and eldk-5.4, and some other place, too.
> > > >     
> > > >     Signed-off-by: Pavel Machek <pavel@denx.de>
> > > > 
> > > > diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
> > > > index 6d93472..6608d7d 100644
> > > > --- a/include/configs/socfpga_common.h
> > > > +++ b/include/configs/socfpga_common.h
> > > > @@ -11,7 +11,7 @@
> > > >  /* Virtual target or real hardware */
> > > >  #undef CONFIG_SOCFPGA_VIRTUAL_TARGET
> > > >  
> > > > -#define CONFIG_SYS_THUMB_BUILD
> > > > +#undef CONFIG_SYS_THUMB_BUILD
> > > >  
> > > >  #define CONFIG_SOCFPGA
> > > 
> > > OK, this is kind of scary.  What is wrong with those toolchains OR how
> > > we're telling them to build things as no, we should be able to use thumb
> > > mode just fine and need to for size reasons in various cases.
> > 
> > Well.. it is scary, as put_dec_trunc() is very straightforward
> > function. It works in 2014.10, even with thumb on.
> > 
> > > If this
> > > is a generic problem then for example, omap4_panda + ELDK 5.4/5.6 just
> > > shouldn't work either and we _must_ use thumb there for at least SPL.
> > 
> > I don't know enough about thumb in u-boot. And yes, I'd like people to
> > confirm if u-boot works for them on socfpga...
> 
> I'll fire up ELDK 5.4 + Pandaboard later today (which uses thumb) but I
> think you need to bisect down to when exactly things break since my gut
> is telling me it's not toolchain / thumb but something else that broke
> things.

Thanks.

Well, it broke between 2014.10 and 2015.01, so I think it should be
toolchain (because broken socfpga for >4 months... someone would
notice, no?).

Marek told me I should mention... I'm using USE_PRIVATE_LIBGCC because
compilation does not work without that.

Best regards,
									Pavel
Tom Rini April 8, 2015, 4:08 p.m. UTC | #7
On Wed, Apr 08, 2015 at 11:53:38AM -0400, Tom Rini wrote:
> On Wed, Apr 08, 2015 at 04:06:34PM +0200, Pavel Machek wrote:
> > On Wed 2015-04-08 09:49:53, Tom Rini wrote:
> > > On Wed, Apr 08, 2015 at 02:09:57PM +0200, Pavel Machek wrote:
> > > > Hi!
> > > > 
> > > > > >>maybe this helps? I just stepped into same problem on an am335x,
> > > > > >>but had not yet time to look deeper in it ...
> > > > > >
> > > > > >I did not try the cleanup_before_linux(), but "dcache off" should have
> > > > > >same effect, right?
> > > > > 
> > > > > Hmm.. not exactly... cleanup_before_linux() does also disable the mmu.
> > > > 
> > > > Seems like I found the reason. CONFIG_THUMB_BUILD was set, and 
> > > > that causes problems in put_dec_trunc() function (and elsewhere).
> > > > 
> > > > commit 1602a502985d42bafb58cc6862b469ac03a7d634
> > > > Author: Pavel <pavel@ucw.cz>
> > > > Date:   Wed Apr 8 14:08:18 2015 +0200
> > > > 
> > > >     Disable thumb build; it breaks put_dec_trunc() function on toolchain
> > > >     from eldk-5.6 and eldk-5.4, and some other place, too.
> > > >     
> > > >     Signed-off-by: Pavel Machek <pavel@denx.de>
> > > > 
> > > > diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
> > > > index 6d93472..6608d7d 100644
> > > > --- a/include/configs/socfpga_common.h
> > > > +++ b/include/configs/socfpga_common.h
> > > > @@ -11,7 +11,7 @@
> > > >  /* Virtual target or real hardware */
> > > >  #undef CONFIG_SOCFPGA_VIRTUAL_TARGET
> > > >  
> > > > -#define CONFIG_SYS_THUMB_BUILD
> > > > +#undef CONFIG_SYS_THUMB_BUILD
> > > >  
> > > >  #define CONFIG_SOCFPGA
> > > 
> > > OK, this is kind of scary.  What is wrong with those toolchains OR how
> > > we're telling them to build things as no, we should be able to use thumb
> > > mode just fine and need to for size reasons in various cases.
> > 
> > Well.. it is scary, as put_dec_trunc() is very straightforward
> > function. It works in 2014.10, even with thumb on.
> > 
> > > If this
> > > is a generic problem then for example, omap4_panda + ELDK 5.4/5.6 just
> > > shouldn't work either and we _must_ use thumb there for at least SPL.
> > 
> > I don't know enough about thumb in u-boot. And yes, I'd like people to
> > confirm if u-boot works for them on socfpga...
> 
> I'll fire up ELDK 5.4 + Pandaboard later today (which uses thumb) but I
> think you need to bisect down to when exactly things break since my gut
> is telling me it's not toolchain / thumb but something else that broke
> things.

Panda + ELDK 5.4, which sets CONFIG_SYS_THUMB_BUILD for both SPL and
U-Boot boots up fine on top of tree, cold boot tested even.
Tom Rini April 8, 2015, 4:43 p.m. UTC | #8
On Wed, Apr 08, 2015 at 06:06:08PM +0200, Pavel Machek wrote:
> On Wed 2015-04-08 11:53:38, Tom Rini wrote:
> > On Wed, Apr 08, 2015 at 04:06:34PM +0200, Pavel Machek wrote:
> > > On Wed 2015-04-08 09:49:53, Tom Rini wrote:
> > > > On Wed, Apr 08, 2015 at 02:09:57PM +0200, Pavel Machek wrote:
> > > > > Hi!
> > > > > 
> > > > > > >>maybe this helps? I just stepped into same problem on an am335x,
> > > > > > >>but had not yet time to look deeper in it ...
> > > > > > >
> > > > > > >I did not try the cleanup_before_linux(), but "dcache off" should have
> > > > > > >same effect, right?
> > > > > > 
> > > > > > Hmm.. not exactly... cleanup_before_linux() does also disable the mmu.
> > > > > 
> > > > > Seems like I found the reason. CONFIG_THUMB_BUILD was set, and 
> > > > > that causes problems in put_dec_trunc() function (and elsewhere).
> > > > > 
> > > > > commit 1602a502985d42bafb58cc6862b469ac03a7d634
> > > > > Author: Pavel <pavel@ucw.cz>
> > > > > Date:   Wed Apr 8 14:08:18 2015 +0200
> > > > > 
> > > > >     Disable thumb build; it breaks put_dec_trunc() function on toolchain
> > > > >     from eldk-5.6 and eldk-5.4, and some other place, too.
> > > > >     
> > > > >     Signed-off-by: Pavel Machek <pavel@denx.de>
> > > > > 
> > > > > diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
> > > > > index 6d93472..6608d7d 100644
> > > > > --- a/include/configs/socfpga_common.h
> > > > > +++ b/include/configs/socfpga_common.h
> > > > > @@ -11,7 +11,7 @@
> > > > >  /* Virtual target or real hardware */
> > > > >  #undef CONFIG_SOCFPGA_VIRTUAL_TARGET
> > > > >  
> > > > > -#define CONFIG_SYS_THUMB_BUILD
> > > > > +#undef CONFIG_SYS_THUMB_BUILD
> > > > >  
> > > > >  #define CONFIG_SOCFPGA
> > > > 
> > > > OK, this is kind of scary.  What is wrong with those toolchains OR how
> > > > we're telling them to build things as no, we should be able to use thumb
> > > > mode just fine and need to for size reasons in various cases.
> > > 
> > > Well.. it is scary, as put_dec_trunc() is very straightforward
> > > function. It works in 2014.10, even with thumb on.
> > > 
> > > > If this
> > > > is a generic problem then for example, omap4_panda + ELDK 5.4/5.6 just
> > > > shouldn't work either and we _must_ use thumb there for at least SPL.
> > > 
> > > I don't know enough about thumb in u-boot. And yes, I'd like people to
> > > confirm if u-boot works for them on socfpga...
> > 
> > I'll fire up ELDK 5.4 + Pandaboard later today (which uses thumb) but I
> > think you need to bisect down to when exactly things break since my gut
> > is telling me it's not toolchain / thumb but something else that broke
> > things.
> 
> Thanks.
> 
> Well, it broke between 2014.10 and 2015.01, so I think it should be
> toolchain (because broken socfpga for >4 months... someone would
> notice, no?).
> 
> Marek told me I should mention... I'm using USE_PRIVATE_LIBGCC because
> compilation does not work without that.

I think the answer is that it's bisect time.
Pavel Machek April 13, 2015, 11:12 a.m. UTC | #9
Hi!

Is there equivalent of "socfpga sdram_applycfg" in mainline u-boot? If
not, does anyone have a patch porting functionality forward? If not
would it be ok to create "socfpga" command with sdram_applycfg
subcommand, or would different interface be preffered?

Best regards,
									Pavel
Marek Vasut April 13, 2015, 11:24 a.m. UTC | #10
On Monday, April 13, 2015 at 01:12:06 PM, Pavel Machek wrote:
> Hi!
> 
> Is there equivalent of "socfpga sdram_applycfg" in mainline u-boot? If
> not, does anyone have a patch porting functionality forward? If not
> would it be ok to create "socfpga" command with sdram_applycfg
> subcommand, or would different interface be preffered?

Doesn't "bridge enable" do something along those lines ?

btw please DO FIX YOUR MAILER . It's the second time the email is in-reply-to 
some completely unrelated thread. This is really annoying.

Best regards,
Marek Vasut
Stefan Roese April 13, 2015, 11:29 a.m. UTC | #11
On 13.04.2015 13:24, Marek Vasut wrote:
> On Monday, April 13, 2015 at 01:12:06 PM, Pavel Machek wrote:
>> Hi!
>>
>> Is there equivalent of "socfpga sdram_applycfg" in mainline u-boot? If
>> not, does anyone have a patch porting functionality forward? If not
>> would it be ok to create "socfpga" command with sdram_applycfg
>> subcommand, or would different interface be preffered?
>
> Doesn't "bridge enable" do something along those lines ?

Yes, "bridge enable" does replace this quite ugly jump into some U-boot 
code from the earlier U-Boot versions. It does work for me quite good.

Thanks,
Stefan
diff mbox

Patch

diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
index 6d93472..6608d7d 100644
--- a/include/configs/socfpga_common.h
+++ b/include/configs/socfpga_common.h
@@ -11,7 +11,7 @@ 
 /* Virtual target or real hardware */
 #undef CONFIG_SOCFPGA_VIRTUAL_TARGET
 
-#define CONFIG_SYS_THUMB_BUILD
+#undef CONFIG_SYS_THUMB_BUILD
 
 #define CONFIG_SOCFPGA