Attaching to a Running Process Using gdbserver

260 Chapter 8 • Cross-Platform and Embedded Systems Development • Glibc 2.1.3, which allows dynamically linked programs to run on the embedded platform. • X-Free version 4.0.2 • Ncruses library • Bash shell • Busybox which is a Swiss army knife of generally used UNIX utilities • Networking suite and utilities • Use management utilities • Modules handling utilities • Syslogdklogd • Terminal handling Onboard flash memory is divided into three parts. Partition mounted on is read-only at the boot time and contains Linux system. Two other file systems var and vartmp are mounted as read-write at the boot time and can be used to store temporary files. In addition to that, you can also use the removable flash card to store files. Bundled utilities on accompanying disks can be used to re-install the operating system or add new components. In networked sys- tems, you can also use a NFS server to add more storage space. Arcom also provides RedHat 6.2 CD that you can use to install Linux on a PC. This PC will be used as the development system or a host machine. The Arcom embedded Linux board will act as the target system. This means that in addition to the single board computer with Embedded Linux installed on it, you also get the Linux operating system to use as a develop- ment platform.

8.6.2 Artesyn PMPPC Mezzanine Card

The other embedded system used in the development of this book is Artesyn PMPPC mezzanine card that can be plugged into a carrier card. Artesyn also supplied the carrier card for this purpose. It is a PowerPC 750 based card and provides the Ethernet and serial interfaces to the outside world directly from the PMC PCI Mezzanine Card. It contains 64 Mbytes of RAM, I 2 C bus, general purpose timers, real-time clock, LEDs and so on. The board also contains flash memory that can be used to store the operating system and utilities. It has a real-time clock and PLD used to setup memory map The CPU runs at 333 MHz. Boot flash is used to store the oper- ating system. The optional JTAG connector can be used to download and debug code. As mentioned earlier, you need a career card to power up the PMC and Artesyn provides you with a CC1000 PMC carrier card that can host up to two PMC. CC1000 can be placed into a Compact PCI chassis that allows 6U cards to be plugged in. More information can be found on the Artesyn web site http:www.artesyncp.com or by sending an email to infoartesyncp.com. References 261

8.7 References

1. Arcom web site at http:www.arcomcontrols.com 2. Artesyn web site at http:www.artesyncp.com

3. Embedded Linux web site at http:www.linux-embedded.org 4. Busybox for Embedded Linux at http:www.busybox.net 263 C H A P T E R 9 Platform Independent Development with Java n previous chapters most of the discussion centered around GNU devel- opment tools and programming in C and C++ languages. This chapter is devoted to Java development and describes how to use some Java tools and a Java virtual machine. As many of the readers already know, Java is a different language com- pared to other compile-and-execute languages in that it needs a Java vir- tual machine JVM to execute what is called byte code. Each platform has its own implementation of the Java virtual machine. There are many JVMs available on Linux platform in free and open source as well as com- mercial domains. Some virtual machines are also available for embedded Linux platforms that are very small in size and need little memory to exe- cute. You can select a virtual machine based upon your requirements. Java virtual machines are built on Java Language Specifications JLS. Infor- mation about JLS and books in downloadable format can be found at http:java.sun.comdocsbooksjls. This chapter provides some information about how to use different devel- opment tools on Linux. The most commonly available tools are Sun SDK and GNU gcj compiler. Kaffe and Jboss are other very popular open source development tools on Linux and these are introduced in this chap- ter. However please note that this chapter is not a tutorial on Java lan- I 264 Chapter 9 • Platform Independent Development with Java guage and if you are new to the language, you get help from many other resources on the Internet as well as in print media. Some of the most pop- ular include Sun Java SDK, IBM Java SDK, Kaffe, and gcj.

9.1 How Java Applications Work

Java is a sort of interpreted language. Any program you write in Java is first compiled to generate byte code. Depending upon type of output, the byte code may be in the form of a Java application or a Java applet. In the case of Java applications, you can directly invoke the Java virtual machine to execute it. If the output type is an applet, it is usually loaded into a browser for execution.

9.1.1 Java Compiler

The Java compiler is used to build Java applications or applets from source code files. In most of the cases, the compiler is invoked as javac command. It also uses standard class librar- ies that are usually part of the Java distributions.

9.1.2 Java Virtual Machine

The purpose of the Java virtual machine is to execute Java code. In most cases, the virtual machine is available as the command java. To run any application, you can just invoke the java command with the application name as the command line argument.

9.2 Kaffe

Kaffe is one of the popular freely available implementations of the Java virtual machine. You can download it from its web site http:www.kaffee.org. At the time of writing this book, ver- sion 1.0.6 is available from the web site. I am using RedHat 7.1 for the development of this book and this version is also part of the distribution. Most of the binaries are installed in usrbin directory. The following command displays version information for Kaffe: [rootdesktop Java] java -version Kaffe Virtual Machine Copyright c 1996-2000 Transvirtual Technologies, Inc. All rights reserved Engine: Just-in-time v3 Version: 1.0.6 Java Version: 1.1 [rootdesktop Java] Note that the actual Kaffe Virtual machine is present as usrbinkaffe and usr binjava is simply a shell script like the following to invoke Kaffe. binsh Pretend Kaffe is Java prefix=usr exec_prefix=usr exec usrbinkaffe {1+}