Michael Mathews

Subscribe to Michael Mathews: eMailAlertsEmail Alerts
Get Michael Mathews: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn

Related Topics: Java EE Journal, OSGi, Java Developer Magazine

J2EE Journal: Article

The Expanding World of Embedded Linux with Java

Greater flexibility for project development and deployment

Today we are participants in the new age of information access and consumption for personal and business use. New types of information and new ways of using it are driving up demand for anytime and anywhere access, feeding a need for always-on and always-connected devices. Connectivity changes everything!

This is nowhere more evident than in systems that combine the new generation of smart embedded devices with powerful end-to-end services that integrate smart things to better serve and simplify the user's environment. Deployment of these services involves a level of complexity that many embedded developers may not have dealt with before. These devices are found everywhere – in the pocket or purse, in the car, in the home, and of course in the office. They are symbols of the next generation of Net-centric computing and communications convergence.

They must be small, powerful, flexible, easy to use, secure, and affordable. They must integrate well with the existing infrastructure, work well with legacy devices, and support an easy and painless forward migration. They will have a short life span, followed closely by the next product, and therefore must be brought to market quickly, on time, and on budget.

Why Embedded Linux?
Embedded Linux delivers the reliability, openness, and performance required by the new generation of smart devices. This helps the development team quickly embrace embedded platform technology, allowing them to start by focusing on the unique requirements of deploying applications on compact connected things. Embedded Linux also provides access to the widest number of processor architectures and board implementations, allowing more flexibility in the choice of a deployment platform. When properly adapted for embedded applications, Linux offers the project manager and developer the best option on which to build embedded solutions. As the core Linux technology evolves to address new requirements, the infrastructure continues to grow, providing support for numerous new devices, technologies, protocols, and services. This work addresses the driver development and integration necessary to fully support the features and functions of a board. Most deployment platforms are custom made, based on a standard architecture and reference board. With access to the source code, Linux facilitates this approach, making it possible to develop several generations of a product family taking advantage of the evolution of the hardware technology over time.

With modern embedded Linux distributions, using a standard PC-based host for application development and testing is powerful and efficient. Cross-development support allows programmers to build and test code running on the target platform while connected to the host platform. This facilitates rapid test and debug cycles resulting in much shorter time-to-market projects (see Figure 1).


Why Embedded Java?
With all of the facilities and flexibility available from embedded Linux today, it might seem that using embedded Java for the applications is not necessary.

Java technology offers embedded systems developers some clear advantages over current alternatives such as C and C++ or assembler. The most significant are ease of development and maintenance; the facility to reuse code, easy integration with the native system when necessary; and availability of a large number of developers.

Java has been very successful over the past few years in the world of client/server applications, and more recently in the burgeoning e-commerce application server market. The focus in this space has led to many innovations that have benefited Java as an application environment – many that apply equally well to embedded applications as to server applications.

Development and Maintenance
Over the entire life of a project, the Java environment enhances ease of development and maintenance. When the target system is based on a virtual machine, code is easier to instrument, debug, analyze, hotreplace, and maintain. Network-enabled connected devices can be far more complex than previous kinds of embedded systems. Manual techniques for upgrading may no longer be effective over the project life cycle. Instead, the connectivity of devices provides the ability to manage components remotely, allowing development teams to add product features, resolve problems, and maintain and upgrade the software in the device after the product ships.

Java is a network-centric technology, designed and developed to support the notion that "the network is the system." Therefore it readily supports multiple network topology models, facilitates interoperability through its API standardization, and enables the delivery of features and services locally or via remote network services.

Java technology makes true cross development possible. Program function is developed on workstations, unit tested, and prepared for integration. Thus, even without access to prototype hardware, developers can proceed with function development. After prototype hardware is available, developers can share it through network attachments, creating a virtual lab accessible to team members within a company or among partner companies.

The Java program execution environment also reduces issues relating to memory management, allowing automated "garbage collection" techniques to be used to clean up after released memory segments.

Java Development Tools
Many developers and engineers have discovered that a critical advantage is gained when a complete toolkit is available to embedded Java application developers. Many of these developers have come to embedded projects from past experiences deploying enterprise-class projects, and will focus on the logical extension of existing online services directly to pervasive connected embedded devices. These developers expect to find efficient development tools. They regularly use integrated development environments, sophisticated debuggers, ahead-of-time Java language compilation techniques, and program analysis profile tools. Most also have experience with integrated version control and release management facilities. There are many popular examples of Java development environments available today, including JBuilder from Borland and Forte from Sun. A completely integrated, cross-development environment, designed to support the developer working on the host and the target, is often the critical factor in helping a project stay on time. VisualAge Micro Edition from IBM/OTI is the leading example today.

