Developing for Mobile Internet Devices, Part 1: Tools, Choices, and Development Environment Configuration

By Paul Ferrill

Developing applications for Mobile Internet Devices (MIDs) requires a new mindset on the part of developers. While it is possible to take an existing application and port it to a MID, it probably will not work well without some tweaking. Building a new application from the ground up to take advantage of MID features opens a world of possibilities.

Targeting a specific MID might limit the usefulness of the application. It makes a lot more sense to build in platform awareness for things like display size, network connectivity, Global Positioning System (GPS) availability, and storage. This will take a little extra coding but should make for a much more robust application. It will also make the code work on more platforms.

Making the right choices when it comes to programming language, support libraries, and user interface (UI) will determine the overall success of the project. Most open source projects typically start out as a pet project written in someone's favorite language or as an exercise to learn something new. For this article series, I use the Python language and attempt to keep the supporting libraries to a minimum.

Hardware Possibilities

The current crop of MIDs, based on the Intel® Atom™ processor, provides a combination of CPU power, graphics performance, and memory not previously available in small devices. When you add in GPS, Wi-Fi, and 3G connectivity (on some models), you have the potential for a truly always-connected device capable of delivering precision location information. This combination of hardware functionality opens up a whole new world of possibilities for applications.

This series of articles uses the Compal* JAX10 MID as the target platform. It is based on an 800-MHz Intel® Atom™ processor with 512 MB of memory, 4 GB of solid-state disk configured as two 2-GB devices, two built-in cameras on the front and back for video conferencing and taking pictures or video, GPS, Bluetooth* technology, and 802.11b/g Wi-Fi. The model tested did not have 3G wireless installed.

Powering up the Compal* JAX10 MID reveals the Midinux* operating system from Red Flag Software. A version of Moblin* specifically for the JAX10 is available from Moblin.org. It requires a bit of tweaking to get the touch screen and wireless to work, but it is doable. One other option is Ubuntu* Mobile and Embedded (UME), although it is based on an older version of Ubuntu.

UI Constraints and Choices

One of the problems developers inevitably face with small form factor devices is in designing the right UI to be both visually appealing and finger functional. Crafting a small-screen UI is one of the most important things you have to take into consideration when developing for the MID form factor. The Compal JAX10 MID has a display size of 800 × 480, which can chop off the lower portion of some fixed-sized dialog boxes.

Choosing a flexible and easy-to-use UI foundation library helps keep your development struggles to a minimum. Which library you select depends a great deal on the type of application you're looking to build. The GTK+* framework comes as a standard part of both Midinux and Moblin, so you won't have to include or require any additional libraries should you choose to go that route. Moblin has also decided to standardize on Clutter* for graphics-intensive applications.

Development Environment


Although you could do the development work on either a Windows* or Linux*-based computer, it really makes the most sense to use a Linux system for a number of reasons. The build-test-build cycle goes more quickly when you run on the same operating system. The only exception might be when using a language like Python* that doesn't really require compilation. In addition, Linux target device emulation has the best support from the Linux operating system.

Choosing a stable, popular distribution like Ubuntu makes it easier to get the tools you need up and running quickly. It also increases your chances of finding help for problems you might run into, as more often than not, someone else has already found a solution. Ubuntu is also one of the distributions-along with Fedora* 9-directly supported by the Moblin project. We chose Ubuntu 8.10 to use on our development system for this project.

Consider using a fairly recent computer with hardware virtualization support as your primary machine. Some of the virtualization software packages require hardware virtualization support to work properly. Others will work without it but obviously run faster if the support is available. You should max out your memory, as well, although a 32-bit machine can't really use more than 3 GB.

Developer Tools

Most seasoned developers have a preferred set of tools they feel most comfortable using. For many in the open source world, this toolset equates to Eclipse* and some number of add-ins. Although Eclipse was built on Java* technology and counts Java developers as its largest user base, it does support other languages quite well. Nokia* uses Eclipse as the foundation of its developer tools to deliver a high-end experience complete with emulation and target device deployment for the Nokia* N810 family of devices.

Anjuta* is another integrated development environment (IDE) with a substantial following. Anjuta is written in the C language and uses C for its application programming interface (API) and plug-in architecture. It does provide decent support for both C++ and Python, as well. Support for other languages, including C#, is in the works. Of particular interest to UI designers is the integrated Glade* tool, with tight support for editing and creating Glade files.

