Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

RE: [lpc2000] Compiler vs cross compiler

2006-03-20 by Paul Curtis

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

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.