Many developers working to create embedded Java applications using an embedded Linux operating system will also want to use Linux as their development workstation. This helps create a uniform and efficient development experience and avoids the necessity of switching between Linux and Windows workstation conventions for commands and user interface interaction. IBM has provided the VisualAge Micro Edition IDE and tools for use on Red Hat Linux–based developer workstations. This supports a complete cross-development embedded experience for engineers and developers.

It's often an advantage to develop applications on a personal computer workstation and then deploy them remotely to connected devices in a shared laboratory. The VisualAge Micro Edition tools provide this through remote debugger and program analysis tools and the use of shared file techniques between the developer workstation and the target platform. NFS- or LANbased sharing techniques permit a Java program object to be immediately loaded on a remote device.

With the hot-code replacement facilities of the virtual machine, program changes can be immediately and seamlessly activated from the debugger interface on the developer workstation. This tight integration leads to a new level of efficiency for embedded developers. Since Java technology is based upon virtual machine technology, hot-code replacement is available to connected embedded devices. This offers a new degree of flexibility and convenience to the designers of embedded projects. In particular, it's possible to design future enhancements and feature activation based upon these techniques using OSGi Bundle Management.

Code Reuse
Due to the specialized requirements of embedded systems and the corresponding use of varied, specialized hardware, embedded software developers have traditionally used quite rudimentary methods of development, sometimes starting from scratch on each new project. Now, as embedded techniques mature and the systems themselves become larger and more sophisticated, there is increased interest in reusing components or full applications from product to product. This reuse makes it possible to invest in development once and extend the payback across multiple projects.

The Java environment lets the owner of a component adapt it to many projects and platforms, often at lower cost, even when customers require different targets or when technology has introduced new hardware (CPUs, devices) and software, including variants of Linux.

Efficient Application Execution
Thanks to the establishment of standard Java class library configurations it's more than possible to manage application size. In fact, studies have shown that applications that occupy over 500KB can actually be more compact when deployed as Java byte codes. This is because byte codes are more compact than many hardware machine instruction sets. The ability to reuse well-known routines in the class libraries, combined with the smaller bytecode instructions, more than makes up for the memory footprint of the virtual machine and libraries.

With just-in-time compilation techniques and adequate program cache memory, program execution can approach native machine language execution speeds. What's really important is that an application runs fast enough. For many applications (including deeply embedded devices that act as servers monitoring product sensors or controls, and devices that expose user interfaces) high-speed execution is not an issue. Users often navigate graphic interfaces with speed much slower than that delivered by interpreted Java code on today's embedded processors.

Developer Focus and Skills
Perhaps the greatest advantage of using Java for embedded applications is the large developer community. Java has been a standard part of most computer science curriculums for the past five years, and has become globally accepted as the next-generation language and environment for network-centric applications. It is familiar, easy to use, and blessed with a wide variety of developer tools and a strong developer community rivaled only by the Linux developer community that has grown up during the same time frame. These combined attributes have made it the most popular multiplatform development tool for the new generation of applications being designed and built today.

Many developers are now being educated on Java application development. IBM has, for example, several thousand programmers who create Java applications. With this popular language and deployment environment uniformly available in major educational institutions, the number of Java developers is growing.

The next generation of embedded project developers will need to deal effectively with the complexity and power of connected network attached devices. Java technology implements access to TCP/IP communication component stacks – much of the work to enable communications support has been completed, and done in a wellunderstood and standard manner.

Developers can take advantage of standard tools and a wide variety of underlying code to build network-centric services on top of a well-established network infrastructure.

Java for Embedded Use
Most of what we have covered so far applies to Java in general. Now let's take a look at what has been happening to make Java better for embedded use. Java was initially introduced as the language panacea for small devices of all types. The Java 1 specifications evolved to cover several different configurations known as editions. The standard edition and the enterprise edition have continued to evolve in a straight line from Java 1 to Java 2. The original Personal edition became known as Personal Java, and, while usable, it was too slow and too big to be applied to platforms with more constraints. The J2ME specifications were created to address this issue and others generated by the rapidly changing world of embedded devices. Indeed, it is the very demands that the world of embedded makes on Java that have resulted in the popularity and growth of J2ME. Figure 2 shows a high-level view of the Java 2 configurations as they are today.


The Java 2 Platform editions specify the standard APIs, Java classes, and services that are mandatory and optional for each environment. J2SE and J2EE are designed for distributed client/server environments. J2ME is designed to be flexible enough to work in a variety of embedded device environments.

