This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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

Re: New CrossGCC FAQ maintainer needed?


Hey,  I wrote some stuff dealing with making an CrossGCC for my specific 
project.  I think there may be some valuable notes in here for a rewrite of
the FAQ.  Basically this stuff is wisdom that I had to learn on my own or
glean from various sources (BTW - a thank you to all on this list, the
binutils list and the coldfire list that helped with questions). I've
excerpted the more general parts from my document and am attaching the html.
If it helps any, then great.

- Steve

----------
>From: David Korn <dkorn@pixelpower.com>
>To: crossgcc@sources.redhat.com
>Subject: RE: New CrossGCC FAQ maintainer needed?
>Date: Wed, Mar 21, 2001, 10:30 AM
>

>>bgat@open-widgets.com wrote:
>>
>>> Guys:
>>>
>>> I'm not one to stick my head in and volunteer where I'm not wanted,
>>> but...  Does the CrossGCC FAQ need a maintainer?  I'd be happy to
>>> volunteer if so.
>
>>From: Stephen Smith [mailto:ischis2@home.com]
>>
>>If you do, be sure to get the newest howto from Mumit.  He
>>helped me out recently and then posted a howto on his site.
>>
>>I know that the official Cross GCC FAQ was a disaster for me.
>
>   I second this.  The cross gcc FAQ is now so out-of-date it's a
> liability; an awful lot of the questions on this list are from people
> who have followed the procedures in the FAQ and run up against problems
> that it makes no mention of.  For example, a section on target headers is
> much needed; and perhaps a bit about the dangers of line ends when
> building under cygwin.
>
>   If you're serious about this, I've got some bits of documentation on
> my website that could make the basis for some new answers in the FAQ;
> I'll post them to the list sometime in the next few days (my time is
> quite busy at the moment) and we can collectively start bashing an
> updated FAQ into shape.
>
>   Stephen, can you post the URL of Mumit's HOWTO, please?
>
>        DaveK
> --
>  All your base are belong to us!
>
>
> **********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> This footnote also confirms that this email message has been swept by
> MIMEsweeper for the presence of computer viruses.
>
> www.mimesweeper.com
> **********************************************************************
>
> ------
> Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
<html>

<head>
<meta http-equiv="Content-Type" content="text/html">
<title>Virtuoso Front Panel GNU CrossGCC Conversion</title>
</head>

