ARM cross compilation toolchain installation under Ubuntu

Only as a study note for learning punctual atomic Linux embedded development

Cross-compilation:
Cross-compilation is the generation of executable code on one platform on another platform. The same architecture can run different operating systems; likewise, the same operating system can run on different architectures.

Development trend:
With the rapid development of information technology mainly based on computer technology and communication technology and the wide application of the Internet, the integration of 3C (Computer, Communication, ConsumerElectronic) will become an inevitable trend. The rapid development of embedded products such as information appliances, handheld devices, and mobile devices makes embedded software development a research hotspot again. Due to the performance limitations of embedded devices, it is often impossible to obtain the executable program of the required software through local compilation. Therefore, using Linux as the host operating system and a cross-compilation system to generate executable programs for embedded devices has become an increasingly popular solution for compiling embedded software. The open source compiler GCC, after years of development, has been able to support almost all processors of well-known manufacturers, and is an ideal cross compiler in embedded software development.

--Baidu Encyclopedia

The gcc compiler that comes with Ubuntu is for the X86 architecture and cannot compile software that can be executed on the ARM platform. To compile executable files on the ARM architecture, you must use a cross compiler. The cross compiler to be introduced in this article is arm-linux-gnueabihfdeveloped by Linaro Company.

Linaro, a non-profit open source software engineering company whose primary goal is to develop common software across system-on-a-chip (SoC) platforms from various semiconductor companies, for the benefit of consumers and manufacturers. It develops ARM development tools, the Linux kernel, and the main automated build system for Linux distributions (including Android and Ubuntu) for the ARM system-on-a-chip (SoC) launched by each member.

The punctual atom related tutorial uses the 4.9 version of the cross compiler, so I also download this version here, the download address: https://releases.linaro.org/components/toolchain/binaries/4.9-2017.01/arm-linux-gnueabihf /

I chose x86_64 because my Ubuntu is 64-bit,

insert image description here

Copy the downloaded compressed package to Ubuntu,

insert image description here

Use tar -vxf gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf.tar.xzto decompress, or directly use the graphical interface to right-click to decompress.

After the decompression is complete, bin/copy the absolute address of the directory of the compilation tool,

insert image description here

Modify the /etc/profilefile, and then add export PATH=$PATH:+ the absolute path copied above at the end, in order to add the command of the cross compiler to the global variable.

insert image description here

After the modification is complete, restart Ubuntu.

Use to arm-linux-gnueabihf-gcc -vsee if the cross compiler works.

insert image description here

Next we compile a program with arm-linux-gnueabihf-gcc,

insert image description here

Through the file command, we can view the properties of the program we just compiled. The following information indicates that the app is an executable file under the ARM architecture.

insert image description here

Guess you like

Origin blog.csdn.net/weixin_43772810/article/details/123731744