Program your Palm in Java: The PalmOS Emulator

The basics of the Palm platform and the PalmOS Emulator

Palm connected organizers have proven successful beyond the dreams of even their most devoted followers. In a few short years, Palm Computing and licensees such as IBM, Symbol Technologies, QUALCOMM, and Handspring have gone through several generations of devices and built a loyal following of users and programmers alike.

With the thousands of programmers and millions of deployed devices have come tools and emulators of all sorts. The richness of the development-tool ecosystem for the PalmOS makes the devices prime candidates for introducing Java-device programming capabilities. That is why Sun has chosen PalmOS as the reference platform for the K Virtual Machine, and why I choose to launch the technical discussion of Java Device Programming with a strong focus on Palm tools and the use of Java with PalmOS.

KVM's development cycles and the extreme velocity on the J2ME fronts being what they are, I've let far too much time pass since the last installment of Java Device Programming: I pledge not to let that happen again. Luckily, Chuck McManis, a fellow JavaWorld columnist, has in the interim written a nice article on the JavaOne preview of the KVM for PalmOS, so readers have not had to go completely wanting for Java-device programming information. I will refer to and expound on much of the material in Chuck's article in this series, particularly when I get to a more in-depth discussion of the first public release of the KVM for PalmOS. (For Chuck's KVM article, see "The K virtual machine and the Palm V, Part 1.")

Since my own last column I have been working frantically to put together several device-programming resources that I hope will be useful for Java programmers. These resources include a Java-device programming FAQ and mailing list, as well as the KVM Archive, a list of public domain applications, tools, and related information on J2ME and KVM development.

I shall make liberal use of these resources in the Palm-programming series and will refer to many of them this month and again in the coming months, so please bookmark the URLs.

Let's get started!

Major Java-device APIs and initiatives, take 2

A lot has transpired on the Java 2 Platform, Micro Edition (J2ME) front even in the few short months since JavaOne 1999. Therefore, before we dive deep into the Palm platform and Java, I would like to update my July column -- "Program Java devices -- An overview."

Profiles and configurations

What I wrote then about J2ME profiles is still correct. These API groupings sit on top of underlying Java runtimes and provide a certain level of portability and interoperability within classes of devices targeted at specific markets or vertical industries.

In addition, however, Sun and the J2ME development community have also seen fit to carefully specify the underlying core technologies for families of Java-enabled devices in profiles known as configurations. Configurations are meant to specify the memory and CPU requirements for target devices as well as for one or more virtual machines (such as the KVM, PersonalJava VM, Classic VM, and so on) and for core J2ME APIs that may be used to implement the base J2ME functionality on these devices.

Developers are proposing that configurations become a part of the Java Community Process (JCP). As of early October 1999, two J2ME configurations were under consideration:

  • The J2ME Connected Device Configuration, for applications requiring moderate amounts of memory and a midrange CPU, such as those for digital TV set-top boxes, Internet screenphones, and automotive entertainment and navigation systems.
  • The J2ME Connected, Limited Device Configuration, for applications used by memory-, CPU-, and bandwidth-constrained networked devices such as mobile phones, pagers, mobile point-of-sale (POS) terminals, and PDAs.

The JCP site has recently posted the first J2ME application profile: the Mobile Information Device Profile, which Motorola and several other community members are beginning to work on. This profile will center on mobile phones and wireless application APIs. The APIs will be specified so that they can be implemented on devices built to include support for the J2ME Connected, Limited Device Configuration. (See Resources at the end of this article for more information on J2ME configurations and profiles, as well as a link to the JCP site.)

Always remember that for consumer devices, every hardware and software decision involves resource considerations and compromises. Configurations and profiles are an attempt to engineer reasonable sets of compromises for related families of devices and end user applications.

Keep these Java Specification Requests for configurations and profiles in mind as we discuss Palm devices. Palms are exactly the sorts of devices, along with Net-enabled mobile phones, on which you will begin to see widespread Java application deployment in the months ahead.

Related note: Free briefing on J2ME for Mobile Devices

I am a big believer in free things. I love those T-shirts thrown at you from every direction at development conferences. But cool as T-shirts can be, I think free development tools and inside information are even better! I try to write about technologies that are available under open source or SCSL (Sun Community Source Licensing) or at least for some sort of free trialware period.

In keeping with that philosophy, I would like to share one more resource I have been working on over the last couple of months: A Sun-hosted briefing on the J2ME. This is an all-day event meant to give developers access to Sun engineers working on the APIs and implementations enabling J2ME-based devices and services.

If you can be in the San Francisco Bay Area on November 3, you might want to check out the Sun Headquarter Briefing on the Java 2 Platform, Micro Edition for Mobile Devices. Motorola and Nokia will make technical presentations on their involvement with Java and J2ME-enabled devices. In addition, you can hear Sun's technical presentations on the J2ME, the KVM, configurations and profiles, and related subjects. If you are interested in attending, visit the Sun Headquarter Briefings page for the working agenda and registration information.

Now let's turn our attention to this article's main focus.

The Palm platform

The Palm platform consists of the core PalmOS, a set of applications included with each Palm device, and related hardware and software tools. For this series of articles, I assume that readers are either already familiar with the device, its HotSync cradle, and so on, or willing to browse through the numerous Web sites dedicated to Palm devices to learn the lingo and read up on Palm-related gadgets. (If you need to take the latter approach, a good place to start is the Palm Computing homepage, which is listed in the Resources.)

