s5pv210开发与学习:1.4之安装交叉编译工具链(toolchain)

交叉工具链

交叉编译:是A机器上编译生成,运行在B机器上。两个机子有不同的机器指令。

工具链:一般由编译器、连接器、解释器和调试器组成。

扩展阅读:https://www.cnblogs.com/coolYuan/p/9037660.html

1.准备资料:arm-2009q3.tar.bz2(文中资源文件为网友分享)

1.1将工具链压缩包解压、安装:

sudo mkdir /usr/local/arm
sudo tar -jxvf arm-2009q3.tar.bz2 -C /usr/local/arm/

查看解压的文件:


/usr/local/arm/arm-2009q3
XXX@XXX:/usr/local/arm/arm-2009q3$ ls
arm-none-linux-gnueabi  bin  lib  libexec  share

交叉编译工具链可执行文件的路径:


/usr/local/arm/arm-2009q3/bin
XXX@XXX:/usr/local/arm/arm-2009q3/bin$ ls
arm-none-linux-gnueabi-addr2line  arm-none-linux-gnueabi-gcc-4.4.1  arm-none-linux-gnueabi-objdump
arm-none-linux-gnueabi-ar         arm-none-linux-gnueabi-gcov       arm-none-linux-gnueabi-ranlib
arm-none-linux-gnueabi-as         arm-none-linux-gnueabi-gdb        arm-none-linux-gnueabi-readelf
arm-none-linux-gnueabi-c++        arm-none-linux-gnueabi-gdbtui     arm-none-linux-gnueabi-size
arm-none-linux-gnueabi-c++filt    arm-none-linux-gnueabi-gprof      arm-none-linux-gnueabi-sprite
arm-none-linux-gnueabi-cpp        arm-none-linux-gnueabi-ld         arm-none-linux-gnueabi-strings
arm-none-linux-gnueabi-g++        arm-none-linux-gnueabi-nm         arm-none-linux-gnueabi-strip
arm-none-linux-gnueabi-gcc        arm-none-linux-gnueabi-objcopy

1.2将交叉编译工具链路径添加到环境变量中:

#修改/etc/profile文件
XXX@XXX:/usr/local/arm/arm-2009q3/bin$sudo vim /etc/profile

#文件末尾添加一行
export PATH=/usr/local/arm/arm-2009q3/bin:$PATH

#使环境变量生效
XXX@XXX:/usr/local/arm/arm-2009q3/bin$source /etc/profile
#查看环境变量
XXX@XXX:/usr/local/arm/arm-2009q3/bin$env
#查看交叉编译工具链的版本,即可知工具链安装成功
XXX@XXX:~$ arm-none-linux-gnueabi-gcc -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /scratch/julian/2009q3-respin-linux-lite/src/gcc-4.4/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 --enable-extra-sgxxlite-multilibs --with-arch=armv5te --with-gnu-as --with-gnu-ld --with-specs='%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables} %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}' --enable-languages=c,c++ --enable-shared --disable-lto --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2009q3-67' --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/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-ppl=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-cloog=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67)

1.3为交叉编译工具链添加软链接,执行脚本mk-arm-linux-.sh

XXX@XXX:/usr/local/arm/arm-2009q3/bin$ sudo bash mk-arm-linux-.sh
XXX@XXX:/usr/local/arm/arm-2009q3/bin$ ls
arm-linux-addr2line  arm-linux-gprof                   arm-none-linux-gnueabi-ar         arm-none-linux-gnueabi-ld
arm-linux-ar         arm-linux-ld                      arm-none-linux-gnueabi-as         arm-none-linux-gnueabi-nm
arm-linux-as         arm-linux-nm                      arm-none-linux-gnueabi-c++        arm-none-linux-gnueabi-objcopy
arm-linux-c++        arm-linux-objcopy                 arm-none-linux-gnueabi-c++filt    arm-none-linux-gnueabi-objdump
arm-linux-c++filt    arm-linux-objdump                 arm-none-linux-gnueabi-cpp        arm-none-linux-gnueabi-ranlib
arm-linux-cpp        arm-linux-ranlib                  arm-none-linux-gnueabi-g++        arm-none-linux-gnueabi-readelf
arm-linux-g++        arm-linux-readelf                 arm-none-linux-gnueabi-gcc        arm-none-linux-gnueabi-size
arm-linux-gcc        arm-linux-size                    arm-none-linux-gnueabi-gcc-4.4.1  arm-none-linux-gnueabi-sprite
arm-linux-gcc-4.4.1  arm-linux-sprite                  arm-none-linux-gnueabi-gcov       arm-none-linux-gnueabi-strings
arm-linux-gcov       arm-linux-strings                 arm-none-linux-gnueabi-gdb        arm-none-linux-gnueabi-strip
arm-linux-gdb        arm-linux-strip                   arm-none-linux-gnueabi-gdbtui     mk-arm-linux-.sh
arm-linux-gdbtui     arm-none-linux-gnueabi-addr2line  arm-none-linux-gnueabi-gprof
#file: mk-arm-linux-.sh
ln arm-none-linux-gnueabi-addr2line -s arm-linux-addr2line
ln arm-none-linux-gnueabi-ar -s arm-linux-ar
ln arm-none-linux-gnueabi-as -s arm-linux-as
ln arm-none-linux-gnueabi-c++ -s arm-linux-c++
ln arm-none-linux-gnueabi-c++filt -s arm-linux-c++filt
ln arm-none-linux-gnueabi-cpp -s arm-linux-cpp
ln arm-none-linux-gnueabi-g++ -s arm-linux-g++
ln arm-none-linux-gnueabi-gcc -s arm-linux-gcc
ln arm-none-linux-gnueabi-gcc-4.4.1 -s arm-linux-gcc-4.4.1
ln arm-none-linux-gnueabi-gcov -s arm-linux-gcov
ln arm-none-linux-gnueabi-gdb -s arm-linux-gdb
ln arm-none-linux-gnueabi-gdbtui -s arm-linux-gdbtui
ln arm-none-linux-gnueabi-gprof -s arm-linux-gprof
ln arm-none-linux-gnueabi-ld -s arm-linux-ld
ln arm-none-linux-gnueabi-nm -s arm-linux-nm
ln arm-none-linux-gnueabi-objcopy -s arm-linux-objcopy
ln arm-none-linux-gnueabi-objdump -s arm-linux-objdump
ln arm-none-linux-gnueabi-ranlib -s arm-linux-ranlib
ln arm-none-linux-gnueabi-readelf -s arm-linux-readelf
ln arm-none-linux-gnueabi-size -s arm-linux-size
ln arm-none-linux-gnueabi-sprite -s arm-linux-sprite
ln arm-none-linux-gnueabi-strings -s arm-linux-strings
ln arm-none-linux-gnueabi-strip -s arm-linux-strip

 

你可能感兴趣的:(5.ARM裸机)