Ubuntu 12.04 Embedded Cross-compilation environment ARM-LINUX-GCC construction process diagram

Source: Internet
Author: User

This article reprinted from: Ubuntu 12.04 Embedded Cross-compilation environment ARM-LINUX-GCC construction process diagram

Pre-Installation ramble

First, a simple introduction, the so-called cross-compilation environment, that is, the installation, configuration cross-compilation tool chain. In this environment, the embedded Linux system needs to compile the operating system, applications, etc., and then uploaded to the target machine.

The cross-compilation Toolchain is a program code for compiling, linking, processing, and debugging cross-platform architectures. For cross-development toolchain, a prefix is added to the file name to distinguish the local toolchain. For example, arm-linux-represents a cross-compilation tool chain to Arm; ARM-LINUX-GCC represents a compiler that uses GCC. In addition to the architecture-related compilation options, it is used the same way as the GCC on a Linux host, so Linux programming techniques are also applicable to embedded systems. However, not all versions can be used, and various packages often have version matching issues. For example, compiling the kernel requires using the arm-linux-gcc-4.3.3 version of the cross-compilation toolchain, and using the arm-linux-gcc-3.4.1 cross-compilation Toolchain will cause compilation to fail.

So what is the difference between GCC and ARM-LINUX-GCC? The difference is that GCC is the C language compiler under Linux, the compiled program is executed locally, and ARM-LINUX-GCC is used to cross-platform C compiler under Linux, the compiled program is executed on the target machine (such as ARM platform), embedded development should use the embedded cross-compiler tool chain.

Installation steps

1, the compression package arm-linux-gcc-4.4.3.tar.gz stored in a directory, this directory is you will unzip the directory, after this directory can not be arbitrarily deleted, my storage path is/home/song/software, such as, remember this path, It will be used for a while.

2. Use the tar command: Tar zxvf arm-gcc-4.4.3.tar.gz to install the arm-linux-gcc-4.4.3.tar.gz decompression under the Software folder into the current directory as

You can see the decompression is successful, and the extracted files are stored in the/home/song/software/opt/friendlyarm/toolschain/4.4.3 folder, as shown, this storage path can be remembered, such as

3, next configure the system environment variables, the cross-compilation tool chain to add the path to the environment variable path, so that you can use these tools in any directory. Note the installation path in the previous step, using the command: Vim/etc/profile edit the profile file and add environment variables.

Add the last line in profile: Export path= $PATH:/home/song/software/opt/friendlyarm/toolschain/4.4.3/bin This path is the path where the bin directory resides, Maybe you are not the same, according to your actual directory to fill in, such as 32 lines

It's good to write the save.

4. Use command: Source/etc/profile make environment variable effective

5, enter the command on the terminal arm-linux and then press the TAB key, you can see that the environment variable setting is successful

6, use command: ARM-LINUX-GCC-V will appear the following error prompt:/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 the Ubuntu12.04 is 64-bit, and the workaround is to use the command: sudo apt-get install ia32-libs to install some 32-bit libraries

7, after installing the 32-bit library, then use the command: Arm-linux-gcc-v, this time succeeded, such as

8, verify, compile a hello.c file

Use the command: ARM-LINUX-GCC hello.c-o hello to see if the compilation was successful

It is visible that the binaries were generated successfully.

Ubuntu 12.04 Embedded Cross-compilation environment ARM-LINUX-GCC construction process diagram

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.