Technical Overview of EmbeddedJava Technology
Abstract
Sun's EmbeddedJavaTM technology delivers a powerful means to standardize software development for embedded devices. By integrating a compact EmbeddedJava application environment directly into new devices, manufacturers can significantly decrease development costs and get their devices to market faster. Sun's innovative EmbeddedJava tools condense the robust functionality of a JavaTM application environment into a small memory footprint. In addition, Sun's EmbeddedJava technology provides device manufacturers with a rich software development environment, access to a wealth of standard development tools, and the economies of staffing from a large pool of development talent.
This article discusses the advantages of EmbeddedJava technology, including:
-
Why is the JavaTM programming language and EmbeddedJava technology a "win" in the embedded market?
-
What is the EmbeddedJava application environment relative to the Java platform?
-
How does the EmbeddedJava technology fit into devices with limited memory?
-
How do you configure and optimize an EmbeddedJava application environment using Sun's tools?
Java Technology in the Embedded Market
Today the market for embedded devices spans a wide variety of consumer and business products, including devices such as mobile phones, pagers, PDAs, set-top boxes, process controllers, office printers, and network routers and switches. Typically, embedded devices have dedicated functionality -- they are designed strictly for a specific set of tasks. Engineered for long life and high reliability, embedded devices incorporate low-speed microprocessors and may have a limited amount of memory.
To meet performance and size requirements, embedded device manufacturers will typically use a real-time operating system (RTOS) and custom, proprietary development tools, well-suited for meeting devices' memory limitations. There are numerous different RTOS vendors that exist today, each with a proprietary operating environment and many with tightly integrated and specialized development tools.
Early environments for embedded devices were developed in assembler. As these devices matured, some manufacturers shifted to higher-level languages like C and C++. Although using higher-level languages made it easier to find developers and staff new projects, the complexity of these languages continued to contribute to long schedules and high non-recurring engineering (NRE) costs. In addition, customers were constantly demanding new functionality in devices. As manufacturers responded by adding capabilities, more memory and software complexity was required. This raised manufacturing costs as well as increased NRE costs. Thus, embedded device manufacturers faced the constant challenge of managing increasing development costs.
To aggravate the problem, there were a greater number of target operating systems and processors, sometimes even within the same product families. Occasionally there were also new product categories and innovations, such as set-top boxes. Manufacturers faced intense competitive pressures, and were often required to put out more product in a shorter timeframe. As a result, manufacturers sought a more open, standards-based development environment -- one that would lower costs and speed development.
Embedded device manufacturers have turned to the Java programming language to answer their needs. Its many advantages -- especially its simplicity, portability, security model, and object-oriented nature -- make it an ideal choice for these reasons:
-
Portability. By using an underlying Java run-time environment, applications can be easily developed on a desktop system using standard software development tools. Hardware-specific code can be simulated on a desktop system, saving valuable development time. By taking into account the underlying target hardware characteristics, developers can then move applications with minimal effort to the specific target device.
-
Software reuse. Because the Java language is object-oriented and platform-independent, developers can migrate commonly used software modules -- or entire applications -- between products and across product lines.
-
Simplicity. The Java language is easy to learn and use, which shortens development cycles and lowers costs. Unlike C++, the Java language features automatic memory management and a single inheritance model. Most importantly, the lack of pointers eliminates a common source of memory leaks.
-
Safety and security. The Java language provides a secure, isolated environment -- a "sandbox" -- in which applications can execute safely. This was one of the key reasons why Tektronix, Inc. decided to include an EmbeddedJava application environment in their TDS oscilloscope products.
-
Availability of developers. Today there is a huge talent pool of developers experienced with the Java programming language. The ready availability of developer talent helps keep development costs under control, enabling new projects to be staffed quickly. Training existing developers in the Java language can also help manufacturers retain valuable talent.
-
Longevity. Since the Java APIs have been developed with the involvement of many companies within the industry, the Java platform has gained a level of maturity that promises a long lifespan. This will simplify support and maintenance issues for device manufacturers concerned with long product life cycles.
EmbeddedJava Technology Relative to the Java Platform
Designed to meet a wide spectrum of distributed, networked, and graphical application requirements, the Java platform provides a full set of classes that encompasses a broad range of functionality. These classes constitute a "core" Java platform for enterprise computing. The Java Community Process defines an all-inclusive method for the industry to expand the Java platform with added functionality by defining extension APIs, such as Java Media Framework or Java 3DTM APIs. This process offers developers a standardized way of implementing needed capabilities beyond what the core APIs provide.
To meet the requirements of consumer devices (such as set-top boxes, smart phones, and hand-held devices like PDAs), the PersonalJavaTM platform reimplements the full set of Java APIs defined by the Java application environment in order to fit into smaller devices with more limited memory configurations. The PersonalJava platform also offers a graphics toolkit, the TruffleTM toolkit, created specifically for hand-held devices that all require general-purpose web-browsing.
The EmbeddedJava Application Environment
Unlike the Java and PersonalJava platforms (which have required core APIs), the EmbeddedJava application environment allows for APIs to be configured relative to the requirements of an application. This allows EmbeddedJava technology to fit into the very limited memory footprints of embedded devices, including industrial controllers, process controllers, or scientific instruments.
The EmbeddedJava specification allows any fields and methods from the core JDKTM 1.1.7 APIs (except java.applet) to be used in development. This allows developers to capitalize on the robust fullness of the Java APIs, but provides the flexibility to scale down and use only what is truly necessary. Sun provides optimizing tools to create the environment and convert the code into a condensed representation. Since applications are written in the Java language, software modules or entire applications can be migrated later to new platforms and easily reused, regardless of the underlying RTOS and target processor.
Developing with Sun's EmbeddedJava Technology -- The Process
Sun's advanced tools streamline the process of creating a compact EmbeddedJava application environment. The toolset has three primary components:
-
JavaFilterTM. This tool builds a list of the specific fields and methods used by the Java platform to run the Java application.
-
JavaCodeCompactTM. Using the list provided from the JavaFilter tool, the JavaCodeCompact tool selects the fields and methods used by the application from the full set of Java classes. It then optimizes the code by removing unused parts of the platform, and produces a representation of the set of data structures.
-
JavaDataCompactTM. This tool provides a means of linking in auxiliary data files such as HTML, image, and sound files.
To develop an EmbeddedJava application environment, the first step is to develop an application using any classes from the EmbeddedJava APIs. Next, the application and program classes are fed into the JavaFilter tool. The JavaFilter tool looks at the program elements required for the application and the operation of the JVM, and analyzes static interdependencies. JavaFilter produces a list of the required classes, fields, and methods, which is then fed into JavaCodeCompact.
The JavaCodeCompact tool performs extensive optimizations to reduce the amount of RAM and ROM required by the application environment. This tool functions as a class preloader, creating the necessary internal data structures in advance, saving space by eliminating redundancies and resolving symbolic references. The JavaCodeCompact tool significantly reduces both the static memory and run-time memory requirements, producing a tightly compacted application environment in a platform-independent representation. (A technical note further describes how Sun's tuning of the JavaCodeCompact tool, which also ships with the PersonalJava platform, significantly reduces memory requirements.)
If there are any associated data files (such as image or sound files), developers can then use the JavaDataCompact tool to convert them into the appropriate format. The JavaCodeCompact and JavaDataCompact tools produce data structure representations in C code, which allows these tools to represent run-time data structures in a platform-independent manner.
Finally, the data structure representations produced by the tools are compiled, along with any other native method code, using the native C compiler for the particular operating system and target device. The resulting object files are linked together to produce a small, compact EmbeddedJava executable image, which can then be placed into the device`s ROM (or placed on disk and later executed from the device's RAM).
This process -- and the efficiency of the EmbeddedJava tools -- enables device manufacturers to configure and build highly optimized Java application environments for devices with small memory footprints.
The Future
EmbeddedJava technology will continue to evolve as it is integrated with other technologies such as the JiniTM connection technology. In addition, the industry will define standard extensions to the Java APIs as need dictates, including an extension API that will support real-time capability. A real-time extension API will allow future real-time applications to be written entirely in the Java programming language.
Summary
Many companies have experienced shorter software development schedules and lower costs after switching to the Java programming language. For embedded device manufacturers, the Java language offers a standardized development environment, allowing a wider choice of development tools and platforms. Manufacturers can also migrate code across product families -- even with different RTOS environments and target processors -- by using an EmbeddedJava application environment. Sun's advanced EmbeddedJava tools allow developers to create a tight, highly optimized application environment, while realizing the many other benefits of using the Java programming language for development.
|