From Palm OS to Symbian OS: Making the Switch, Part 1

s PDAs and mobile phones quickly combine into smartphones, Palm OS developers find that their favorite operating system is running behind the most mature smartphone operating system, Symbian OS.

There are other smartphone operating systems. But, Microsoft’s Smartphone is off to a disastrous start with only one shipping phone to its credit and former partners like Sendo dropping it in favor of Symbian OS. The reason for this is simple. Developers have found Smartphone to be more of a work in progress than a stable operating system and development platform.

And Palm OS, while holding on in the PDA field, hasn’t anything like Symbian OS’ smartphone reach with mobile phone OEMs such as Ericsson, Nokia, NTT DoCoMo, Psion, Samsung and Sony already shipping Symbian OS powered devices.

The simple truth is that if youre planning on developing from the operating system on up for smartphones, Symbian OS, descended from Psions EPOC operating system, is the clear leader both in terms of marketability and system maturity.

If you’e a Palm OS developer, making the shift isn’t that easy. Despite the operating systems’ similar GUI/Menu bar interfaces and their ARM processor based, handheld architecture, there’s a big difference between the pair and their development models.

Porting applications from Palm OS to Symbian OS requires more than simply recompiling C++ code. You must understand the differences between such operating system fundamentals such as memory usage and thread handling. Be ready to make a complete shift from Palm OS’ single-thread, event-driven software development model to Symbian OS’ multi-threaded, object approach. The differences between developing for each platform are profound. Learning Symbian OS may take you a considerable amount of time.

Uniquely Symbian
Symbian OS has a few quirks, which you should know about whether you’re switching from Palm OS or any other operating system. A prime example is that Symbian OS uses its own exception-handling mechanism: Leaving. Any function with an “L” at the end of its name can leave. Given limited memory, you can count on a lot of memory exceptions or ‘leaves’ during the development process. Efficient memory management is the key to avoid leaving the program in a memory muddle.

Fortunately, Symbian OS also provides a “Cleanup stack” tool to help with leave exceptions. Use the Cleanup stack to handle these leave memory exceptions with minimal trouble.

What will stand out the most for C and C++ developers though is that descriptors are used for text and binary data, instead of regular C strings. Think of descriptors as a string class with bounds checking. You can’t avoid these though without reinventing a lot of wheels. Symbian’s APIs’ use these descriptors constantly.

Symbian also uses an “active scheduler” for non-preemptive, active objects multitasking. On other operating systems, you’d probably use threads to do the same work. Since active objects are a key Symbian OS construct, you’re better off learning how to use active scheduler rather than playing with Symbian OS threads to achieve the same result with more trouble.

System Fundamentals
There are superficial similarities in developing for each system. For example, they both support C++ and Java as primary development languages.

With both, you must design for a small, mobile device with limited screen space, memory, and input options that users will typically use for intermittent short, frequent bursts of activity. And, as always with handset devices, you must limit power consumption to the lowest possible level.

The table below shows the fundamental similarities and differences between the two operating systems.

Table 1: Palm OS/Symbian OS Artchitecture Shart.

Primary Target Devices

PDAs

Smartphones

Current Versions

Palm OS 5.2

Symbian OS 7

CPU

Older versions targeted Motorola DragonBall family. Newer version targets ARM processors.

ARM processors

User Interface

 

 

User interactive I/O

Pen and keypad

Pen and keypad

User Interface

GUI with check box, radio button, list, scrollbar support.

GUI with check box, radio button, list, scrollbar support.

User Interface Support

PilRC and Constructor UI builder tools.

Layered UI framework. UIQ 2.1 for Symbian OS with theme support.

Languages/Code Support

 

 

Languages

Native: C and C++. JVM support.

Native: C++. JVM PersonalJava and JavaPhone technologies in OS 6 and higher. Java MIDP in OS 7.

Internationalization

Requires resource files.

Native Unicode support.

OS Application Specifications

 

 

Multitasking

Available only for system services, not applications.

Although designed for event-based time sharing on a single thread, it also supports multitasking and multithreading applications. Only one application at a time can have access to the UI.

Maximum Memory

16MB, Moves up to 128MB in 5.2

Hardware driven, theoretically as high as 2GB.

Memory Usage

Applications must share memory with the operating system in main, also called dynamic, RAM. Some RAM, Storage RAM, is set aside for storage. Flash memory and expansion card memory can only be used for storage.

Applications share RAM with operating system but has exclusive access to their allocated memory area. All RAM available for OS and applications. Flash and expansion card memory is used for storage.

Shared Libraries

