This is the mail archive of the ecos-discuss@sourceware.cygnus.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: building gcc-2.95.1 for eCos 1.2.1


On Wed, Nov 03, 1999 at 07:10:07PM -0800, Atsumi Hirose wrote:

> Before I explain what errors I get, let me explain the
> different methods I've used to try to get gcc-2.95.1
> to work in eCos.  I basically tried 3 different
> approaches however I played around with many files and
> compiler options on each approach.

Let's forget about gcc for a second.  Have you verfied that you can
assemble and link a small program and then load/run it with gdb?
Something trivial that just loads values into registers, reads/writes
a few bytes of RAM?

> The first thing I tried to do was to build gcc-2.95.1
> with the header files from an (arm-linux) linux-2.2.12
> kernel that I built.  

Building a cross-compiler isn't an easy process, and it's not
documented anywhere that I have found -- there's a cross-gcc FAQ, but
the steps it outlines do not work.  The part that usually blows up is
the building of various libraries.  The only library you need for
embedded development is libgcc.a, so the easiest thing to do is not
build anything except gcc itself and libgcc.a.

One of the things I'm going to do during the next few days is try to
repeat the build process I used and document exactly what I had to do
to get gcc to build.

> I was able to build the compiler and glibc OK but the compiled
> ("hello world") test app would not load through gdb.  

If you're going to be running an embedded system with eCOS, then you
don't need glibc -- all you need is gcclib.

> If I remember correctly, gdb frooze up after I typed "target remote
> /dev/ttyS0".

I don't think that has anything to do with the compiler, since you
haven't even tried to load the file produced by gcc.  It sounds like a
gdb/target problem.

> I also tried to compile the file with
> that compiler and the libarary and header files from
> eCos but it would not compile.
> 
> The second approach I took was to build gcc-2.95.1 with both the
> header files from the (arm-linux) 2.2.12 kernel (asm and linux)
> folders, and the header files from the eCos kernel
> (/usr/local/ecos-1.2.1/ecos-work/install/include).  I pretty much
> got the same results as my first attempt with only the arm-linux
> kernel heade files.

You should not be using any eCOS headers when building the compiler.

You should be using any ARM headers when building the compiler.  

When building the compiler, you should use only the standard header files
that you use when compiling any other program on your system.  

It's important to note that building gcc involves compiling
programs for two different targets:

 1) gcc itself:  runs (in my case) under Linux/Intel/glibc2.1.  Use the
    standard Linux/Intel/glibc headers.

 2) gcclib, which runs on the ARM processor.  In my case that is a
    big-endian ARM7TDMI.  gcclib should _not_ be using the standard
    Linux/Intel/glibc include files.

If you try to build libio, libiberty, or glibc for the ARM target,
you're going to have to have a whole set of header files configured
for the ARM target.  If you're going to be running eCOS, then you
aren't going to have an OS that supports those libraries -- so don't
try to build them.

I'll try to document the steps I took to build the compiler and gcclib,
and you need to verify that your binutils (as,ld) and gdb are working.
Hopefully I'll have a procedure documented for building a
cross-compiler in a few days.

-- 
Grant Edwards
grante@visi.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]