The J2ME specification has emerged from the Java Community Process (JCP) as a set of specifications that are related but not totally overlapping. It addresses two fundamental device types: (1) the small battery–operated portable consumer device with the Connected Limited Device Configuration (CLDC); and (2) the small network-attached device with the Connected Device Configuration (CDC). Each of these configurations is the minimum needed to build a Java application, but both are further defined with profile specifications. The Mobile Information Device Profile (MIDP) defines the minimum necessary to build Java applications for small mobile devices such as pagers, cell phones, and PDAs. The Foundation Profile defines the minimum needed to build devices such as digital set top boxes, home gateways, automotive telematics devices, and others. The Personal Profile (actually there are two, Personal Basis and Personal) further defines the CDC/Foundation stack to get back to a Java 2 specification of the old PersonalJava. This helps to ensure support for legacy implementations that still have a potentially long life.

Software Devices
The trend in embedded applications is to rely on instrumentation for measurement and control, and to rely on software for integration and flexibility. This means that software is filling a role formerly addressed with intelligent instrumentation. Using software to integrate a diverse set of devices allows for more flexibility in how the measurement data is used to control the overall system. Examples range from traditional industrial automation such as the control systems used on off-shore oil rigs to automotive telematics systems used to integrate automotive systems management, to aeronautics and space exploration systems used to integrate a diverse set of measurement and control devices into embedded supersystems. The complexity of these systems grows exponentially with the size of the overall system. The only way to manage this is through the use of strong object-oriented principles applied throughout the system. This also demands that software be able to perform the tasks of devices as well as or better than the device could.

Real-Time Special Needs
Real-time system needs are a relatively small slice of the overall code, but unless the overall system can support those realtime needs, device monitoring and control will not be good enough to meet today's embedded applications requirements. This is particularly true as the number of devices making up the overall system increases. Device control in any one instance requires rapid response by a small number of elements to monitored device events. Add 10, 100, or 1000 instances of devices being monitored and you can begin to appreciate the real-time demands placed on the overall system. Key components used in Java that address these needs are deterministic preemptable garbage collection and memory management, mapping Java threads onto native threads, and Java/native OS integration through the Java Native Interface (JNI).

Standardized Application Support
As the demands placed on the software grow, Java has responded with specialized support for specific applications and devices. For security there is Java Authentication and Authorization Service (JAAS), Java Cryptography Extension (JCE), and Java Secure Socket Extension (JSSE). For digital multimedia applications there is Java Media Framework (JMF), Java 3D, Java Advanced Imaging (JAI), and the Java TV API. In addition, several industry organizations are building Java into their standards, including digital multimedia standards using DVB-MHP, DTVIA and Open Cable, home gateways and networking with OSGi and HAVi, and smart handheld devices and screen phones using the ETSI GSM, ECTF, and ISRF standards.

Java Code and Native Code Integration
The use of native code has significant implications in terms of portability of applications and the ability to reuse code. A wellengineered interface between the Java application, virtual machine, and underlying hardware brings the best of all worlds to embedded compatibility. Native code, while not portable, may be the best solution for many functions and device interfaces. Adding standard communication, postdevelopment component management, new user interfaces, and security features would be quite expensive and time-consuming in C, C++, or assembler. The Java base libraries provide these things and more, which can speed development (see Figure 3).


The Synergy of Java Technology and Linux
Embedded devices pose several restrictions and constraints on an operating system, device drivers, and other foundation components. It's important to work with a version of Linux that has been specifically implemented with embedded target platforms in mind. Not just any Linux will do.

Special attention must be paid to the management of scarce embedded device resources like RAM, ROM, and Flash. Where processor features are lacking (for example, floating point math accelerators), it's necessary to provide efficient and seamless implementations that run on the hardware that is available.

Since embedded Linux must adapt to the unique resources available on a target device, it's important to be able to quickly and efficiently rebuild and restructure the Linux operating system image. This allows developer/engineers to add, remove, and reconfigure Linux features that will be needed by the virtual machine and Java applications. In embedded deployment, every aspect of the device and application must be considered in the tradeoff between size, speed, and resource constraint. Embedded platforms are nothing like the standardized personal computer or server targets for which enterprise and workstation variants of Linux are designed. In par- ticular, special attention must be paid to enabling access to devices on embedded targets. Uniform access to communications ports, flash memory arrays, display devices, and sound interfaces must be enabled. Thanks to the broad experience embedded RTOS developers have had with Linux deployment, several embedded-oriented standards have evolved for use on these devices.

