public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jerry Van Baren <gvb.uboot@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] 'Relocation' for sc520 (i386) based boards
Date: Sun, 21 Sep 2008 13:29:47 -0400	[thread overview]
Message-ID: <48D6848B.3000900@gmail.com> (raw)
In-Reply-To: <48D600F8.9080801@gmail.com>

Graeme Russ wrote:
> Hi All,
> 
> I've been thinking about where U-Boot runs in memory on my sc520
> based board and it appears that it is always executing from ROM and
> I started pondering if I should attempt to relocate U-Boot into RAM.

Yes.  All u-boot ports that I am aware of relocate themselves and run 
out of RAM.

> Note: Please correct me if I am mistaken and U-Boot does indeed run
> from RAM on i386 / sc520

It should.  This may be the next layer of your onion.

> This, of course, would give me the benefit of having unfettered access
> to the flash that U-Boot is located on for things like environment
> storage, upgrade in place etc.
> 
> My thought is to not actually 'Relocate' U-Boot but to use a very
> handy feature of the sc520 - The ability to map the BOOTCS (Boot ROM
> Chip Select) to anywhere in memory using a PAR (Programmable Address
> Region).

I'm not competent to help/advise you on your sc520 BOOTCS feature, but 
would suggest that staying in the mainstream will be much easier in the 
long term.  The mainstream is to use the existing code to block copy 
u-boot to RAM, do some relocation fixups, and then run out of RAM.

[snip]

> One problem I can think of is that the linker will point all the jump
> labels into RAM - not an issue for the 16-bit code which uses relative
> jumps, but I think I may run into issues during the real to protected
> mode transition (far jump) which, by definition, has to happen before
> I get access to the full memory space. How do I tell the linker that
> these jumps should target 0x38040000+ and not 0x08040000+ ?

I'm not sure how this works for u-boot on an x86 target.  Fully 
relocatable is the preferable link policy.  IIRC, usually x86 programs 
can be linked to be fully relocatable - the code can exceed +/-32K and 
still work, as long as each call is within +/-32K of the target label.

There is a small piece of u-boot that runs in ROM that copies it to RAM 
and then does a jump to it.  This will have to be a far jump in x86.  I 
also recall that the transition from reset mode to full 32 bit mode is a 
real PITA (was there once, don't care to return ;-), but I would expect 
that already exists in the u-boot x86 port.  Actually, I would expect 
the transition to "protected" mode and the jump to RAM are one and the same.

Otherwise your execution location has to be fixed (in RAM) - it seems 
like some targets (arm?) have this limitation.

> Does all this sound logical? viable? sensible? practical?
> 
> Regards,
> 
> Graeme

Good luck,
gvb

  reply	other threads:[~2008-09-21 17:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-21  8:08 [U-Boot] 'Relocation' for sc520 (i386) based boards Graeme Russ
2008-09-21 17:29 ` Jerry Van Baren [this message]
2008-09-21 23:18   ` Graeme Russ
2008-09-22 12:51     ` Graeme Russ
2008-09-22 12:52   ` Graeme Russ
2008-09-22 12:57     ` Graeme Russ
  -- strict thread matches above, loose matches on Subject: below --
2008-09-23  6:58 yusuf khan

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=48D6848B.3000900@gmail.com \
    --to=gvb.uboot@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox