First, download the arm-linux-gcc-4.4.3.tar.gz installation package, the installation package address:
Http://www.cr173.com/soft/42654.html
Second, unpack the installation package:
sudo tar-zxvf arm-linux-gcc-4.4.3.tar.gz-c/
Note that there is a space behind C so that the extracted files are in:/opt/friendlyarm/toolschain/4.4.3 path
III. Create a new arm directory under the/usr/local directory and copy the 4.4.3 to arm directory under the/opt/friendlyarm/toolschain/path:
Cd/usr/local
sudo mkdir arm
sudo chmod 777 arm
sudo cp-r/opt/friendlyarm/toolschain/4.4.3/usr/local/arm
Modify environment variables and add ARM-LINUX-GCC to path:
Method One: Modify the/ETC/BASH.BASHRC file, which applies only to the current user
sudo gedit/etc/bash.bashrc
At the end of the add export path= $PATH:/usr/local/arm/4.4.3/bin
Save, exit, and then refresh the environment variable to make it effective:
Source/root/.bashrc
Method Two: Modify the/etc/profile file, which is applicable to all users
sudo gedit/etc/profile
At the end of the add export path= $PATH:/usr/local/arm/4.4.3/bin
Save, exit, and then refresh the environment variable to make it effective:
Source/etc/profile
Method Three: Modify the/etc/environment file
sudo gedit/etc/environment
At the end add :/usr/local/arm/4.4.3/bin
Save, exit, and then restart the system
V. Check that the environment variable is added correctly:
Echo $PATH
If /usr/local/arm/4.4.3/bincan be displayed, the environment variable is added successfully
Six, check whether the ARM-LINUX-GCC is installed correctly:
Arm-linux-gcc-v
Using built-in specs.
Target:arm-none-linux-gnueabi
Configured with:/opt/friendlyarm/mini2440/build-toolschain/working/src/gcc-4.4.3/configure--build=i386-build_ Redhat-linux-gnu--host=i386-build_redhat-linux-gnu--target=arm-none-linux-gnueabi--prefix=/opt/FriendlyARM/ toolschain/4.4.3--with-sysroot=/opt/friendlyarm/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root-- enable-languages=c,c++--disable-multilib--with-arch=armv4t--with-cpu=arm920t--with-tune=arm920t--with-float= Soft--with-pkgversion=ctng-1.6.1--disable-sjlj-exceptions--enable-__cxa_atexit--with-gmp=/opt/friendlyarm/ toolschain/4.4.3--with-mpfr=/opt/friendlyarm/toolschain/4.4.3--with-ppl=/opt/friendlyarm/toolschain/4.4.3-- with-cloog=/opt/friendlyarm/toolschain/4.4.3--with-mpc=/opt/friendlyarm/toolschain/4.4.3--with-local-prefix=/ Opt/friendlyarm/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root--disable-nls--enable-threads=posix-- Enable-symvers=gnu--enable-c99--enable-long-long--enable-target-optspace
Thread Model:posix
GCC version 4.4.3 (ctng-1.6.1)
The display has been successfully installed.
Seven, write the test procedure, compile with ARM-LINUX-GCC:
Create an empty document, write the following code, and save it as test.c:
#include <stdio.h>
void Main (void)
{
printf ("%s", "Hello world!\n");
}
Enter the following command:
Arm-linux-gcc-o Hello test.c
The hello executable is generated when the compilation is complete, and you can view the generated file information by entering the following command:
Readelf-h Hello
ELF Header:
magic:7f 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class:elf32
Data:2 ' s complement, little endian
Version:1 (current)
Os/abi:unix-system V
ABI version:0
Type:exec (executable file)
Machine:arm
version:0x1
Entry Point address:0x8334
Start of Program headers:52 (bytes to file)
Start of section headers:4464 (bytes to file)
flags:0x5000002, Version5 EABI, <unknown>
Size of this header:52 (bytes)
Size of Program headers:32 (bytes)
Number of program Headers:10
Size of section headers:40 (bytes)
Number of section headers:30
Section header string Table index:27
You can see the executable file platform for the arm platform.
Install arm-linux-gcc4.4.3 on Ubuntu16.04