Compiler vs cross compiler

Started by March 20, 2006
hey friends,
  I want to know a fact...
  what is the difference between a compiler and a cross-compiler
  please help me find out...
  Thanks...
  Umang Malhotra
	---------------------------------
	
	
----- Original Message ----- 
From: <malhotra_umang@malh...>
To: <lpc2000@lpc2...>
Sent: Monday, March 20, 2006 3:33 PM
Subject: [lpc2000] Compiler vs cross compiler
	> hey friends,
>  I want to know a fact...
>  what is the difference between a compiler and a cross-compiler
>  please help me find out...

A cross-compiler generates code for a different CPU than the the one that it 
is running on. Most compilers for embedded systems are cross-compilers.

Leon
	
Leon, 

> > hey friends,
> >  I want to know a fact...
> >  what is the difference between a compiler and a cross-compiler
> >  please help me find out...
> 
> A cross-compiler generates code for a different CPU than the 
> the one that it 
> is running on. Most compilers for embedded systems are 
> cross-compilers.

Actually, not quite true.

There are native compilers (aka hosted compilers in ISO C speak) which
generate code for direct execution on the processor and operating system
on which the compiler is hosted.  For example, MS VC generating Win32
apps is a native compiler, as is the Ultra compiler on OS-9 which
generates code for 68K/386/PPC-based OS-9 systems, as is the classic cc
compiler shipped with many older Unicies.

A cross compiler generates code that cannot be directly executed on the
host because either (a) it targets a different processor or (b) it
targets a different OS.  An example of this type of compiler is your
regular embedded C compiler provided by IAR, RAL, GHS, and so on.  But
there are (many) non-commercial never-to-be-seen cross compilers that
are used internally (for instance, I always used to build our Modula-2
products on a Sun-3, but they targeted transputers, ARMs, 386s and 68Ks
on various operating systems, I never built them native).

There are also things that are difficult to categorize, such as Apple's
recent introduction of Universal Binaries, for instance.

--
Paul Curtis, Rowley Associates Ltd   http://www.rowley.co.uk 
CrossWorks for MSP430, ARM, AVR and now MAXQ processors
	
Paul Curtis wrote:

>Leon, 
>
>  
>
>>>hey friends,
>>> I want to know a fact...
>>> what is the difference between a compiler and a cross-compiler
>>> please help me find out...
>>>      
>>>
>>A cross-compiler generates code for a different CPU than the 
>>the one that it 
>>is running on. Most compilers for embedded systems are 
>>cross-compilers.
>>    
>>
>
>Actually, not quite true.
>
>There are native compilers (aka hosted compilers in ISO C speak) which
>generate code for direct execution on the processor and operating system
>on which the compiler is hosted.  For example, MS VC generating Win32
>apps is a native compiler, as is the Ultra compiler on OS-9 which
>generates code for 68K/386/PPC-based OS-9 systems, as is the classic cc
>compiler shipped with many older Unicies.
>
>A cross compiler generates code that cannot be directly executed on the
>host because either (a) it targets a different processor or (b) it
>targets a different OS.  An example of this type of compiler is your
>regular embedded C compiler provided by IAR, RAL, GHS, and so on.  But
>there are (many) non-commercial never-to-be-seen cross compilers that
>are used internally (for instance, I always used to build our Modula-2
>products on a Sun-3, but they targeted transputers, ARMs, 386s and 68Ks
>on various operating systems, I never built them native).
>
>  
>
Heh, you should try it sometime, it will quickly convince you that a 
compiler running natively on an embedded platform is a horrible idea. 
:P  I tried that with an SA1100 running @ 166MHz, terribly slow!

TomW
	-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------
	
malhotra_umang@malh... ha scritto:
> hey friends,
>   I want to know a fact...
>   what is the difference between a compiler and a cross-compiler
>   please help me find out...
>   Thanks...
>   Umang Malhotra
>   
A cross compiler is a compiler that produce object code for a different 
cpu/calculator then the cpu of the calculator where it is runnig.
So if you have a compiler running on your PC that may produce object 
code for an ARM processor, that compiler is a cross compiler.
> 		
> ---------------------------------
>  
>
> 
>
>
>
>  
> Yahoo! Groups Links
>
>
>
>  
>
>
>
>
>
	  ----------


	
	
>>hey friends,
>>  I want to know a fact...
>>  what is the difference between a compiler and a cross-compiler
>>  please help me find out...
>>  Thanks...