<body>
<table border="0" width="100%">

  <tr>
    <td width="100%" colspan="3">
      <h2><font face="Arial"><a name="Tools">Tools</a></font></h2>
    </td>
  </tr>

  <tr>
    <td width="7%"></td>
    <td width="93%" colspan="2">
      <h3><font face="Arial"><a name="Tools, GNU">GNU CrossGCC Tool Chain</a></font></h3>
    </td>
  </tr>
  <tr>
    <td width="7%"></td>
    <td width="5%"></td>
    <td width="88%">
      <p>The tools that you will be using most come from the GNU GCC cross compiler tool chain.
      The GNU CrossGCC that you will be using is hosted on our Sun Solaris machine and targeted tword 
      the Motorola 68K and Coldfire series of processors, with a COFF object format.  The names of 
      all of the tools are prefixed with "m68k-coff-" to distinguish them from the normal tools.  The 
      CROSSGCC tools that you will be using actually come from  three different packages: GCC, Binutils,
      and Newlib.</p>

      <p>The home page for GCC is <a href="http://gcc.gnu.org/";>http://gcc.gnu.org/</a>.  From here you
      can get to the downloads and the documentation.  There is no need to download and build your own
      CrossGCC, as it has already been done by me.  The root for my CrossGCC directory is /users/sderosie/cbuild 
      on beam.  You should add /users/sderosie/cbuild/bin to your path to access the CrossGCC executables. </p>

      <p><b>Building -  </b> If you really do want to (or have a need to) build your own CrossGCC tool chain, you              
      certainly can.  Please refer to the various internet sources, starting with 
      <a href="http://www.objsw.com/";>CrossGCC FAQ</a>.  A few notes about things:  </p>
      <ol>
        <li><b>Configure -  </b> You will have to run the ./configure script.  This is simple but note that you
        will need to use the switches "--target=m68k-coff  --with-newlib".  Also, if you intend to install in any 
        place other than the default [/usr/local], you will need to use "--prefix=/path".  Note that you
        have to configure all three packages.</li>
        <li><b>Directories - </b> It is necessary to create some special directories and symlinks so that the
        install procedure can complete properly.  In the source directory of GCC, you need to create the 
        symlink 'newlib' to point to the newlib directory of the Newlib distribution.  For example, my newlib 
        symlink points to "../newlib-1.8.2/newlib"  which corosponds to "~/cbuild/source/newlib-1.8.2/newlib".
        Under your build directory for GCC, you need to create the directory "sys-include".  I have left mine 
        empty, since there are no target-specific includes that need to be fixed by the fixincludes script.  If 
        you know of any headers that need to be fixed, then put them here, otherwise just leave an empty 
        directory (but--you <b>must</b> have this directory).</li>
        <li><b>Patches - </b> You will have to patch Binutils and GCC.  The patches add functionality and 
        fix bugs.  They are all necessary for proper operation of these tools for what we do with them.  I
        think I have collect all necessary patches in "source/do_patch" but I may have missed some.  All of 
        these patches <b>must</b> be applied.  Mostly the order shouldn't matter, but you should do 
        "toplev.c.patch" before "full_file_path.patch".  To patch you will need to copy the file to the right 
        location (look at the file paths at the top of each file to figure it out, the right location is the parent
        of that path), then run "patch -p0 &lt; filename".  Unfortunately, some files will need to be in the same 
        location, and others will need to be put in different spots.  Perhaps someday I will go back and fix that
        problem, but until then you're on your own.</li>
        <li><b>Build Order - </b> Build Binutils first, then GCC, then Newlib.</li>
      </ol> 
      <p>Other than the above notes, you should follow the 
      <a href="http://www.objsw.com/CrossGCC/FAQ-4.html";>CrossGCC FAQ</a> and the actual GCC
      documentation to build and install the GNU tools.  You also may want to look at 
      <a href="http://fiddes.net/coldfire/";>David Fiddes Coldfire Resources</a> for updates to 
      the Coldfire patches.</p>    

      <p><b>Tools - </b> There are many tools in the GNU tool chain that are useful to development 
      other than just the obvious ones.  Each tool name will be prefaced with "m68k-coff-", so remember 
      to add that prefix to the name of any that you want to use (otherwise you will get the native version 
      of the tool).  Tools that you will need or find useful:</p>     
      <ul>
        <li><i>as </i>[GNU Assembler or GAS] - 'as' is the GNU Assembler.  This is assembler that you will
        be using. </li>
        <li><i>gcc </i>[GNU CC] - 'gcc' is the GNU compiler.  This compiler compiles C, C++ and Objective C
        sources.  It also assembles any assembly and will do the linking if you let it.  We usually have gcc 
        create object files which we link using 'ld'.</li>
        <li><i>g++ </i>[GNU C++ Compiler] - 'g++' is GNU's C++ compiler.  Actually, it just essentially invokes
        'gcc', which does all of the real work.  However, I prefer to use the 'g++' invocation for clarity.</li>
        <li><i>ld </i>[GNU Linker] - 'ld' is the GNU linker.  You will need to use it to link all of the various 
        object files created by gcc and gas to create the actual executable.  It will create a COFF binary, 
        which you will then translate to IEEE for the emulators and SREC for the load module.</li>
        <li><i>ar </i>[GNU Archive Manager] - 'ar' allows you to create and manage the library archive files.
        it is essential in the creation of the USX and the FPC libraries, but you may not need to use it much.</li>
        <li><i>objcopy </i>[GNU Object Format Translation] - 'objcopy' copies an object file from one format
        to another.  You will use this to translate the COFF binaries to IEEE and SREC.</li>
        <li><i>nm </i>[GNU Symbol Lister] - 'nm' will list all of the symbols that it finds in an object file, 
        archive library, or an executable.  Very useful for finding that missing symbol definition in gcc 
        libraries. </li>
        <li><i>objdump </i>[GNU Object Dumper] - 'objdump' lets you view the contents of an object file 
        or executable.  I used this to help debug the object files that I was getting from the compiler, but 
        you probably won't need to use this much.  Note that this allows you to disassemble the binary in the
        object file.</li>  
      </ul>
      <p>All of the above programs are ones that I found useful or essential for the project.  Obviously it is 
      not my intention here to tell you how to use each of these programs, so please look at the 
      documentation.  Also remember that they all support the '--help' switch for quick reference.</p>

      <p>The programs for the GNU CrossGCC are all available at the path '/users/sderosie/cbuild/bin'.  You will
      probably want to add this directory to you path.  The man pages for these are at 
      '/users/sderosie/cbuild/man' and you might want to add that to your MANPATH.</p>

      <p>&nbsp;</p>
    </td>
  </tr>

  <tr>
    <td width="100%" colspan="3">
      <h2><font face="Arial"><a name="Libs">Libraries</a></font></h2>
    </td>
  </tr>
  <tr>
    <td width="7%">
    </td>
    <td width="93%" colspan="2">
      <h3><font face="Arial"><a name="Libs, Standard">Standard C/C++ Libraries</a></font></h3>
    </td>
  </tr>
  <tr>
    <td width="7%"></td>
    <td width="5%"></td>
    <td width="88%">
      <p>The standard libraries that we use come from a package called Newlib.  Newlib is a GPL covered 
      package of C and C++ libraries intended to be used with GCC.  It supports all of the same hardware
      and OS platforms that GCC does.  All of the standard ANSI C and C++ routines are supported.  All of
      the standard Unix OS services are supported (if supported on the architecture that you are using--for
      us they aren't supported).  The libraries that you will most likely be using are libgcc, libstdc++, 
      libc, and libnosys.  libgcc contains all of the gcc extensions and libraries, libstdc++ contains standard
      C++ libraries, libc contains the standard ANSI C libraries, and libnosys contains OS libraries for a
      system that doesn't have an OS. libnosys stubs out many routines or has generic versions of them as
      necessary.  It also contains some of the stuff from <a href="Libs, Libgloss">Libgloss</a>.</p>
      
      <p>&nbsp;</p>
    </td>
  </tr>
  <tr>
    <td width="7%"></td>
    <td width="93%" colspan="2">
      <h3><font face="Arial"><a name="Libs, Libgloss">Libgloss</a></font></h3>
    </td>
  </tr>
  <tr>
    <td width="7%"></td>
    <td width="5%"></td>
    <td width="88%">
      <p>Libgloss is the name that the GNU GCC has given to those things that are necessary but usually get 
      glossed over.  Typically a file called crt0.o contains the startup code necessary to start running a 
      program.  crt0.o would have the main entry point, do any necessary hardware and software setup and then 
      pass control on to your main() routine.  Since we have all of this stuff in our entry.s file, we don't 
      need crt0.o, but looking at the source in the libgloss directory is a good way to look to see what 
      is necessary.  Libgloss also contains "typical" linker command files, and other necessary things.</p>  
      
      <p>From the documentation in the libgloss directory: </p>
      
      <p>"When initially linking in libc.a, several I/O functions are undefined. If you don't plan on doing any 
      I/O, then you're OK, otherwise they need to be created. These routines are read, write, open, close. 
      sbrk, and kill. Open & close don't need to be fully supported unless you have a filesystems, so typically 
      they are stubbed out. Kill is also a stub, since you can't do process control on an embedded system. </p>

  	  <p>"Sbrk() is only needed by applications that do dynamic memory allocation. It's uses the symbol _end that 
  	  is setup in the linker script. It also requires a compile time option to set the upper size limit on the 
  	  heap space. This leaves us with read and write, which are required for serial I/O. Usually these two 
  	  routines are written in C, and call a lower level function for the actual I/O operation. These two lowest 
  	  level I/O primitives are inbyte() and outbyte(), and are also used by GDB back ends if you've written an 
  	  exception handler. Some systems also implement a havebyte() for input as well. </p>

      <p>"Other commonly included functions are routines for manipulating LED's on the target (if they exist) or 
      low level debug help. Typically a putnum() for printing words and bytes as a hex number is helpful, as 
      well as a low-level print() to output simple strings. </p>

      <p>"As libg++ uses the I/O routines in libc.a, if read and write work, then libg++ will also work with no 
      additional changes."</p>
      
      <p>Basically, the only part that needs to be implemented is sbrk().  There is a version of this in libnosys
      that works just fine.  The only thing you need to do is to define the symbol _end in the linker script after
      all of the text and data sections.  If you use the provided script, you don't need to do anything more than
      be aware of what is going on.</p>
      
      <p>&nbsp;</p>
     </td>
  </tr>
  
    <tr>
    <td width="100%" colspan="3">
      <h2><font face="Arial"><a name="Links">Links</a></font></h2>
    </td>
  </tr>
  <tr>
    <td width="7%"></td>
    <td width="5%"></td>
    <td width="88%">
      <table border="0" width="100%">

        <tr>
          <td width="100%" colspan="2"><b>GNU Tools</b></td>
        </tr>
        <tr>
          <td width="5%"></td>
          <td width="95%">
            <ul>
              <li>The GNU web site:<br>
              <a href="http://www.gnu.org/";>http://www.gnu.org/</a></li>
              <li>GCC web site:<br>
              <a href="http://gcc.gnu.org/";>http://gcc.gnu.org/</a></li>
              <li>Binutils page:<br>
              <a href="http://sources.redhat.com/binutils/";>http://sources.redhat.com/binutils/</a></li>
            </ul>
          </td>
        </tr>
        <tr>
          <td width="100%" colspan="2"><b>Documentation</b></td>
        </tr>
        <tr>
          <td width="5%"></td>
          <td width="95%">
            <ul>
              <li>GCC Documentation:<br>
              <a href="http://gcc.gnu.org/onlinedocs/";>http://gcc.gnu.org/onlinedocs/</a></li>
              <li>GAS Documentation:<br>
              <a href="http://www.gnu.org/manual/gas/html_chapter/as_toc.html";>http://www.gnu.org/manual/gas/html_chapter/as_toc.html</a></li>
              <li>Ld Documentation:<br>
              <a href="http://www.gnu.org/manual/ld/html_chapter/ld_toc.html";>http://www.gnu.org/manual/ld/html_chapter/ld_toc.html</a></li>
              <li>Binutils Documentation:<br>
              <a href="http://www.gnu.org/manual/binutils/html_chapter/binutils_toc.html";>http://www.gnu.org/manual/binutils/html_chapter/binutils_toc.html</a></li>
              <li>GIT Documentation:<br>
              <a href="http://www.cs.unh.edu/~tudor/git/doc/git.html";>http://www.cs.unh.edu/~tudor/git/doc/git.html</a></li>
            </ul>
          </td>
        </tr>
        <tr>
          <td width="100%" colspan="2"><b>Other Tools</b></td>
        </tr>
        <tr>
          <td width="5%"></td>
          <td width="95%">
            <ul>
              <li>TCSH:
              <a href="ftp://ftp.astron.com/pub/tcsh/";>ftp://ftp.astron.com/pub/tcsh/</a></li>
            </ul>
          </td>
        </tr>

        <tr>
          <td width="100%" colspan="2"><b>Other Resources</b></td>
        </tr>
        <tr>
          <td width="5%"></td>
          <td width="95%">
            <ul>
              <li>David Fiddes Coldfire site (GCC patches for Coldfire chips):<br>
              <a href="http://fiddes.net/coldfire/";>http://fiddes.net/coldfire/</a></li>
              <li>Coldfire discussion list:<br>
              <a href="http://www.wildrice.com/ColdFire/";>http://www.wildrice.com/ColdFire/</a></li>
              <li>CrossGCC FAQ:<br>
              <a href="http://www.objsw.com/CrossGCC/";>http://www.objsw.com/CrossGCC/</a></li>
            </ul>
          </td>
        </tr>

      </table>
    </td>
  </tr>
</table>
------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com

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