Intel has a number of open source tools available to developers serious about squeezing the most out of their applications. New power-management profiling tools make it possible for developers to determine exactly how much power individual pieces of their code consume. The Application Energy Toolkit evaluates applications to determine how "power aware" they are. Versions for Windows, Linux, and Mac OS* X version 10.5 Leopard are available. Specifically for mobile developers, the Intel® Mobile Platform Software Development Kit (Intel® Mobile Platform SDK) offers a number of different tools to facilitate building "mobile aware" applications.

Emulation

One of the best ways to test your software without actually loading it onto the target device is through emulation. A number of emulation tools work only in the Linux environment. Red Flag* Software uses Xnest* in conjunction with chroot in its SDK for Midinux, which makes it possible to run in virtually the same environment you would be running on the target device. For our purposes, there's a how-to on the Red Flag site for configuring its SDK to work with Xnest.

The Moblin project uses a similar approach with its Moblin Image Creator* (MIC) tool. This graphical user interface (GUI) application helps you create a target Moblin image for a specific platform, then test it by using Kernel-based Virtual Machine* (KVM). MIC can also build VMware* VMDK* images for use with VMware's player application, which gives you the option of running completely inside a virtual environment without making any modifications to your host machine.

Getting Started



The best place to start with any project is the beginning. Developing a set of requirements that meet your goals helps determine the overall direction of the project. Even if the project is fairly simple, it always helps to write down what your application will do. For this effort, I focus on an application that will take advantage of a number of the MID features, including the GPS and Wi-Fi connectivity.

It's a good idea to go through the process of creating the typical "hello world" application after you have your development environment configured to your liking. This might seem like a trivial exercise, but it confirms your ability to build your code then deploy it to your target platform. It might also help you think through how best to automate the process to save time in the future.

Be sure to enable Secure Shell (SSH) on the target platform to make it possible to enter commands remotely. For the JAX10 notebook, you must type a command in a terminal window on the device to start the SSH daemon. Launching a terminal window requires you to press the Fn and P keys simultaneously (Function P), which brings up a prompt similar to this:

[root@CompalMID~]#

To start the SSH daemon you must type:

[root@CompalMID~]# /etc/init.d/sshd start

You should see:

Starting sshd:  								[OK]

When that's done, you'll be able to use an SSH client tool to connect remotely to the device. You need the IP address to connect: You can find that information with the IFCONFIG command.

Avoid Common Problems



Don't get bogged down in the details too early in the process. Trying to write code to accomplish a task you don't understand well is not a good idea. Reading the documentation and studying example source code for any library or packaged code you choose to use could actually save you time in the long run. Reading through forums or old IRC logs can help answer questions and provide some insight as to how others have approached similar problems in the past.

Don't be afraid to build small "proof of concept" applications to figure out how something works-say, how to connect to the GPS or how to properly size a button based on the display dimensions of the device. Look for other code that accomplishes the same thing. Don't be too proud to learn from someone else's work. The Python community has a large body of code to do just about anything you can think of. You can find a wealth of searchable code examples on the ActiveState Python Cookbook site.

Do use some type of source control system for tracking revisions and keeping your source code backed up. It's a good idea to either use a hosted service or run the main source code repository on separate machine from your development computer. Then, you'll always have a way to recover should something happen to that machine. Concurrent Versions System* (CVS) has been around forever, while Subversion* (SVN) and Git* are more recent possibilities.

Summary



Building software applications for the MID platform requires a new mindset and a good set of tools to do the job right. Keep these things in mind when starting out:
  • Choose a good IDE that you're comfortable with.
  • Use a popular Linux distribution like Ubuntu for the operating system of your development computer.
  • Don't skimp on your development hardware, and do get a machine with a recent processor and ample memory.
  • Use good software development practices, like gathering requirements and using a source code control tool.

About the Author



Paul Ferrill has been writing in the computer trade press for more than 20 years. He got his start writing networking reviews for PC Magazine on products like LANtastic and early versions of Novell Netware. Paul holds both BSEE and MSEE degrees and has written software for more computer platforms and architectures than he can remember.


Link to Part 2 of this series



Designing Code and Testing (coming soon).

Per informazioni più dettagliate sulle ottimizzazioni basate su compilatore, vedere il nostro Avviso sull'ottimizzazione.
Contrassegni: