From: Valentin Longchamp <valentin.longchamp@keymile.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [GENERIC_BOARD] env problems before relocation with ppc8360
Date: Tue, 30 Sep 2014 09:03:45 +0200 [thread overview]
Message-ID: <542A55D1.3080902@keymile.com> (raw)
In-Reply-To: <CAPnjgZ3yxwueaOCpd2o__+yLmaRYx1_ACQ_3Y3R8ifYBzMHrfQ@mail.gmail.com>
Hi Simon,
I'm very glad you answered this, I was busy with other stuff these last weeks
but I had planed to pick this issue again this week.
On 09/28/2014 06:27 AM, Simon Glass wrote:
> Hi,
>
> On 26 August 2014 09:17, Valentin Longchamp
> <valentin.longchamp@keymile.com> wrote:
>>
>> Hello,
>>
>> Here is the outcome of my debug session today:
>>
>> On 08/25/2014 05:42 PM, Valentin Longchamp wrote:
>>> Hello,
>>>
>>> I am currently porting all the Keymile boards to CONFIG_SYS_GENERIC_BOARD.
>>> On u-boot 2014.10-rc1 I have all of them working quite well (at least booting
>>> and showing no obvious problem), except for our boards using a MPC8360
>>> from Freescale (kmcoge5ne and kmeter1, both using km8360.h as config) that do
>>> not boot at all.
>>>
>>> I have found out that u-boot crashes as soon as a getenv function call happens
>>> before relocation. When I disable them, u-boot seems to work fine. I am
>>> currently trying to debug further, but it's not clear yet exactly what causes
>>> the crash.
>>
>> So the problem is that for an unknown reason, the gd->flags are not correct and
>> getenv actually calls hsearch_h to look for the desired env variable. This fails
>> before relocation (due to the small stack ?).
>>
>> If I replace the board_f getenv_ulong calls in board_f.c with my getenv_f_ulong
>> function that explicitely calls getenv_f the board boots up nicely.
>>
>> Now the question is, why are my gd->flags not correct/corrupted ? Has someone
>> already seen something similar ? I unfortunateley cannot access gd easily with
>> the BDI, since it is located in the INIT_RAM which is a data cache, for which I
>> have no LAW configured (could work on that).
>
> I just saw this. There is condition code at the start of
> board_init_f() in board_f.c that might exclude your board. So your
> global data might not be zeroed.
>
That's not exactly the problem here, since defining
CONFIG_SYS_GENERIC_GLOBAL_DATA did not solve the problem. However it made me
look at the right place and I have noticed that gd->flags are set in the generic
board_inif_f() and were not in the previous powerpc specific board_init_f(). If
I comment out the gd->flags = boot_flags in the board_init_f() function, then
everything works well.
Since board_init_f() is called from the assembly code (in my case
mpc83xx/start.S), I guess the ulong boot_flags argument ends up being a register
(if the arguments are passed in register ... which I am not sure of for
powerpc). Since prior to the bl board_init_f call in the start.S file, there is
a call another C function (cpu_init_f()), I guess the register passed as
argument has an undefined content ... that ends up in gd->flags.
I think that the best way to fix this is to make sure from start.S that
boot_flags (so the register) has a defined (zeroed ?) content ? But how to make
sure which register it is and that this will not change, since the compiler
comes into play here ?
Valentin
next prev parent reply other threads:[~2014-09-30 7:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-25 15:42 [U-Boot] [GENERIC_BOARD] env problems before relocation with ppc8360 Valentin Longchamp
2014-08-26 15:17 ` Valentin Longchamp
2014-09-28 4:27 ` Simon Glass
2014-09-30 7:03 ` Valentin Longchamp [this message]
2014-10-01 15:27 ` Simon Glass
2014-10-01 15:37 ` York Sun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=542A55D1.3080902@keymile.com \
--to=valentin.longchamp@keymile.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.