These standards encompass the following:

  • Low overhead display device management: The combination of an embedded Linux OS and Java technology has delivered a new level of efficiency for constructing graphic user interfaces that can be rendered on touch-screen equipped LCD display devices. Low cost, compact, and often in color, these display devices are attractive to both consumers and product designers. Many pervasive designs will deliver user interface convergence on convenient handheld or set-top-box devices, allowing control and visibility to a large array of headless connected embedded platforms, deeply embedded in appliances, vehicles, and communications devices. Graphic user interfaces tend to be deployed on embedded platforms on either bitmap-based coarse icon-based forms or window control oriented frameworks. Unlike server or workstation- based Linux, which often implements the server/client-oriented "X Windows" user interface framework and one of several alternate window managers, embedded Linux offers an efficient and direct approach. Some embedded Linux environments incorporate the open source package "MicroWindows," ported to run on many supported processor/device platforms. This package runs directly on top of the Linux frame buffer, providing a low-level hardware interface that is very close to the device hardware. It's designed for high performance on embedded processors and can be used to create very responsive interfaces.
  • Communications interfaces: Almost every development platform and embedded computer includes communication interfaces. It's a basic part of the task of Linux porting to make drivers available for RS-232 serial communications and Ethernet if the devices are present on the board. Communications is either based upon the TCPIP communications stack provided in Linux or on raw manipulation of simple serial or bus interfaces. The TCPIP stack provides access to the Internet and socket interfaces for implementing session-oriented program-to-program communications. Specialized communications buses and devices that directly attach to the serial device can be manipulated directly through classes provided as extensions to the Java class libraries. This could include devices that interface with automotive buses like "CAN", "MOST", or IEEE J-1850.

    During development, some devices may be accessed directly through serial connections. Examples include cell phones, car radios, and GPS units. These devices are controlled through specialized protocols that are transported over the serial link. In production, these devices may actually be attached to an automotive communications bus. For this reason, a layered architecture is needed for device control.

    Port combinations using Java technology and an embedded Linux OS are now available on a large number of embedded targets. The developer/engineer can configure and scale the virtual machine and Java class library components as well as the embedded Linux RTOS according to the needs of the project. Device drivers can be included as needed, while still retaining a uniform approach to application development and deployment for many related devices. This method allows improved program code reuse on a large range of devices from deeply embedded headless servers through user interface rendering platforms. From the smallest to the largest embedded device, the combination of a Linux OS and Java technology is very scalable.

    Vendor Support
    Much of the cost of a project occurs after development is complete and the product is deployed. This support expense can relate to the product consumer in many ways.

    The developer's relationship with the supporting Linux and Java technology vendor is key when considering embedded Java code. It's typical for the Java development engineers to have worked with the Linux vendor when doing initial ports of the virtual machine and Java class libraries to the embedded Linux target platforms. The ongoing relationship between Linux and Java vendors is an important consideration. It's also important, especially in the open source environment of Linux, to be able to access the source for Java class libraries in the various configurations being considered for a project.

    Experience running Linux on servers has led to improved robustness in the Linux and related facilities. These enhancements are shared with the providers of embedded Linux technology through the open source community. Today, Linux is proving to be a robust environment with a track record that is improving with time and use.

    Current embedded Linux development is focused on providing more configurable and smaller size operating system components that improve the speed of device initialization and resource utilization. Improvements in development tools for Linux have included specific attention to working in the resource-constrained environment of embedded devices. With the availability of technology like the Eclipse Platform and product offerings from the industry's leading tools vendors, embedded application developers are fully supported with rich cross-development tools that target applications for server through embedded Linux application deployment.

    When matched with the power and flexibility of the latest Java environment standards addressing the embedded space, project managers and developers have a combination available that enables them to successfully design and develop the next generation of embedded systems applications, delivering high reliability and availability in the shortest possible time. This combination of embedded Linux and Java technologies offers engineers and developers greater flexibility for project development and deployment. The options available for embedded application projects based on Linux have been significantly expanded thanks to the power and flexibility of Java.

  • More Stories By Michael Mathews

    Mike Mathews delivers advanced graphics and Java development products to MontaVista Linux customers who rely on these technologies to enable their embedded applications. Mike is able to leverage more than 30 years of middleware experience in systems and embedded applications. His focus is on those middleware technologies on which the new generation of consumer devices will depend. Prior to joining MontaVista Software, Mike worked for Hewlett-Packard in a variety of marketing, sales, and technical roles, spanning a career of 34 years.

    Comments (3)

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.