Programming the Nokia #N900
A couple of weeks ago, I wrote a blog post about Bright Shiny Tools, where I considered the pros and cons of various programming languages. Since then, my Nokia N900 has arrived and I’ve started programming for that. I’ve also introduced my daughter to Squeak, but I’ll leave that for another day. There is also more exciting stuff in the Matlab world, but that will wait even longer.
Java
There has been a lot of talk about Java on the N900. Currently, the Maemo Java Wiki page says “There is no official Java ME or Java SE from SUN as of yet” and “Nokia does not plans support because Nokia already supports 2 development platforms: either GTK (Maemo 5) or Qt (Maemo 6) as well as WRT (Web Run Time).”
I believe that Nokia and Sun are making mistakes on this. I’ve installed an early access version of Java for ARMv6 Linux. It works; sort of. I wrote some simple Java applications over on a Linux PCs and then moved the class file over to the N900 where it ran fine. On the other hand, I haven’t had any luck with Java applets, or getting java to run from within a browser.
Various downsides include Java taking up a lot of space, and the Sun version will expire in a few months. Next time, I’ll probably try OpenJDK.
QT
QT is Nokia’s “Cross-platform application and UI framework”. Even before my N900 arrived, I had installed QT on a Microsoft Vista based laptop and a Linux based laptop. It seems to be a great framework for C++ developers and I wrote my own quick little application as well compiled QwaveClient.
While the QT development environment is great, it is also quite large. So, I am doing my QT Development on my various laptops. On my Linux laptop, I’ve also installed Scratchbox. This allows me to compile on the Linux laptop and then simply copy the executable over to the N900. There are a few problems with this. First, the emulator does not work well with the Xwindows display, so I can’t test fully test my applications on the laptop before I move them over to the N900.
The second problem is that the emulator has a tendency to core dump at random times. In spite of these difficulties, I’ve managed to build a simple application of my own to run on the N900 as well as test various versions of the QWave client. One problem I’ve run into with QWave is that qMax does not seem to be available in my emulator, so I needed to work around that.
The next test that I tried with QT was to use Python-QT. After a little poking around, I found that I could install Python-QT with the command apt-get install python2.5-qt4 The problem is that with all the dependent packages, this requires over 13 meg to be installed in the root filesystem. That is all that I’ve got left for space there, so unless I can find a way to repartition the file system or get some files moved out of the root file system, that would present some significant problems.
GTK
With that, I moved over to experiment with GTK. I suspect I could build some GTK apps using C++ similar to the way I’ve built QT apps. However, if I’m going to use C++, I’ll probably just stay with QT. The reason to try other frameworks is to see if I can get a nice scripting environment going.
With that, my first try was with Python-GTK. There is a great tutorial available at PyGTK 2.0 Tutorial. The first thing that they point to is pygtkconsole. This is a simple Python script that allows you to try simple GTK commands. I fired it up and had a button displayed on my screen in a manner of moments. I followed the tutorial and kicked around a couple other python-gtk applications. As a rapid prototype scripting environment, python-gtk looks great. I haven’t explored it enough to make anything interesting yet, however. On top of this, it seems to share many basic concepts with QT.
I’ve also looked around at Perl-GTK, but I can’t find an easy way to get it running on the N900, so I’m sticking that on the back burner for a little while.
Hildon
The next framework that I looked at was Hildon. The “Hildon application framework introduces a new desktop for handheld devices. It comprises a lightweight desktop, a set of widgets optimized for handheld devices, a set of theming tools and other complementary libraries and applications.”
The Maemo Wiki provides a little information about using Hildon Widgets within Python-GTK. I followed their example and put up a Hildon widget in my sample Python-GTK script. Looks nice.
There is also work being done with HIldon and QT. I had experimented with this a little bit as I explored tweaking QWaveClient for the N900. However, I never got very far, so I’ll leave that on the back burner for now.
What next?
So far, I’m very impressed with the development opportunities for the N900. I might write a little more QT/C++ code. I might do some prototyping with Python-GTK, and perhaps throw in a little Hildon. I might even give Ruby a try. I’ve joked about installing php and then Drupal. That is too much work for now, and I don’t really have a current need for my cell phone to run a content management system.
I’ll spend a little time seeing what other people are doing with the N900 and perhaps collaborate here and there. If you’re doing any interesting N900 development, please let me know.