I like programming, I like mobiles, so naturally three months into my trial of the Nokia N900 my curiosity turned to how you might write your own applications for this very capable device. Notice I've said “applications” not “apps” here, as maybe “apps” doesn't really do it justice, especially with full sized applications like Abiword being ported. The device is really a pocket sized Linux computer with goodies such as a high resolution screen, GPS and Infra Red all thrown in so it has a lot of potential for creative application developers. You can develop code for it using tools on your laptop or if you just want to experiment a little you can even write Python programs on the device itself.
As you might have expected there is a Software Development Kit (SDK) for Maemo, the operating system the N900 uses. You can download this from http://www.forum.nokia.com/info/sw.nokia.com/id/c05693a1-265c-4c7f-a389-fc227db4c465/Maemo_5_SDK.html. Actually getting the Maemo SDK installed is an interesting experience. Installation is only supported for 32bit Debian based Linux systems (although installation to other types of Linux systems looks possible). If you are using Windows or Mac you will need to download a preconfigured virtual image from : http://maemovmware.garage.maemo.org/2nd_edition/. It is based on the Scratchbox cross compilation environment, when you install the SDK two compilation targets are added one for X86 (native to your computer) and one called ARMEL (an emulation of the ARM processor on the N900). The idea is that you use the X86 target during development then compile on ARMEL to run the code on an actual N900. It is not possible at the moment to emulate an N900 using the ARMEL target, so you will need a real device for testing. Further information in the background to the SDK can be found at: http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Development_Environment/Maemo_SDK.
Downloading and installing everything for the SDK can take some time. There are a couple of proprietary Nokia bits you will need too, but this is automated as part of the install process. When you try to log into a Scratchbox target for the first time you might get an error saying that it cannot work with “VDSO” enabled. To fix this you can add a parameter to your Kernel startup of “vdso=0”. To do this edit the file /etc/default/grub and find the line that says:
Change this to:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash vdso=0"
You will now need to reboot. When you get new kernel images as part of Ubuntu software updates this option will be applied automatically.
Development is mainly done in C and C++, but Python is also supported. The device itself even has Perl 5.8.3 installed, although I don't know if everything is available to develop full applications in that language. You can just use a text editor to edit your code and the tools inside Scratchbox to build it, but if you want something more powerful an Integrated Development Environment (IDE) is available called ESbox (above). This is based on Eclipse and integrates with the Maemo SDK. It can even connect to real N900s and run your code on there if you set everything up right, which looks a very useful feature if you were developing a real application and wanted to keep testing it on a real device. The IDE also comes with some example template projects to get you started. ESbox looks really powerful and I have not even scratched the surface of what is is capable of.
I am becoming more and more fond of Python as a programming language, so I was interested to try out a bit of Python programming on the N900. A great resource to get started with is the PyMaemo page at: http://wiki.maemo.org/PyMaemo. This has several tutorials on it, including a detailed on on how to write an entire GUI application. I tried out a bit of the PyMaemo/UI Tutorial and it all made sense. The tutorial goes on to explain you you can program the major user interface elements such as button, menus etc, so should get you off to a flying start.
You can also write programs for the N900 without installing the SDK or needing a development machine. It has Python 2.5.4 built in and also available is PyGTKEditor (above). This gives you a simple syntax highlighting editor in which you can write Python scripts and run them just by tapping an icon. This can be a great way to explore working with some of the features of the device that are not available in an emulator, for example the GPS. You could use it to explore the Location API in Python tutorial for example. As the N900 is multitasking you can have other applications open too that are essential for development such as the media player for music and the web browser for looking up help!
The Maemo platform used on the N900 looks like it could be very interesting and fun to work with as a developer. It is great that there are multiple routes into programming it. Soon Maemo will be merged, along with Intel's Mobin into the Meego project so it will be interesting to see what the development tools are like for that.