[Efi332] Building newlib/libgloss for MPC555

David Eicher sailors3
Fri Jul 29 12:18:00 UTC 2005


Progress! Thanks much for all your help, I have modified libgloss, built the
library, and installed it.

Next step is to figure out how to configure my build of my target code to
use gcc linking rather than ld, then build my target code and test. 

Thanks again for all the input here.

Regards,

Dave


-----Original Message-----
From: efi332-bounces at diy-efi.org [mailto:efi332-bounces at diy-efi.org] On
Behalf Of Gunter Magin
Sent: Tuesday, July 26, 2005 10:55 PM
To: efi332 at diy-efi.org
Subject: Re: [Efi332] Building newlib/libgloss for MPC555

On Tue, Jul 26, 2005 at 08:03:12PM -0700, David Eicher wrote:
> Well, I ran the install, it installed in my compiler directory
> (powerpc-elf), so I moved the lib and include directories to
> usr/local/lib/powerpc-elf/lib and usr/local/lib/powerpc-elf/include. It's
> amazing I've got this far, thanks much for all the help. 

I am not sure if you got that right in all the details, as from the
paths you reported, the install run shouldn't have put it into the
wrk directory /usr/local/powerpc-elf/ppc-aout, and also not under
/usr/local/powerpc-elf/newlib-1.13.0. What bothered you seems that it
installed it into /usr/local/powerpc-elf, but that is exactly where
it should live. IMHO it would be more safe if you had your source and
work directories somewhere outside /usr/local/powerpc-elf.  Just keep
in mind this might be the cause of trouble once powerpc-elf-gcc barks
at you for not finding stuff when linking... I'd redo the unpack
newlib/configure/compile/install step from another directory, after
renaming /usr/local/powerpc-elf into something else...

> The bad news..., I have libraries in the lib directory, but also a
> subdirectory called "le" has libraries in it, as well as "nof" and
"nof/le"
> and "nof/und" and "und". So, there are about six libc, six libm, etc.

Normal. This is the result of the multilib approach, that is, the libs
are generated for each configured variant of target architecture. 'le' is
little endian, 'nof' is 'no floating point'.  Not sure what 'und' means.
Subdirectories contain combinations, that is 'nof/le' is nofloatingpt &&
little endian.

Newlib's configure fetches the possible multilib combinations from the
crosscompiler (try "powerpc-elf -print-multi-lib" and "powerpc-elf
-print-multi-directory"), which is a good thing, because then only those
multilib combinations are generated, for which the compiler also has
support, and your app code can be taylored for. Which target arch is
addressed for your app code is controlled with gcc's -m options. And the
gcc frontend fetches libraries from the right multilib subdirectory if
you call the linking phase with the same arch options than the compilation
runs. That's why I suggested to use -mcpu=505 or something.

> Does anyone know what these directories are for? Which copy of the
libraries
> should I point my linker to when I build target code?

You don't need to worry which lib to choose as long as you use gcc for
linking, and not ld directly. For using ld (not recommended), you are
right: you have to select the lib path on your own, and this can lead to
a lot of hidden bugs if, for example, your app code has soft-float, but
you link in a hard-float library, where your processor has no fpu, or
has the fpu switched off.

> I need to modify my libgloss too, and am looking for documentation/input
on
> how to build that library.

cd <newlib-wrk-directory>/powerpc-elf/libgloss; make; make install

That is a shortcut, to avoid building the whole newlib enchilada.
However, this shortcut would not be absolutely necessary, as re-building
the whole tree would require a significant less amount of time, as
most .o files are already available from the initial make run for all
newlib. (once again: this is Makefile magic)

You might try "make dvi" or "make html" or something in newlib's top
workdir, or some relevant subdirectory of your wrk tree, but I doubt
there is anything on libgloss. Haven't checked recently, though. Ok,
a quick glance revealed that there is the document "Embed with GNU",
and there are also examples to show the general principle, however not
for powerpc. Don't let you get disturbed by the statement that there is
libgloss support only for 68k, mips, sparc, PA risc. This document is
10 years old... so it might be no BIG help.

To actually write (or rather to port, as I understood, you already have
a driver source fragment from somewhere else) the device driver layer:
this is just work, and there is no hidden secret, we haven't talked
about. I repeat myself when I say: study the rs6000/mbx8xx example, in
connection with read.c/write.c in newlib-x.x.x/libgloss. 

gm
_______________________________________________
Efi332 mailing list
Efi332 at diy-efi.org
http://lists.diy-efi.org/mailman/listinfo/efi332





More information about the Efi332 mailing list