custom CPU porting : guidance please

Ian Lance Taylor ian@airs.com
Thu Dec 23 18:33:00 GMT 2004


sashti srinivasan <svasn_tcpip@yahoo.co.in> writes:

>   (1)  I suppose that 'gas' is much more machine
> dependent than gcc.  Please guide me regarding where
> can I find documents regarding how to port 'gas' to a
> new CPU.

gas is part of the GNU binutils.  binutils questions are best
addressed on the binutils mailing list.  For more information, see
http://sourceware.org/binutils/

The internal gas documentation can be found in gas/doc/internals.texi.

>   (2)  Since rest of the utilities in binutils have
> more to do with binary format than with architecture,
> porting these(ld,nm,ar....) to a new CPU is going to
> be farily simple.  Am I right?

Sort of.  You need to implement relocation handling appropriate for
your architecture, and that is trickier than it should be.

>   (3)  I like to port GDB also.  Please give me
> pointers where I can find the corresponding
> documentation.

See http://sourceware.org/gdb/

In particular, gdb/doc/gdbint.texinfo.

>   (4)  As a first step, I want to develop a gdb
> simulator for the new CPU I have in mind.  Where can I
> find the documentation describing how to write a
> simulator.

As far as I know, there isn't any.  Look at existing simulators.

>   (5)  In porting GCC tool-chain to a new CPU
> architecture, or in otherwords developing cross
> tool-chain for a new CPU architecture, I assume that
> following is the most appropriate sequence:
>      (a)  Develop a simulator so that executables for
> the new CPU can be run using GDB
>      (b)  Port as so that programs can be written in
> the assembly language of the CPU and assembled.
>      (c)  Port gcc so that c programs can be written
> to run on the target CPU
>   Is this sequence correct?

Pretty much.  You will want to write the disassembler when you write
the assembler.

Ian



More information about the Gcc-help mailing list