Linux MIPS Architecture development
 help / color / mirror / Atom feed
* How do I compile GCC to generate MIPS code ?
@ 2005-03-17  2:54 Leonel Gayard
  2005-03-17  4:24 ` Kumba
  2005-03-17  4:28 ` Steven J. Hill
  0 siblings, 2 replies; 3+ messages in thread
From: Leonel Gayard @ 2005-03-17  2:54 UTC (permalink / raw)
  To: linux-mips

Hi all,

I have recently started to study the MIPS architecture. For instance,
I wanted to have GCC compile C code into MIPS assembly and run it in
SPIM. (I have an Intel machine running Linux).

So I want to try something like this:

gcc -Wall -pedantic -S --march=mips1 test.c

in order to have it generate MIPS assembly.

It does not work. All I get is:

cc1: error: bad value (mips32) for -march= switch
cc1: error: bad value (mips32) for -mcpu= switch

Clearly, I need to recompile GCC so it has MIPS in its available
architectures. Remark, this is not cross-compiling, because I want GCC
to run on an i686 machine, it just generates MIPS code.

Can any one help me do this ?

Thank you
Leonel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How do I compile GCC to generate MIPS code ?
  2005-03-17  2:54 How do I compile GCC to generate MIPS code ? Leonel Gayard
@ 2005-03-17  4:24 ` Kumba
  2005-03-17  4:28 ` Steven J. Hill
  1 sibling, 0 replies; 3+ messages in thread
From: Kumba @ 2005-03-17  4:24 UTC (permalink / raw)
  To: Leonel Gayard; +Cc: linux-mips

Leonel Gayard wrote:
> Hi all,
> 
> I have recently started to study the MIPS architecture. For instance,
> I wanted to have GCC compile C code into MIPS assembly and run it in
> SPIM. (I have an Intel machine running Linux).
> 
> So I want to try something like this:
> 
> gcc -Wall -pedantic -S --march=mips1 test.c
> 
> in order to have it generate MIPS assembly.
> 
> It does not work. All I get is:
> 
> cc1: error: bad value (mips32) for -march= switch
> cc1: error: bad value (mips32) for -mcpu= switch
> 
> Clearly, I need to recompile GCC so it has MIPS in its available
> architectures. Remark, this is not cross-compiling, because I want GCC
> to run on an i686 machine, it just generates MIPS code.
> 
> Can any one help me do this ?
> 
> Thank you
> Leonel

Cross compiling is the (black) art of building a compiler that runs on Arch X, 
but generates code for Arch Y.  You definitely do not want to replace your 
system compiler (that is, i686-pc-linux-gnu-gcc) with a mips one, cause then 
you won't be able to rebuild i686 packages.  You want a second compiler to be 
available capable of handling mips-unknown-linux-gnu.


--Kumba

-- 
"Such is oft the course of deeds that move the wheels of the world: small 
hands do them because they must, while the eyes of the great are elsewhere." 
--Elrond

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How do I compile GCC to generate MIPS code ?
  2005-03-17  2:54 How do I compile GCC to generate MIPS code ? Leonel Gayard
  2005-03-17  4:24 ` Kumba
@ 2005-03-17  4:28 ` Steven J. Hill
  1 sibling, 0 replies; 3+ messages in thread
From: Steven J. Hill @ 2005-03-17  4:28 UTC (permalink / raw)
  To: Leonel Gayard; +Cc: linux-mips

Leonel Gayard wrote:
> 
> I have recently started to study the MIPS architecture. For instance,
> I wanted to have GCC compile C code into MIPS assembly and run it in
> SPIM. (I have an Intel machine running Linux).
>
There are these brand new services just out called Google and Wiki!!!
You should try them out. They're revolutionary!! All kidding aside,
go to:

    http://www.linux-mips.org/

which is the main site. The link directly to the toolchains is:

    http://www.linux-mips.org/wiki/index.php/Toolchains

more information about emulators/simulators is:

    http://www.linux-mips.org/wiki/index.php/Emulators

All of the information that you are looking for will be there. Have
lots of fun. Please feel free to ask questions after you have exhausted
those resources.

-Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-03-17  4:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-17  2:54 How do I compile GCC to generate MIPS code ? Leonel Gayard
2005-03-17  4:24 ` Kumba
2005-03-17  4:28 ` Steven J. Hill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox