|
Developers will no longer sweat the small stuff as the Squawk virtual machine brings Java technology to micro-embedded applications
The market opportunity for ever-shrinking and more-powerful devices is growing, largely because the definition of a computer platform has evolved since Java technology was introduced in 1995. The vast majority of computing devices are not desktops, laptops, servers, and mainframes, but small, resource-constrained gizmos and gadgets you use every day.
These micro-embedded devices include medical appliances, MP3 players, smart cards, automobile braking systems, RFID tags, and other products. They perform specific functions and can be a part of a pervasive network — sometimes called the Internet of Things — that keeps us connected, communicating, and sharing data.
And as the boundaries between traditional devices and media evaporate, the micro-embedded world may well be the next frontier for developers.
Microdevices are equipped with processing power, memory, and storage and usually run on battery power. However, developing for these devices requires different tools, languages, libraries, and APIs, which makes innovation more difficult and can delay time to market. This makes Java technology — with its standard language, APIs, and tools — an attractive development tool for micro-embedded devices.
| |
Squawk Development Resources
The Squawk project site provides tools for porting Java to micro-embedded devices. Get access to the engineering team, informa-tional forums, a wiki for community documentation, bug tracking, development alerts, and more.
» Go now
|
To maximize Java technology's attractiveness for microdevice developers, someone has to do the work of enabling or porting Java technology on their device or target of choice. For many developers, the complexity of porting, debugging, and maintaining virtual machines (VMs) has been a huge obstacle toward innovation and growth in the embedded device market.
Project Squawk Extends Java Technology's Reach
Thanks to a team of researchers at Sun Labs led by Eric Arseneau and Derek White, developers have a virtual machine for the Java language optimized for small devices. Called the Squawk VM, the new virtual machine extends Java technology's reach into even more devices — beyond the cell phones and MP3 players of today and into the electric shavers and toasters of tomorrow.
The Squawk VM is certified on the Java Micro Edition Information Module Profile (CLDC 1.1 IMP 1.0). The Squawk VM provides developers with the benefits of the standardized Java language and its widely understood tools, libraries, and APIs. Using Squawk and Java tools eliminates many of the difficulties of traditional embedded development. With Squawk, developers can create applications using the simplicity of Java, as well as deliver a custom binary package tailored to the capabilities of the target micro-embedded platform and required application services, all with a very modest learning curve.
Simplicity and Scalability Lead to Unlimited Innovation
"This technology brings the inherent advantages of Java — particularly innovation and scalability — to embedded development," Arseneau says. "Right now, developers in the embedded space are living with the limitations of proprietary tools that are difficult to learn and use. We want to extend the simplicity, efficiency, and familiarity of Java to embedded development so programmers can leverage the Java tools and knowledge they already have."
Originally inspired by the Squeak project, a VM written in Smalltalk, the Squawk VM is written almost entirely in Java technology itself. This provided an interesting platform from which to do Java VM-based research. But as time went on, the Sun researchers realized that using Java to implement Java provided non-VM developers with a simpler mechanism to understand how to port Java to new platforms.
Because micro-embedded devices have different attributes than traditional computer hardware, Squawk differs from traditional Java virtual machines in a few ways. One of the most important differences is the way Squawk can be used to compile and optimize core VM components, other Java components, and bytecodes ahead of time (AOT). In addition, Squawk does just-in-time (JIT) compilation of bytecodes.
The Squawk VM is designed so that developers can run multiple applications on one virtual machine, and even migrate a running application to another device.
"Squawk is a VM that gives you Java compliance with a small footprint, and allows applications to run directly on the CPU without an underlying operating system," Arseneau explains. Since small devices don't need additional resources to support a general-purpose operating system, developers are free to experiment with different implementations of low-level services, such as networking protocols, which are typically buried inside an operating system. This results in less overhead and improved application performance.
Squawk Finds Room to Move in Small Devices
The Squawk VM has been designed so that developers can run multiple applications on one virtual machine, and even migrate a running application to another device. As a result, the application can continue running on the new device right where it left off. By running multiple applications on one virtual machine and employing a more compact representation of class files, the Squawk VM makes better use of the constrained resources of small devices.
One interesting example of this ability to migrate running applications is that if a device finds itself running on low on battery power, it can see if there is another device nearby that has more energy and can transfer its running program before the battery actually dies.
These capabilities were demonstrated in one of the first commercial implementations of the Squawk VM on Sun SPOT (Small Programmable Object Technology) wireless transducer devices from Sun Labs. The Sun SPOT hardware platform is a small, battery-operated, wireless device that needs a programming language and tools. The Squawk VM was able to provide both the operating system and the software application platform.
Emulators Increase Developer Productivity
The Squawk VM's ability to run on all popular desktop platforms supplies a mechanism for providing developers with an emulator. To help developers be even more productive, Squawk includes emulation support. The ability to run Squawk on the desktop enables developers to quickly create device emulators to test applications before deployment.
For example, Arseneau points to the researchers' work with Sun SPOT hardware. "With a virtual SPOT on the desktop, we can move things around and flick switches without having access to any hardware," he says. "This flexibility helps developers reduce time to market and enables us to create a much richer developer experience."
Because micro-embedded devices do not typically have enough memory to implement on-device class file loading, Squawk implements a split VM architecture, where class loading is performed on the desktop and execution performed on-device as shown below:
The split VM approach helps reduce the amount of resources required to run Java on a device by having as much work as possible done ahead of time and only once by the developer's desktop machine, rather than every time the device is turned on or started. Java technology has a stringent security model that must be preserved, but can require significant resources. There is also the added benefit of allowing developers to perform operations on the desktop.
The split VM architecture means that one-time-only code can run on the desktop, so that when the binary bundle is sent to the device, objects are precomputed. This helps ensure that the device works as efficiently as possible with the resources available. Improving efficiency here, says Arseneau, also helps developers design smaller and more powerful gizmos.
Squawk to Shrink in Size and Grow in Power
Arseneau and his team are also working on further enhancements to Squawk to enable it to run on smaller and smaller devices, allowing developers to use Java technology on even more devices. Currently, Squawk needs 512K of flash memory, but as work continues, Arseneau's goal is to be able to run Squawk with just 16K of flash.
"We're also adding more real-time capabilities," Arseneau says. "This means that devices will be able to respond to real-time inputs more precisely and allow for more timing of critical applications, such as driving servos. For devices such as antilock braking systems in cars, this kind of functionality is critical."
In another example, Squawk is being ported to LEGO MINDSTORM NXT, an educational platform that allows children to design and build robots and program them to perform various operations. Squawk project members are working a team from LEGO MINDSTORMS NXT, which was the result of a partnership between Lego and the MIT Media Laboratory. Ultimately, the project will help simplify and increase LEGO programming capabilities and free up the imagination of kids of all ages.
As part of Sun's commitment to supporting the proliferation of Java technology on micro-embedded devices, developers can access the entire source code of the Squawk VM, and can use Java, CLDC, and IMP standards to quickly build a Java VM. By open sourcing Squawk, Arseneau hopes to give developers the opportunity to port Squawk and Java to many diverse platforms (see sidebar).
"Open sourcing Squawk will further our strategy of expanding the Java universe to encompass as many different types of micro-embedded devices as possible."
Eric Arseneau, Sun Labs
Open Sourcing Opens Doors for Big Opportunities
When Sun open-sourced Java Micro Edition last year, it allowed projects like Squawk to leverage code already proven to work with other devices. As a result, Squawk achieved Java compliance quickly — no small matter, given the approximately 11,000 tests Sun requires to be certified as a Java programming language.
"Open sourcing Squawk will further our strategy of expanding the Java universe to encompass as many different types of micro-embedded devices as possible," Arseneau explains. "Developers working on prototypes and devices that will only be manufactured in small amounts can use Squawk for applications they might not have otherwise considered. Java provides the backbone for incredible innovation and is the next big opportunity for developers."
Not only does the ubiquity of Java technology open doors for innovative applications, the availability of the Squawk VM makes it easier for developers to explore and research new possibilities, thereby helping reduce time to market for new products. Already, Java technology is deployed in more than 1 billion cell phones.
However, Arseneau sees mobility as simply the tip of the small-device iceberg. "As with cell phones, there is an implied limit of one per person," he says. "If we start including all of the gadgets that people use every day, then the potential becomes enormous, without limitations."
Arseneau estimates that in the next few years there will be billions and billions of new devices developed and delivered in the embedded arena. "We're already talking to people who are doing some pretty incredible things — things like putting sensors into eyeglasses to detect and remove dirt, or putting a device into a motorcycle helmet that will call 911 in the event of an accident," he says. "We feel that Java technology should advance micro-embedded applications in the same way it has fostered the growth of general-purpose computing."
|