No discussion of Palm would be complete, however, without a brief rundown of the Palm devices in use and an attempt to alleviate some of the confusion over the names of the various generations of devices. Why has Palm Computing used Pilot, then PalmPilot, and now simply Palm for its devices? What do other manufacturers of PalmOS-based devices use?

The short of it is this: Palm Computing has released several generations of devices. Because of some legal issues, first with the Pilot Pen company and then with Microsoft, Palm Computing has had to carefully position and reposition their naming structure. (For more information, please refer to the "What's in a Name -- Is It a Pilot or a Palm?" in the preface of Palm Programming: The Developer's Guide, available online for free from the URL in Resources.)

In any event, I will refer to all of Palm Computing's devices, as well as those of the various other companies that have licensed and used the PalmOS to build their own devices, as Palm devices. I will refer to the PalmOS and its related tools collectively as the Palm platform.

The generations of Palm Computing's own devices have so far included:

  • Pilot 1000, Pilot 5000

  • PalmPilot Personal, PalmPilot Professional

  • Palm III (in many variations, such as III, IIIe, and so on)

  • Palm V (with a sleeker case than those of previous generations, plus -- finally -- a rechargeable battery and recharger built into docking station)

  • Palm VII (similar in form to the Palm III, but with hardware and software to access Palm.net wireless Web clipping services)

One gotcha to note here is that the release of a new generation of Palm devices does not preclude the continuing sale of previous generations. Palm III, V, and VII series devices are all currently available from Palm Computing. Users pick the model they want based on features and of course cost. In general, each new generation of Palm Computing devices has brought an increase in retail price for the new device along with steadily decreasing prices for previous generations (bless the economics of the computer industry!).

Some other Palm platform-based devices on the market:

  • IBM Workpads

  • Symbol barcode-scanning PDAs

  • QUALCOMM's pdQ smartphone (which includes a built-in Palm connected organizer and some custom applications that link the organizer functionality to the phone; you can tap on phone number to dial a contact, for instance)

  • Handspring's new line of Visor devices, including the Springboard expansion modules

Handspring is the newest entrant in the Palm arena. Cofounded by the creator of the Palm platform, Jeff Hawkins, Handspring announced new PalmOS-based devices, named Visor, in September 1999. I have included some Resources for more information on Handspring's devices and, in particular, the Springboard expansion modules. Springboard promises to offer interesting opportunities for enterprising developers of both hardware and software in the coming months; stay tuned for more.

One of the beauties of the Palm platform is that, like the creators of Java, Palm Computing has expended a lot of effort to ensure the compatibility of new devices: Palm applications that run on one generation of devices should (with few exceptions) run unchanged on later generations. Java-based Palm solutions such as the KVM can therefore run on most Palm devices -- unchanged. The cross-platform portability of Java is reinforced.

Up and running with the PalmOS Emulator

Even though each new generation of devices costs more than the previous one, fear not: you need not lay out a single penny to get started with Palm programming in Java. All the tools you need are available for free from the Web.

The centerpiece tool is a software emulator known as the PalmOS Emulator, or POSE. Mimicking a Palm device, POSE is a Win32 Palm emulator supported by Palm Computing. It is based on an open source emulator called Copilot, developed by Greg Hewgill and others on the Web.

The core of the Copilot emulator, in fact, is still available as open source and is a central piece of many other emulators available on the Web. Though POSE is significantly slower on many machines (including my 266 MHz Pentium II system) than PalmOS running on relatively modest Palm devices, it does give you a lot of flexibility and debugging features useful in building Palm apps. I will use POSE for the articles in this series, but please feel free to use another Palm emulator if you like. URLs for downloading POSE and other emulators are available in Resources below.

POSE is, as far as I know, the only emulator supported by Palm Computing, so your mileage may vary if you use one of the others. I will be using POSE version 2.1 d29 for this series, unless otherwise noted.

When you download and unzip POSE, you will have a directory containing

  • A Docs subdirectory (read through the documentation for more on the original design of Copilot and the use of POSE)

  • Emulator.exe and Emulator_Profile.exe -- the actual emulator executables

  • ROM Transfer.prc -- a Palm application that can download the ROM image from a Palm device for the emulator to use

  • HostControl.h -- a header file that we will not need

I placed POSE in C:\Palm\POSE on my system.

There is one remaining requirement: before we launch POSE and develop and load applications into it, we need a Palm ROM image. For the Palm platform, the ROM image contains the guts of PalmOS. POSE, in fact, actually emulates the Palm device hardware; it runs the PalmOS loaded from the ROM image within itself while handling input and output to the POSE window on your workstation.

Because a Palm ROM image contains the actual PalmOS, Palm Computing does not bundle a ROM with POSE, but rather tracks its usage with a separate download, which requires a more intricate license agreement. Whereas you can click through the POSE license and download the emulator immediately, you have to agree to a more stringent set of stipulations and wait for Palm Computing to process your ROM license request before you receive your ROM image to enable POSE.

Luckily, developers who already own a physical Palm device have a way around this hassle and delay. You can simply download the ROM image from your Palm device and use it in POSE. To do this,

  1. Load Rom Transfer.prc on your Palm device using Palm Computing's Install tool

  2. Execute Emulator.exe

  3. Select the option to download a ROM from the Palm device

  4. Follow the downloading instructions (select the COM port, speed, and so on) and save the ROM on your development system

If using your own ROM is so easy, why wouldn't everyone simply do it? Two reasons:

Related:
1 2 Page 1
Page 1 of 2