Saturday, 03 November, 2001

Programming the Palm

I spent the day trying (and mostly failing) to get a little "Hello, world" application to run on my new Palm Powered Phone.  (I was going to call it P3, but people would probably confuse that with a Pentium III.)  I downloaded the Palm OS Emulator (POSE), and used the ROM Transfer application to transfer the ROM image from my phone to the PC.  Loaded the ROM image into POSE, and POSE reports an error.  Kyocera apparently didn't want to make their ROM compatible with POSE.  Sigh.  Now I'm waiting for Palm to approve my developer application so that I can download a ROM from them.  I won't be able to emulate applications that use the Kyocera phone APIs, but at least I'll be able to emulate standard Palm applications--which is all I'm after for the moment.

What little I've seen of the Palm API looks reasonable.  Writing a Palm application in C looks very similar to writing a Windows application.  The OS calls your PilotMain function, initializes everything, and sets up a message loop that continues until it gets the appStopEvent.  That's about as far as I've gotten.  The sample application that I built from this page (Palm OS Programming, 2nd Edition) resulted in a crash that forced me to reset my phone.  I suspect I'll be doing that a lot.

For the moment, I'm using Version 7.0 of Metrowerks CodeWarrior for Palm OS to do development.  I've always heard good things about CodeWarrior, but until today had never tried it.  I guess it's possible that the compiler is technically superior to Borland's or Microsoft's, but the IDE does not compare favorably with either.  Borland's IDEs have always been helpful and intuitive, and Microsoft's a little less so to the extent of being downright aggravating at times.  But the CodeWarrior IDE is almost unusable.  Some things that should have right-click menus don't, project defaults result in projects that won't build, and the overall interface feels hacked rather than designed.  To make matters worse, the online help (presented in Microsoft's abominable HTML Help format with "Help on Top" as a permanent default), is awful.  All of the examples show either a Mac OS or Windows project--not a Palm project to be seen.  Arrrgh!

Yes, some of the above is undoubtedly my frustration with a new programming environment and unfamiliar tools.  I'm having fun.  Let me rant!

I have also downloaded and installed the demo of a product called NS Basic, which is a Basic language development system for the Palm platform.  I've not yet actually done anything with it though, and hesitate to invest much time in what is essentially a p-code interpreter for the Palm.  You install the runtime interpreter (size: 88 K bytes) on your Palm, and then you can run any NS Basic application.  Having lived through the problems caused by multiple incompatible versions of the Visual Basic and Visual C++ runtimes, I'm in no big hurry to make my applications dependent on a third party runtime interpreter.  There is an option to include the runtime system (called "Fat Applications") in your applications so that you don't have to install the NS Basic interpreter, but that's too much overhead on a memory-limited device like the Palm.  But then, I'm a C programmer.  If I was coming to the Palm with no C programming experience, I'd likely go the NS Basic route.  There are also versions for Windows CE and the Newton, giving the real possibility of writing a cross-platform handheld application.  I'll probably take a look, but likely won't do any serious development with it.