Embedded Development (I) Build a cross-compilation environment under Ubuntu12.04, embedded ubuntu12.04

Source: Internet
Author: User

Embedded Development (I) Build a cross-compilation environment under Ubuntu12.04, embedded ubuntu12.04

Operating System: Ubuntu12.04 AMD64-bit

Cross-compilation environment: arm-Linux gcc version 4.4.3

Preface:

First, understand the meaning of cross-compilation. We need to write applications for embedded devices, but we cannot complete all code development on embedded devices, it can only be completed on one work PC and then compiled into a binary file and uploaded to an embedded device. However, the compilation tool chain we choose cannot be on the work PC, but should be the compilation tool chain on embedded devices. Therefore, we need to build a cross-compilation tool chain for embedded devices on the PC. For example, the gcc version on the PC may be 4.6, but the arm-linux-gcc version is 4.4.3.

Construction Process:

1. Download the cross-compilation toolkit suitable for your own Development Board This document uses arm-linux-4.4.3.tar.bz2 as an example.

2. decompress the package to the/usr/local/arm directory.

# tar xvf arm-linux-4.4.3.tar.bz2 -C /usr/local/arm
3. Set Environment Variables
# Add row export PATH = $ PATH:/usr/local/arm/arm-linux-4.4.3/bin at the end of vi/etc/profile
Iv. Import Environment Variables
# source /etc/profile
V. Test
# arm-linux-gcc -v
The following picture indicates that it is OK...

However, it is very likely that it was not so smooth, And I encountered a problem. after entering the above command, the following error occurs:

/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

I checked it on the Internet and found that Ubuntu uses a 64-bit system and needs to install some 32-bit libraries:

$ sudo apt-get install ia32-libs

And because the ia32-libs is a library being eliminated, so some of its dependent packages may not be automatically downloaded, you can follow his tips first install the ia32-libs dependency package, finally, you can install it.

Then try # arm-linux-gcc-v!

 
How to build a cross-compilation environment in Ubuntu?

The following is a description of some problems, in order to attract others.

The application development environment based on the Linux operating system is generally composed of the target system hardware (Development Board) and the host PC. The target hardware development board is used to run the operating system and system application software, the kernel compilation and application development and debugging of the operating system used by the target Board need to be completed through the host PC (therefore called cross-compilation ). Generally, the two parties establish a connection through a serial port, a parallel port, or an Ethernet interface.

However, I suggest you build the following cross-compilation environment for individual or R & D teams to use: Use a single PC (PII or above, just use the old machines that have been eliminated before ), to install a Linux operating system (such as Red Hat Linux 8.0 or later) on the PC, you can use the default installation option (including the FTP service). This PC is used as a Linux server, in addition to the Administrator, it is generally not allowed to be operated by others directly.

Connect the Linux server to the LAN and create some valid users so that the legitimate users of other PCs (referred to as workstation) can access the Linux server. Other PCs (workstations) still use the Windows operating system.

Required software tools include:

1. FTP client programs (such as Cuteftp, can be downloaded online ).

2. Telnet tool (such as SecureCRT, which can be downloaded from the Internet ).

3. source code of the Linux operating system kernel transplanted to a specific ARM platform (usually provided by the vendor ).

4. GNU compilation tools can be downloaded from related websites or provided by vendors.

Install on workstation:

Install the FTP client program and Telnet tool on a PC of a workstation. After installation, you can transfer files between the PC and the Linux server of the workstation, you can also log on to the Linux server through Telnet on the workstation PC (you may need to disable the Firewall Service of the Linux Server ).

Install On a Linux Server:

Transfer the Linux operating system kernel source code package on the PC and the GNU compilation tool to a directory (such as a valid user directory) on the Linux server through FTP, and decompress the package under the directory, install the GNU compilation tool to the default working directory. The above work is done by using the Telnet tool on the workstation PC, instead of on the Linux server.

Linux Kernel Compilation:

There is usually a fixed step for compiling the Linux operating system kernel, which varies slightly according to the MakeFile file. For details, refer to the relevant documentation. The compilation is completed on the workstation PC using the Telnet tool.

After the kernel is compiled in a fixed step, an executable binary file is generated in the corresponding directory, and the executable binary file is sent back to the workstation PC through FTP, however, it will be written to the Flash of the Development Board through the spark writing tool under ADS or SDT.
 
How to build a cross-compilation environment

The linux cross-compilation tool has the following types:
Use the crosstool-ng tool to create a cross-compilation tool chain. Www.cnblogs.com/..9.html
Directly install ELDK www.cnblogs.com/...3.html
Download the cross-compilation tool chain prepared by others, and install it to wenku.baidu.com/..pxi9bk.
If you are just getting started with embedded development, you are not recommended to make it by yourself. You can use either the second method or the third method.
For the second question you mentioned, decompression is only decompression, or self-compilation, and then installation. For more information about the installation method, see README. TXT.


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.