public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Graeme Russ <graeme.russ@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] FPGA relocation/C environment
Date: Sat, 31 Oct 2009 10:16:00 +1100	[thread overview]
Message-ID: <4AEB73B0.7010000@gmail.com> (raw)
In-Reply-To: <20091030131112.GL3216@leila.ping.de>

Wolfgang Wegner wrote:
> Hi,
> 
> thank you all for all the comments so far.
> 
> It seems I have at least 2 problems:
> - my gcc (m68k-elf-gcc (Sourcery G++ Lite 4.3-208) 4.3.3) does not
>   produce correctly relocatable code; no matter if I give -fPIC or
>   not (-mrelocatable is not accepted at all), I do not get any
>   entries in .got2 or .fixup, only .got

-mreloctable only applies to PPC CPUs - not version of gcc will give you
.got2 and .fixup unless you are building for PPC

>   However, there still may be anything wrong in my conclusion,
>   because I can use this compiler to compile uClinux-dist-20071107
>   and get working applications (which, as far as I understand, have
>   to be relocated at runtime, too, but I do not know if any of these
>   use such features as statically initialized function pointers that
>   I have in the U-Boot fpga code...).

They are build and linked as pic or pie (position independent executable)
This puts information in the elf binary that the dynamic loader/linker
can user to modify the executable as it is loaded into memory to enable
it to run at the target load address

> - the current coldfire startup code (at least for MCF532x/MCF537x)
>   would not handle these sections even if they existed - however,
>   this seems to be rather easily (i.e. maybe even I could do it)
>   fixed, looking at the ppc examples.

You might want to look at the x86 example instead. I posted a patch a
while ago (http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/68923)

> 
> I will first live with the problem (relocating the fpga struct pointers
> in my own board code, where it is filled anyways - for coldfire,
> gd->reloc_off is still present) and see if I can get hold of a better
> gcc version.

Yes, this manual 'fixup' will work, but the long term goal is to remove
this

> I tried gcc-4.4.1, but was unable to compile one of U-Boot or uClinux,
> so switched back to this one which I found to compile (old and current)
> U-Boot, old uClinux _and_ support mcf5445x, which I am designing in
> now...
> 
> Thank you and sorry for my stupid questions.

Not stupid at all - Proper relocation can be very tricky to achieve. I
spent a _long_ time getting it to work for x86, and in the end the
solution is rather trivial - Have a search through the u-boot mailing
list ;)

> 
> Regards,
> Wolfgang
> 

Regards,

Graeme

  reply	other threads:[~2009-10-30 23:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-29  8:21 [U-Boot] FPGA relocation/C environment Wolfgang Wegner
2009-10-29 11:00 ` Wolfgang Denk
2009-10-29 12:04   ` Wolfgang Wegner
2009-10-29 13:08   ` Joakim Tjernlund
2009-10-29 13:41     ` Wolfgang Wegner
2009-10-29 14:22       ` Joakim Tjernlund
2009-10-29 15:00         ` Wolfgang Wegner
2009-10-29 15:44           ` Wolfgang Wegner
2009-10-29 16:39             ` Joakim Tjernlund
2009-10-30 13:11               ` Wolfgang Wegner
2009-10-30 23:16                 ` Graeme Russ [this message]
2009-10-29 15:47           ` Joakim Tjernlund

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=4AEB73B0.7010000@gmail.com \
    --to=graeme.russ@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