We also need to install a cross-compilation tool before we can formally begin to write the bare-metal program. What is a cross-compilation tool? It is actually compiling the program on the x86 Ubuntu host and can run the build tool in the ARM environment. GCC is the local compilation tool, which has been installed at the beginning of this article. Now we need to install the cross-compiler tool ARM-LINUX-GCC. I am now directly using the factory-made tools, just unzip and add to the environment variables can:
sudo tar xzf arm-linux-gcc-4.3.2.tgz-c/
Then modify "/etc/environment" to add the path to the bin file of the cross-compilation tool in Path:
Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/arm/ 4.3.2/bin "
After logging off or restarting, the environment variable takes effect and can be tested using the following command:
Arm-linux-gcc-v
If you have the following information output, the installation is successful:
Using built-inchspecs. Target:arm-none-linux-gnueabiconfigured with:/scratch/julian/lite-respin/linux/src/gcc-4.3/configure--build=i686-pc-linux-gnu--host=i686-pc-linux-gnu--target=arm-none-linux-gnueabi--enable-threads-- Disable-libmudflap--DISABLE-LIBSSP--disable-libstdcxx-pch--with-gnu- as--with-gnu-ld--enable-languages=c,c++--enable-shared--enable-symvers=gnu--enable-__cxa_atexit--with-pkgversion ='sourcery g++ Lite 2008q3-72'--with-bugurl=https://support.codesourcery.com/gnutoolchain/--disable-nls--prefix=/opt/codesourcery--with-sysroot=/opt/ CODESOURCERY/ARM-NONE-LINUX-GNUEABI/LIBC--with-build-sysroot=/scratch/julian/lite-respin/linux/install/ ARM-NONE-LINUX-GNUEABI/LIBC--with-gmp=/scratch/julian/lite-respin/linux/obj/ HOST-LIBS-2008Q3-72-ARM-NONE-LINUX-GNUEABI-I686-PC-LINUX-GNU/USR--with-mpfr=/scratch/julian/lite-respin/linux/ OBJ/HOST-LIBS-2008Q3-72-ARM-NONE-LINUX-GNUEABI-I686-PC-LINUX-GNU/USR--disable-libgomp-- Enable-poison-system-directories--with-build-time-tools=/scratch/julian/lite-respin/linux/install/ Arm-none-linux-gnueabi/bin--with-build-time-tools=/scratch/julian/lite-respin/linux/install/ Arm-none-linux-gnueabi/binThread MODEL:POSIXGCC Version4.3.2(Sourcery g++ Lite 2008q3- the)
The following is the beginning of the bare-metal program, and the first section prepares to introduce Gpio.
Embedded Linux Tour--Installation of cross-compiling tools for environment building