Concept of cross-compilation (a little bit of embedded knowledge)

Source: Internet
Author: User

Cross-compilation refers to cross-compiler compilation on a host platform (such as a PC) that can be performed on other platforms (such as arm) the process of running the code. A local compiler means that the compiled program can run on a local machine (that is, the machine that runs the compiler), but the program compiled by the cross compiler cannot run on the local machine.

 

The emergence and prevalence of the concept of cross-compilation is synchronized with the extensive development of embedded systems. Our commonly used computers
The software must compile the code written in advanced computer languages (for example
C code) Compile (compile) binary code that can be recognized and executed by computers. For example, on Windows, we can use visual c ++
Development Environment, write programs and compile them into executable programs. In this way, we use the Windows tool on the PC platform for Windows
This compilation process is called native.
Compilation, which can be understood as local compilation in Chinese. However, when developing embedded systems, the target platform for running programs usually has limited storage space and computing capabilities, such as common
On the ARM platform, the general static storage space is about 16 to 32 MB, and the CPU clock speed is about between 100 MHz and 500 MHz. In this case
It is impossible to compile the local machine on the ARM platform, because the general compilation tool chain (compilation tool)
Chain) requires a lot of storage space and a strong CPU computing capability. To solve this problem, the cross-compilation tool came into being. With the cross-compilation tool, we can
A host platform (such as a PC) with strong CPU capabilities and sufficient storage controls can compile executable programs for other platforms.

To perform cross-compilation, We need to install the corresponding cross-compilation tool chain on the host platform, and then use this cross-compilation tool chain to compile our source code, finally, code that can be run on the target platform is generated. Common examples of cross-compilation are as follows:

  • On a Windows PC, using ADS (ARM development environment) and the ARMCC compiler, You can compile executable code for the arm cpu.
  • On a Linux PC, the executable code for the Linux ARM platform can be compiled using the arm-Linux-GCC compiler.
  • On a Windows PC, run the arm-elf-GCC compiler in the cygwin environment to generate executable code for the arm cpu.

In addition, most of the Cross-compilation processes of Embedded Linux operating systems are completed on the Linux PC platform. At this time, programmers will install the cross-compilation tool chain on a PC running the Linux operating system, and use the development tools provided by GNU to conveniently develop and debug embedded application software.

 


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.