Cross compiler

from Wikipedia, the free encyclopedia

A cross-compiler is a compiler that runs on a certain system (also called a host platform ), but creates compilations (object files or executable programs) for other systems. These target systems can be different operating systems , different processors, or a combination of the two. A concrete example would be a compiler that runs on an Intel -based Windows system and generates programs for PowerPC -based Linux systems. If the target platform is an embedded system that is not itself suitable for development and translation, one also speaks of a target compiler .

Typical areas of application

Cross compilers are needed and used for various reasons:

  • They can be used to port an operating system, a program or even the compiler itself to a new hardware platform on which the operating system or compiler was not previously available.
  • They can be used to create programs for embedded systems that do not have the necessary resources to run a compiler themselves (e.g. if these systems have too little RAM or no hard disk ).
  • They can run on fast systems and compile files for slower systems. This can potentially save a lot of time. In particular with embedded systems, comparatively slow processors are often used, which would take hours to generate a desired program, while a current server as the host platform can possibly do this work in a few minutes.
  • You can compile on an integration server , e.g. B. Nightly Builds for different target platforms.
  • Development can be more convenient, e.g. B. by means of an IDE on a system, see z. B. cc65 for the Commodore 64 .

Many manufacturers of processors for embedded systems supply their customers with corresponding target compilers, mostly for the C programming language and executable on one or more common operating systems.

Popular examples

Example vbcc

Popular free compilers, some of which are suitable for use as cross-compilers, are e.g. B. the GNU Compiler Collection and the Free Pascal Compiler . The also free Small Device C compiler is suitable for some 8-bit target systems ( microcontrollers from the MCS-51 series, Zilog Z80 , Dallas 80C390, Motorola HC08, Microchip PIC ). The cc65 compiler is available for old 6502 -based computer architectures .

Individual evidence

  1. http://sdcc.sourceforge.net SDCC