Yes.

Yes, DLLs, polymorphic DLLs.

Connectivity

 

 

Network/Async

TCP, UDP with socket API, IrDA, serial, Bluetooth.

TCP, UDP, IPv4 & v6 with socket API, IrDA, serial, Bluetooth.

Network Services

HTTP, HTTPS, IPSec, SSL, SMS.

HTTP, HTTPS, IPSec, MMS, SSL, SMS.

Data Synchronization

HotSync, Conduit Development Kit.

Connectivity SDK, SyncML.

User Interface
Both operating systems provide developers with basic GUI components like check boxes, radio buttons, lists, scrollbars, and other components.

One important difference is that in Symbian OS the GUI framework enables developers to create applications to run on screens with different form factors, with minimal code changes.

For now, Palm OS has the more mature UI development tools such as Metrowerks IDE, CodeWarrior. Similar tools from Metrowerks for Symbian OS are being developed for both Java and C++ programmers.

UI for Quartz
Symbian OS’s standard UI framework and interface is UI for Quartz (UIQ) or Thin Quartz. It provides a standard look-and-feel across all UIQ-based devices. Specifically, UIQ is meant for devices with screen sizes of 240×320 pixels (1/4 VGA), or 208×320 pixels.

Palm and Symbian’s UIs look alike with a menu bar and an application space. The UIQ also has a status bar, a button bar and an application picker that is similar to Palm OS’ Home. With both, only one application at a time can be on screen. With Palm OS, only one application can be active at a time. With UIQ multiple applications can run but with only one having screen control at a time.

“The real differences between Symbian OS and Palm OS’ screen management come in how the applications behind the screen are constructed.”

In both platforms, the UI run in an Application Space, the screen space between the Menu bar and the Status bar. In Palm OS, this space is controlled by ‘Forms,’ while in UIQ ‘Views’ are used. For a user, the two look and act the same with similar interface components like checkboxes, scrollbars, and text fields.

Superficially, they also look the same from a programmer’s viewpoint. For example, user interface events are handled by the event command handler, HandleCommandL(). This is similar in concept to Palm OS’ event handlers. The real differences between Symbian OS and Palm OS’ screen management come in how the applications behind the screen are constructed.

Multitasking
Unlike Palm OS, Symbian OS is a multitasking operating system with multi-threading support. Every Symbian OS process can have one or more threads. These are co-coordinated by the system scheduler, which allocates thread processor access by prioritized, pre-emptive multitasking.

In smartphones, multitasking is especially valuable since users will frequently want to do such things such as downloading e-mail while talking or looking at a Web site. As 2.5G and 3G network packet data services become more common, multitasking smartphone applications will become a must.

Symbian OS also enables you to use interprocess and application communications to enable multiple processes and programs to work together. With Palm OS, this is essentially impossible.

Multithreading and Co-operative Multitasking
By default, Symbian OS applications have one thread. Symbian encourages you to use single threaded applications unless you really need multithreading. One reason for this is that writing multithreading applications is more difficult. Another reason is that since Symbian OS supports asynchronous function calls for almost all of its system services, you can often use asynchronous calls and active objects in place of threading with much less programming work and system overhead.

“Since Symbian OS supports asynchronous function calls for almost all of its system services, you can often use asynchronous calls and active objects in place of threading with much less programming work and system overhead.”

Asynchronous calls also allow you to create co-operative multitasking programs. This, in turn, allows you to avoid multithreading with its attendant use of system resources and additional programming complexity.

When an application uses an asynchronous call to perform a function, such as sending data via a socket, the application can then do other work while waiting to poll the other application or device for a signal. This is the key difference between asynchronous calls’ co-operative multitasking and multithreading’s pre-emptive multitasking. In co-operative multitasking, you program the interval to check, or poll, on the result of your call. With multithreading, the call’s result preempts your application’s thread or threads depending on the absolute or relative priority the developer has given it.

Symbian OS also encapsulates asynchronous calls into active objects. This makes them easy to manipulate. In addition, since you use active objects within the Symbian OS itself for system service access, it’s relatively simple to access system resources such as the file server, messaging server, and sockets server with a straightforward API call.

Next Time
As you can see, despite the superficial similarities, programming in Symbian isn’t just like programming a Palm PDA. It’s not a matter of simply knowing C++. Not only does Symbian offer more full access to the operating systemstet APIs, and the underlying hardware, its object-oriented approach is fundamentally different from Palm’s approach.

Part 2 of this series will discuss the differences in code reusabillity and shared libraries, connectivity, and how each system handles memory.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: