All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.aribaud@free.fr>
To: u-boot@lists.denx.de
Subject: [U-Boot] new uboot with relocation change cannot boot when download the bin file to different address than TEXT_BASE
Date: Sat, 09 Oct 2010 10:57:09 +0200	[thread overview]
Message-ID: <4CB02E65.70205@free.fr> (raw)
In-Reply-To: <AANLkTi=CiNrc1k75Df7G++tUFe2O6=ZRXfShU=xCxs9d@mail.gmail.com>

Le 09/10/2010 10:24, Lei Wen a ?crit :

>> For arm926, TEXT_BASE should be the FLASH location (if booting from NOR) or
>> a location in DRAM (for NAND and other methods).
>
> Yeah, got that. The TEXT_BASE of 0xf00000 in my case is the exactly what I want
> to uboot run during its run time.

Watch out: TEXT_BASE does not define where u-boot will run, only where 
it will *start running*. With relocation, u-boot will run as high in RAM 
as can be.

>> I have had little difficulty in running the .got relocation code in a
>> Marvell oront5x (arm926ejs too), except for some functions called from
>> board_init_f which did not respect the general rule that code run before
>> relocation should only access gd; one place in orion5x wrote to global
>> variables, which always was a no-no and only happened to work because the
>> arm926ejs init sequence did not run in proper order.
>
> Have you tried load the uboot to different place with tftp or something else?
> When I load the uboot to the TEXT_BASE and run, there is also no issue...

Not sure I understand what you mean here. U-boot is assumed to *start* 
located at TEXT_BASE, then moved up in RAM, so there should *never* be 
issues with starting u-boot at its TEXT_BASE.

>> However, .got relocation has shortcomings of its own; mainly, it requires
>> manual fixups in many places within the code. I have provided patches which
>> replace .got relocation with ELF relocation (look up [ELF-RELOC] tags in the
>> posts), which eliminates the need for any manual fixup; you may want to try
>> this, as it might eventually replace the .got patches.
>
> Glad to hear this. :-) But my problem is before relocating, the new scheme call
> the init_sequence in board_init_f, while the TEXT_BASE keep the function entry
> as static value during compile time. Does the ELF relocation could bring us
> a relative jump when call the init_sequence table?

Short answer is relocation brings a way to fix all the code and data for 
correct relocation.

Note however, that when board_init_f runs, relocation has not happened 
yet, but OTOH, board_init_f is running at TEXT_BASE, so no relocation is 
needed yet. We need relocation fixup only once the code is moved to top 
of DRAM, and we want to execute board_init_r there.

If you flash u-boot at its TEXT_BASE intended NOR FLASH location, then 
any issue within board_init_f will probably be caused by the code trying 
to write to a global other than gd.

> Thanks,
> Lei

You're welcome.

Amicalement,
-- 
Albert.

  reply	other threads:[~2010-10-09  8:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-09  5:50 [U-Boot] new uboot with relocation change cannot boot when download the bin file to different address than TEXT_BASE Lei Wen
2010-10-09  6:27 ` Graeme Russ
2010-10-09  6:48   ` Lei Wen
2010-10-09 17:50     ` Wolfgang Denk
2010-10-10  4:33       ` Lei Wen
2010-10-10  6:48         ` Albert ARIBAUD
2010-10-10  6:50         ` Wolfgang Denk
2010-10-10  9:00           ` Lei Wen
2010-10-09  7:43 ` Albert ARIBAUD
2010-10-09  7:53   ` Lei Wen
2010-10-09  8:10     ` Albert ARIBAUD
2010-10-09  8:18       ` Albert ARIBAUD
2010-10-09  8:24       ` Lei Wen
2010-10-09  8:57         ` Albert ARIBAUD [this message]
2010-10-09  9:08           ` Lei Wen
2010-10-09  9:23             ` Albert ARIBAUD

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=4CB02E65.70205@free.fr \
    --to=albert.aribaud@free.fr \
    --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.