[U-Boot] oamp3: bug in clock.c with gcc 4.5.1?

Wolfgang Denk wd at denx.de
Fri Dec 17 15:20:55 CET 2010


Dear Alexander,

in message <4D0B6D1F.8010304 at ahsoftware.de> you wrote:
> 
> I think I've nailed down, why an u-boot compiled with gcc 4.5.1 fails 
> here. Compiling arch/arm/cpu/armv7/omap3/clock.c with
> ...
> That means get_sys_clk_speed() will allways return S12M, at least that 
> is what I'm reading here. And I don't see why gcc should be allowed to 
> optimize that cdiff to a fixed value and therefor returning only S12M.

Well, if you look at the code after preprocessing it looks like this:

struct gptimer *gpt1_base = (struct gptimer *)0x48318000;
...
cstart = (*(volatile unsigned int *)(&gpt1_base->tcrr));
...
cend = (*(volatile unsigned int *)(&gpt1_base->tcrr));
cdiff = cend - cstart;


Eventually that simple definition of readl() is no longer good enough
for recent compilers.  There is probably a very good reason that Linux
uses a "__iormb();" memory barrier in the definition of readl() and
similar macros.

We should probably update "arch/arm/include/asm/io.h" ...

But then, I'm not an expert for ARM.



Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
... Jesus cried with a loud voice: Lazarus, come forth; the bug  hath
been  found  and  thy  program  runneth.  And  he  that was dead came
forth...                              -- John 11:43-44 [version 2.0?]


More information about the U-Boot mailing list