Ubuntu12.04 embedded cross-compilation environment arm-linux-gcc Build Process Diagram

Source: Internet
Author: User
Linux version: Ubuntu12.04 kernel version: Linux3.5.0 cross compiler version: arm-linux-gcc-4.4.3 cross compiler download see this article. Compile and translate the operating systems and applications required for the embedded Linux system in this environment

Linux version: Ubuntu 12.04 kernel version: Linux 3.5.0 cross compiler version: arm-linux-gcc-4.4.3 cross compiler download see this article http://www.linuxidc.com/Linux/2011-05/35906.htm

Remarks before installation

First, let's briefly introduce the so-called cross-compilation environment, that is, installing and configuring the cross-compilation tool chain. Compile the operating system and applications required for the embedded Linux system in this environment, and upload them to the target machine.

The cross-compiling tool chain is used to compile, Link, process, and debug the program code of the cross-platform architecture. For cross-developed tool chains, a prefix is added to the file name to differentiate local tool chains. For example, arm-linux-indicates a cross-compilation tool chain for arm, and arm-linux-gcc indicates a gcc compiler. In addition to the compilation options related to the architecture, it is used in the same way as gcc on the Linux host, so the Linux programming technology is also applicable to embedded systems. However, not all versions can be used. various software packages often have version matching problems. For example, a arm-linux-gcc-4.3.3 version of the Cross-compilation toolchain is required to compile the kernel, and a arm-linux-gcc-3.4.1 of the Cross-compilation toolchain causes compilation to fail.

So what is the difference between gcc and arm-linux-gcc? The difference is that gcc is a C language compiler in linux, and the compiled program is executed locally, while arm-linux-gcc is used for cross-platform C language compiler in linux, the compiled program is executed on the target machine (such as the ARM platform). Embedded Development should use the embedded cross-compilation tool chain.

Installation Steps

1、store the compressed package arm-linux-gcc-4.4.3.tar.gz in a directory, which is the directory you will decompress. In the future, this directory cannot be deleted. My storage path is/home/song/software, for example, remember this path and will be used later.

2. Run the tar command: tar zxvf arm-gcc-4.3.tar.gz. unzip the arm-linux-gcc-4.4.3.tar.gz file under the softwarefolder to the current directory, as shown in figure

The decompressed file is saved in the/home/song/software/opt/FriendlyARM/toolschain/4.4.3 folder, as shown in, this storage path can be remembered, as shown in figure

3. Configure the system environment variables and add the PATH of the Cross-compilation toolchain to the environment variable PATH. In this way, these tools can be used in any directory. Write down the installation path in the previous step and run the command vim/etc/profile to edit the profile file and add the environment variable.

Add: export PATH = $ PATH:/home/song/software/opt/FriendlyARM/toolschain/4.4.3/bin to the last line of the profile, which is the PATH of the bin directory, maybe you are different. You can fill in according to your actual directory, for example, 32 rows.

Just save it after writing it.

4. Run the following command: source/etc/profile to make the environment variable take effect.

5. Enter the command arm-linux on the terminal and press the Tab key. This shows that the environment variable is successfully set.

6. Run the following command: arm-linux-gcc-v: /home/song/software/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-gcc: 15: exec: /home/song/software/opt/FriendlyARM/toolschain/4.4.3/bin /. arm-none-linux-gnueabi-gcc: not found

The reason for this problem is that Ubuntu12.04 uses 64-bit, the solution is to use the command: sudo apt-get install ia32-libs to install some 32-bit Libraries

7. After the 32-bit library is installed, run the command: arm-linux-gcc-v. This operation succeeds, as shown in figure

8. Verify and compile a hello. c file.

Run the command: arm-linux-gcc hello. c-o hello to check whether the compilation is successful.

The binary file is generated successfully.

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

Related Article

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.