[U-Boot] [PATCH v2] ARMV7: Add support For Logic OMAP35x/DM37x modules

Wolfgang Denk wd at denx.de
Sun Dec 18 13:33:13 CET 2011


Dear Igor Grinberg,

In message <4EEDABA8.4010409 at compulab.co.il> you wrote:
> 
> > As for the function, in arch/arm/cpu/armv7/omap3/board.c there's already
> > a checkboard() function that is called early (before relocation) that

And keep in mind: before relocation means that the BSS segment is not
available, and data segment is read-only.  [You may be lucky on some
systems that things appear to be different, but this is nothing you
should take granted, and it is definitely nothing that should be used
for common code.]

> > code aborts when it tries to set gd->bd->bi_arch_number.  I then tried
> > storing the value in a global and then set gd->bd->bi_arch_number in
> > board_init(), but between the call to checkboard() and board_init() the
> > BSS section is zeroed.  If I stored/load the computed bi_arch_number
> > into a non-zero static value it works, but I feel that is really fragile.

It is not only fragile, but broken.  See above: the data ssegment must
not be written before relocation.

> This make me wonder, should we move the checkboard() call further
> in the init sequence?

No, it should not.  It is part of the very early init code, and should
remain where it is.  Just don't add any code that does not belong
there.

> Also, the struct bd_info (bd_t) should have the board data and
> ironically it is not available in checkboard() function.

I don't see what is ironically about thaat.  bd_info does not exist at
that point of time.  You misinterpret the purpose of the checkboard()
function, it seems.

> So, Albert, Wolfgang,
> the question is, should we move the checkboard() call after
> the gd->bd pointer initialization or are there any cases
> where it is not appropriate?

Please leave as is, it is perfectly intentional.  Just don't place any
code in checkboard() which does not fit there.

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
A stone was placed at a ford in a river with the inscription:
"When this stone is covered it is dangerous to ford here."


More information about the U-Boot mailing list