248Chapter8 • Cross-Platform and Embedded Systems Development
platform development tools should be compatible with Linux as a host machine. Depending
upon CPU family used for the target system, your toolset must be capable of generating code for
the target machine. In the case of GNU development tools, you need to have a number of things
to work together to generate executable code for the target. For example, you must have at least
the following available on your Linux machine.
•Cross compiler
•Cross assembler
•Cross linker
•Cross debugger
•Cross-compiled libraries for the target host.
•Operating system-dependent libraries and header files for the target system.
These components will enable you to compile, link and debug code for the target environ-
ment. In this section, you will learn how to develop a cross-compilation environment on your
Linux machine.
You have already built a native GCC compiler in Chapter 3. Conceptually, building a cross
compiler is not much different from building a native compiler. However there are additional
things that you should keep in mind while building a cross compiler. The most significant of
these is the command line listing of the target when running the configure script. The whole pro-
cess may be slightly different depending upon targets. The best resource to find out detailed
information about how to build a cross compiler is the CrossGCC FAQ and mailing list. The
FAQ is found at http://www.objsw.com/CrossGCC/ and using information in this FAQ, you can
subscribe to and search the CrossGCC mailing list. I would suggest getting a cross compiler
from a vendor instead of building it yourself. Many companies, including RedHat (http://
www.redhat.com) and Monta Vista Inc. (http://www.mvista.com), provide development tools for
embedded Linux development of different CPU families.
8.4.0.1Cross Debugging
There are multiple methods of debugging that you can use in the cross-platform develop-
ment environment. Most commonly you can use emulators, JTAG, and remote debugging over
serial or network links. Some of these methods are discussed in this section.
8.4.1Software Emulators
Software emulators are software tools that can emulate a particular CPU. Using a software
emulator you can debug through your code and find out CPU register values, stack pointers and
other information without having a real CPU. Software emulators are useful when you don’t
have the real hardware available for testing and debugging and want to see how the CPU will
behave when a program is run on it. Keep in mind that these are not very useful tools to simulate
real hardware because there are many other hardware components that are built onto the target
machine.