Installing
a precompiled gnu-toolchain
Embedded programming
comes with some complexities due to the limitations and specialization of the
target the
hardware. Embedded
software is usually installed and executed on small devices like mobile phones,
televisions, microwave ovens and other consumer appliances that don't have the
resources and power for software engineering. In addition to this many embedded
systems use processors with different instruction sets or architectures.
The GNU
tool-chain is the set of software tools used to build software executables. The tool-chain
is compiled and installed for a specific hardware platform like PPC and ARM for
example. In this article I explain how to install a pre-compiled GNU tool-chain
for developing embedded software for an ARM9 architecture running Linux. Other
platforms will have a similar approach to installing the tool-chain software.
Using a pre-compiled version of the GNU tool-chain is easier than finding and
piecing the tool-chain together yourself. I've done this before while building
software, it's very time consuming and should be avoided if possible. You'll
avoid the difficulties of searching for sources that will work on your target
platform after being compiled and installed. The pre-compiled tool-chain
contains the binaries ready to be installed on the host
machine.
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.
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.
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.
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.
The easiest way to
work with your target board is through a Network
File System (NFS) mount from the target to the host machine if this
option is available.
The above steps worked for me, use them at your own
risk. I take no responsibility for any problems caused by following the
steps.
Home Page
This
Web Page Created with PageBreeze
Free Website
Builder
