Things You'll Need:
- ARM9 SBC
- Linux Operating System
- Intel Pentium PC
- ARM9 GNU Tool-Chain Package(s)
-
Step 1
Find a tool-chain package for your target board, for instance ARM9,PPC and download the package(s). There are sites on the internet where you can download the GNU tool-chain.
Download sites:
http://www.codesourcery.com/gnu_toolchains/arm
http://www.kegel.com/crosstool
http://www.aleph1.co.uk/oldsite/armlinux//docs/toolchain/toolchHOWTO/x43.htm/ -
Step 2
Extract the binaries to the host machine. You can test the extraction in a temp directory. If you feel the need to verify the integrity of the zipped file use the MD5 version.
-
Step 3
After you extract the files you should have a path to your tool-chain that contains GNU tools used for compiling programs for your target board. Create links inside your tool-chain directory to your binaries used by GCC to build target executables. The link names should be the short names used by the GCC. The command on a host machine for an ARM9 target where the tool-chain is located in /usr/local/arm is ln -s /usr/local/bin/arm-linux-gcc /usr/local/arm/bin/gcc. However, this must be done for each tool so, a script would be much more efficient than doing this by hand. I used a BASH script that I wrote, but it could not be included here.
-
Step 4
You must make sure your paths are correct when you compile your programs for your target. When the tool-chain was built it should have been configured to search its install path for the GNU build tools. In this case it was prefix=/usr/local/arm. Use the -Bprefix option if you get an error saying a utility could not be found, for example /usr/local/arm/bin/gcc -v -o test -B/usr/local/arm test.c. -Bprefix tells GCC to look at the path specified after -B for the utilities used for building your executable. The resulting executable will not run on your host machine so, move it to your target and verify that it was built correctly.
If you don't have the shared libraries used by your program installed on your embedded board you can use the -static option of GCC. When you use -static the linker program will compile the libraries into your executable instead of searching the library paths for the shared binary. If this is not done and you don't have the shared libraries on your embedded board, your the program will complain about not being able to find the shared libraries. One of the disadvantage of using this option is that your executable will be much larger, but an advantage is that your executable will load faster and run without the shared library. Make sure you modify the build scripts for your source code to use the right tools.