Its what you get when you feed your compiler bad code.

:)
	
>>hey friends,
>>  I want to know a fact...
>>  what is the difference between a compiler and a cross-compiler
>>  please help me find out...
>>  Thanks...

Its what you get when you feed your compiler bad code.

:)
	
malhotra_umang@malh... ha scritto:
> hey friends,
>   I want to know a fact...
>   what is the difference between a compiler and a cross-compiler
>   please help me find out...
>   Thanks...
>   Umang Malhotra
>   
A cross compiler is a compiler that produce object code for a different 
cpu/calculator then the cpu of the calculator where it is runnig.
So if you have a compiler running on your PC that may produce object 
code for an ARM processor, that compiler is a cross compiler.
> 		
> ---------------------------------
>  
>
> 
>
>
>
>  
> Yahoo! Groups Links
>
>
>
>  
>
>
>
>
>
	  ----------


	
	
Paul Curtis wrote:

>Leon, 
>
>  
>
>>>hey friends,
>>> I want to know a fact...
>>> what is the difference between a compiler and a cross-compiler
>>> please help me find out...
>>>      
>>>
>>A cross-compiler generates code for a different CPU than the 
>>the one that it 
>>is running on. Most compilers for embedded systems are 
>>cross-compilers.
>>    
>>
>
>Actually, not quite true.
>
>There are native compilers (aka hosted compilers in ISO C speak) which
>generate code for direct execution on the processor and operating system
>on which the compiler is hosted.  For example, MS VC generating Win32
>apps is a native compiler, as is the Ultra compiler on OS-9 which
>generates code for 68K/386/PPC-based OS-9 systems, as is the classic cc
>compiler shipped with many older Unicies.
>
>A cross compiler generates code that cannot be directly executed on the
>host because either (a) it targets a different processor or (b) it
>targets a different OS.  An example of this type of compiler is your
>regular embedded C compiler provided by IAR, RAL, GHS, and so on.  But
>there are (many) non-commercial never-to-be-seen cross compilers that
>are used internally (for instance, I always used to build our Modula-2
>products on a Sun-3, but they targeted transputers, ARMs, 386s and 68Ks
>on various operating systems, I never built them native).
>
>  
>
Heh, you should try it sometime, it will quickly convince you that a 
compiler running natively on an embedded platform is a horrible idea. 
:P  I tried that with an SA1100 running @ 166MHz, terribly slow!

TomW
	-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------
	
Leon, 

> > hey friends,
> >  I want to know a fact...
> >  what is the difference between a compiler and a cross-compiler
> >  please help me find out...
> 
> A cross-compiler generates code for a different CPU than the 
> the one that it 
> is running on. Most compilers for embedded systems are 
> cross-compilers.

Actually, not quite true.

There are native compilers (aka hosted compilers in ISO C speak) which
generate code for direct execution on the processor and operating system
on which the compiler is hosted.  For example, MS VC generating Win32
apps is a native compiler, as is the Ultra compiler on OS-9 which
generates code for 68K/386/PPC-based OS-9 systems, as is the classic cc
compiler shipped with many older Unicies.

A cross compiler generates code that cannot be directly executed on the
host because either (a) it targets a different processor or (b) it
targets a different OS.  An example of this type of compiler is your
regular embedded C compiler provided by IAR, RAL, GHS, and so on.  But
there are (many) non-commercial never-to-be-seen cross compilers that
are used internally (for instance, I always used to build our Modula-2
products on a Sun-3, but they targeted transputers, ARMs, 386s and 68Ks
on various operating systems, I never built them native).

There are also things that are difficult to categorize, such as Apple's
recent introduction of Universal Binaries, for instance.

--
Paul Curtis, Rowley Associates Ltd   http://www.rowley.co.uk 
CrossWorks for MSP430, ARM, AVR and now MAXQ processors
	
----- Original Message ----- 
From: <malhotra_umang@malh...>
To: <lpc2000@lpc2...>
Sent: Monday, March 20, 2006 3:33 PM
Subject: [lpc2000] Compiler vs cross compiler
	> hey friends,
>  I want to know a fact...
>  what is the difference between a compiler and a cross-compiler
>  please help me find out...

A cross-compiler generates code for a different CPU than the the one that it 
is running on. Most compilers for embedded systems are cross-compilers.

Leon
	
hey friends,
  I want to know a fact...
  what is the difference between a compiler and a cross-compiler
  please help me find out...
  Thanks...
  Umang Malhotra
	---------------------------------