Description: For learning and communication only
One, the concept of cross-compiling tool chains
In the embedded development process, there are host and target machine points.
Host: The host is the computer that executes the compiled, linked embedded software.
Target machine: The target machine is the hardware platform to run the embedded software.
A series of tools, such as preprocessing, compiling, compiling, linking, and so on, are called cross-compilation toolchain.
Two. Installing the cross-compilation tool chain
(1): Unzip the package to the root directory, using the command
TAR–ZXF Arm-linux-gcc-4.4.3.tar.gz–c/
(2): Configure environment variables
Method One: Add the following code to the/etc/profile file: Vim/etc/profile
Then make the environment variable effective, using the command: Source/etc/profile
Method Two: We can also be implemented by adding the following statement to the/ROOT/.BASHRC
Export path= $PATH:/opt/friendlyarm/toolschain/4.4.3/bin
Note:/ROOT/.BASHRC is a bash script that will run when the root user opens the terminal, and all statements added to it will be executed when each terminal is opened.
Next, enter some information about the cross-compilation toolchain in Arm-linux-gcc–v, which indicates that the installation was successful.
After I installed the cross-compiler tool chain, I wrote a small program to test, the results of the prompt:
/usr/lib/libstdc++.so.6:version ' glibcxx_3.4.9 ' not found.
The reason for this is that the glibc version of my Linux is lower than the reason and needs to be updated, only need to download libstdc++.so.6.0.10 files from the Internet into the/urs/lib directory. Then we re-do libstdc++.so.6. Soft Links:
First delete the previous libstdc++.so.6, terminal input: rm-rf/urs/lib/libstdc++.so.6,
Redo libstdc++.so.6 Soft link, terminal input: ln-s/urs/lib/libstdc++.so.6.0.10/urs/lib/libstdc++.so.6,
This will be OK.
The specific reason is: Here libstdc++.so.6 is a soft link, it is linked to libstdc++.so.6.0.8. and libstdc++.so.6.0.8 no ' glibcxx_3.4.9
All we want to download libstdc++.so.6.0.10, because it has glibcxx_3.4.9, hehe.
Objdump use of DISASSEMBLY commands:
You can use the command arm-linux-objdump–d–s Hello > log when we need to view the compilation of the source code
Use of the readelf command:
When we need to look at the architecture of the executable file, such as whether the program is big-endian or small-end, is X86 platform or arm platform, etc., can be viewed by command: arm-linux-readelf–a Hello >log.
Three, summary
Only after installing the cross-compilation toolchain can we talk about the development of the embedded, it is also important to note that for different versions of U-boot or kernels, you may need to choose a different cross-compilation toolchain, especially for some old u-boot, the newer version of the cross-compiler toolchain may not pass, This is because some of the older U-boot's makefile may have compiled options that are no longer in use.