Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

AUTHOR: VISHAL P. TANK (M.

Tech in Communication)

INDIA (Ahmedabad)

CROSS COMPILER
Cross compilers are devices that are capable of manufacturing executable code that can be run
on a platform that is currently not the resident platform for the compiler. The utilization of a
cross compiler is common when there is a need to make use of multiple platforms in order to
handle computing functions. This will include embedded systems where each
embedded computer within the system has a smaller amount of resources. The use of a cross
compiler makes it possible to overcome this lack of resources by creating an interrelated
execution between various components on the system.

One excellent example of the use of a cross compiler is when microcontrollers are in use within
a system. Generally, a microcontroller does not contain a great deal of memory. By using a
cross compiler to handle the creation and issue of execution of commands, less of the resources
for the microcontroller are tied up in administrative orders, and can be directed toward
performing the task ordered by the cross compiler.

The cross compiler can help to create a working network between different types of machines,
or even different versions of an operating system. In this application, a company could use both
older and more recent versions of an operating system to access a common network, even if
the workstations in the office featured a wide range of desktop computers of varying age and
capacity. The use of a cross compiler makes it possible to gather all these varied elements into a
cohesive build environment that will allow each of the stations to access essential files and data
that resides on the common server.

Use of the cross compiler goes back to the early days of the development of Windows and the
gradual decline in the use of DOS by many end users. Today, the cross compiler remains a
common means of maximizing the efficiency of several components. However, virtual
machines such as Java’s JVM are capable of handling at last a portion of the functions that once
were only possible with the use of a cross compiler.

STEPS OF CROSS-COMPILATION

To compile and run a program using a cross-compiler involves several steps:


1.Run the cross-compiler on the host machine to produce assembler files for the target
machine. This requires header files for the target machine.
2.Assemble the files produced by the cross-compiler. You can do this either with an
assembler on the target machine, or with a cross-assembler on the host machine.

3.Link those files to make an executable. You can do this either with a linker on the target
machine, or with a cross-linker on the host machine. Whichever machine you use, you need
libraries and certain startup files (typically `crt....o') for the target machine.

WIKIPEDIA

A cross compiler is a compiler capable of creating executable code for a platform other than the
one on which the compiler is run. Cross compiler tools are used to generate executables for
embedded system or multiple platforms. It is used to compile for a platform upon which it is
not feasible to do the compiling, like microcontrollers that don't support an operating system. It
has become more common to use this tool for para virtualization where a system may have one
or more platforms in use.

Not targeted by this definition are source to source translators, which are often mistakenly
called cross compilers.

USES OF CROSS COMPILERS

The fundamental use of a cross compiler is to separate the build environment from the target
environment. This is useful in a number of situations:

 Embedded computers where a device has extremely limited resources. For example, a
microwave oven will have an extremely small computer to read its touchpad and door
sensor, provide output to a digital display and speaker, and to control the machinery for
cooking food. This computer will not be powerful enough to run a compiler, a file
system, or a development environment. Since debugging and testing may also require
more resources than are available on an embedded system, cross-compilation can be
less involved and less prone to errors than native compilation.
 Compiling for multiple machines. For example, a company may wish to support several
different versions of an operating system or to support several different operating
systems. By using a cross compiler, a single build environment can be set up to compile
for each of these targets.
 Compiling on a server farm. Similar to compiling for multiple machines, a complicated
build that involves many compile operations can be executed across any machine that is
free, regardless of its underlying hardware or the operating system version that it is
running.
 Bootstrapping to a new platform. When developing software for a new platform, or the
emulator of a future platform, one uses a cross compiler to compile necessary tools such
as the operating system and a native compiler.
 Compiling native code for emulators for older now-obsolete platforms like the
Commdore 64 or Apple II by enthusiasts who use cross compilers that run on a current
platform (such as Aztec C's MS DOS 6502 cross compilers running under Windows XP).

You might also like