<< Prev | TOC | Front Page | Talkback | FAQ | Next >>
...making Linux just a little more fun! | Software development for a Sharp Zaurus SL-5500 Linux PDA By Bruce Forsberg
Recently I have been looking for an MP3 player that would satisfy several criteria. One, be usable with Linux and second, be usable with Old Time Radio shows. I am a big fan of what is called Old Time Radio here in the USA. This is radio shows from the 1930's, 40's, and 50's. One can buy a CD-R full of shows all in MP3 format. OTR shows are typically encoded at 24, 32, or 48 kbps in mono format with a sample rate of 22050 and are 1/2 hour to 1 hour in length. Not all MP3 players work well under these conditions. Thus began my search for a better solution. After some search I came to the conclusion that a Linux PDA would be my best bet where I could write custom software to perform the needed functionality that is required. Since the Sharp Zaurus SL-5500 uses Linux with Qtopia, a Qt system for embedded systems, this became an obvious choice since I already know Qt programming on Linux. When I looked at the Sharp web site I saw two Linux PDA models present for sale in the USA. The SL-5500 and the SL-5600. At the time of writing this article the SL-5600 has just become available. There are several main differences between the two models but the main one is that the SL-5600 contains a 400 Mhz Intel Xscale processor whereas the SL-5500 contains a 206 Mhz Strong ARM SA-1110 processor. I decided on the SL-5500 since that was the only option when I bought. The 400 Mhz would be nice but not needed for audio. If I wanted video I would have waited for the 5600. This device contains a Linux 2.4 Embedix kernel stored in a 16 MB Flash ROM with many other standard applications. It contains 64 MB SDRAM of which about half is used for program memory usage and the other half for user program storage. It contains a host of accessories and other capabilities. I was able to purchase my Sharp Zaurus SL-5500 new on EBAY for about $300 plus $20 shipping. It came with a docking station with a USB connector and software for MS Windows. That was several months ago. Now that the SL-5600 has come out the SL-5500 is selling for about $200-$300 new. ### SETUP FOR DEVELOPMENT In order to learn how to program on this platform I decided that my OTR MP3 project was too big for a first project so I choose a simpler project. It is a car mileage calculator. I just purchased a Toyota Prius Hybrid automobile. Since I get around 45-50 MPG I like to track my mileage. So I wrote down a few requirements for the program and started out on how to program for the SL-5500 PDA. The following are my findings. First you will need several pieces of software. When you develop for the Sharp Zaurus you will develop in two phases. You will perform all your GUI layout, coding, debugging, and testing on your Linux Intel box. Then when you have finished that, you will cross-compile and package the software for the Sharp Zaurus PDA using the Strong ARM architecture. You will need several RPMs to accomplish this. Here are the packages that you will need. qtopia-free-1.X.X-1.i386.rpm -- Qtopia SDK for Linux Intel. Get the latest from Trolltech's web site. binutils-cross-arm-2.11.2-0.i386.rpm -- Arm binary utilities for Linux Intel gcc-cross-sa1100-2.95.2-0.i386.rpm -- Arm cross compiler for Linux Intel glibc-arm-2.2.2-0.i386.rpm -- Arm glibc linux-headers-arm-sa1100-2.4.6-3.i386.rpm -- Arm header files The above 4 files can be obtained from the Zaurus Documentation web site along with instructions on how to install them. To begin with you will need the standard stuff that comes with your Linux on Intel distribution for compiling C++ programs. Next you will need to install the Qtopia SDK (Software Development Kit). Please note that there is a commercial SDK as well as a free SDK. If you use the free SDK you might be limited as to the licensing of your program. Be sure to read Trolltech's information regarding this. Once this is installed you will be able to compile, run, and debug on your Linux on Intel box. When this is done and you are ready to test your program you will need to install the last 4 rpms listed above. This will give you the ability to cross compile your program for the Strong ARM processor. ### DEVELOPMENT Now that you have development setup you are ready to start developing. If you have never developed before, the Sharp Zaurus is the ideal platform. This is because of limited storage and memory the best programs are simple programs. Full function office suites are not wanted. If you need an idea then I suggest you look at program search engines for the Palm and Microsoft OS PDAs. Then look at the Zaurus PDA search engines. When you find an application that is not available for the Zaurus but is for the others then chances are this is a good choice. Also choose a program that interests you. Before you get started you will need to set environment variables for developing on your Linux on Intel box. You will need to set the following in your bash shell assuming that you placed the software package in the default location:
    QPEDIR=/opt/Qtopia
    QTDIR=/opt/Qtopia
    TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-x86-g++/
    PATH=$QTDIR/bin:$QPEDIR/bin:${PATH}:/opt/Embedix/tools/bin
    LD_LIBRARY_PATH=$QTDIR/lib:${LD_LIBRARY_PATH}
    export QPEDIR QTDIR PATH TMAKEPATH LD_LIBRARY_PATH
The next few steps entail developing just like you develop a normal Qt application. I will not go into this since there have been many articles on this already. A good book on the subject is published by O'Reilly and is called "Programming with Qt" by Matthias Kalle Dalheimer. Briefly you will use designer to create your GUIs. Keep in mind that the display is 240x320. Then generate a ui file. Next you will create a project file. Usually called your project name dot pro (ie example.pro). If you need a little help look in the SDK directory /opt/Qtopia/example. This is an example program that contains most of the components needed to build a program. Use this .pro file as a starting point. Once your .pro file is created then you will generate your Makefile by:
    tmake -o Makefile yourprogram.pro
Now start your coding. Create your classes and your slots and connections as with ordinary Qt programming. When this is completed then build your program by typing "make". Fix any errors and when you have a successful build then you are ready to run your program in the emulator. Since the Sharp Zaurus has no X server you need an emulator to simulate the environment of the Sharp Zaurus. First you need to run the Qt/Embedded Virtual X11 Framebuffer. In the same shell type:
    qvfb &
You should now have an X11 application running that is the emulator. Now you will need to run the equivalent of a window manager. To do this type in the same shell:
    qpe &
If everything has gone well then you should see an emulation of a Sharp Zaurus PDA. It is in this environment that you will be able to test and debug your program. Even though you don't see your program all you need to do to have it run is to start it from your development directory. Just run your program normally. You should be able to run it in a debugger as well. You can now fully test your application. Your next step is to generate an ipkg file that can be loaded onto your PDA and installed. ipkg format is the format used on the Sharp Zaurus PDA. To do this you need to first compile your program for the Strong ARM processor using the cross compiler and tools that you installed in the section above. To start with it is best to start a new shell. Once in this shell setup the following environment variables:
    CROSSCOMPILE=/opt/Embedix/tools
    QPEDIR=/opt/Qtopia/sharp
    QTDIR=/opt/Qtopia/sharp
    PATH=$QTDIR/bin:$QPEDIR/bin:$CROSSCOMPILE/bin:${PATH}
    TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-sharp-g++/
    LD_LIBRARY_PATH=$QTDIR/lib:${LD_LIBRARY_PATH}
    export QPEDIR QTDIR PATH LD_LIBRARY_PATH TMAKEPATH
Next you need to generate a new Makefile that is for the Strong ARM processor. So type:
    tmake -o Makefile yourprogram.pro
Then "make clean" to remove all the old object files. Then "make", you should now be building everything with the cross compiler. Since there is a limit to the size that a PDA can hold I recommend that you strip your executable. But, don't make the mistake that I made and use strip. You need to use the cross compiled strip, in this case arm-linux-strip. Now that you have your executable you need to package everything in an ipk file. First you need to create a top level directory, we will use prog for our example. Next you need to create the following directory trees:
    prog/opt/QtPalmtop/bin
    prog/opt/QtPalmtop/lib (if needed)
    prog/opt/QtPalmtop/apps/Applications
    prog/opt/QtPalmtop/help/en/html
    prog/opt/QtPalmtop/pics
    prog/CONTROL
First of all put your executable in the bin directory. If you have libraries as well then put them into the lib directory. Your help file will be in html format. So create a html file with your favorite editor and place this into the html directory. The file name should be your executable name dot html. The directory shown above assumes an english html file (ie en). If you use a different language then you will need to use a directory other than en. In the pics directory place an image file in png format that is 32 X 32 pixels. This will show up as the icon used for this application. This leaves us with two directories, CONTROL and Applications. In CONTROL you will place a file called control. This will be used for ipk. In Applications create a file called yourprogramname.desktop. For my mileage program I use a control file with the following entries:
    Package: mileage
    Priority: optional
    Section: Misc
    Version: 2.0
    Architecture: arm
    Maintainer: Bruce Forsberg  forsberg@tns.net
    Description: A Car Mileage Calculator Program
The Package field contains the name of the package. Priority should be optional for most other applications. Section can be Misc for now but should be changed later to an appropriate value. See the IPKG docs for more information. Version should be the version of your application. Architecture should be arm for the SL-5000 and SL-5500 Zaurus PDAs. Maintainer should be the name and email address of the person maintaining this package. Description should be a brief description of the program. Depends is an optional field if your application depends on other packages being present. See the resources section of this article for more detailed information on the IPKG format. If you want your icon to show up in the Qtopia desktop you will need to add a desktop file in the Applications directory. For the desktop file for my mileage program I use the entries shown below. The fields should be self explanatory.
    [Desktop Entry]
    Comment=A Car Mileage Calculator Program
    Exec=mileage
    Icon=mileage
    Type=Application
    Name=Mileage Calculator
Now that we have all these files created and stored into the subtree of prog we are ready to build the package. Use this script and then type "ipkg-build.sh prog". You now have a .ipk file. Simply use the normal methods of loading software onto zaurus and install your program and test it. If you launch your program and nothing happens, one thing to try is to install the qpe-terminal application. This will give you the equivalent of an xterm on the Zaurus. Start the terminal application and enter your application name from this window and see if you get any error messages. Also you can type dmesg. This will display the messages sent to the error log. I hope this article will inspire you to start programming for the Sharp Zaurus PDAs. It is a lot of fun and adds to the success of Open Source and Linux. You also will be surprised just how much you will wind up using your new PDA. After you finish your project and are ready to release it check out sourceforge.net. This is a great place to host your project. Then upload your ipk to the Zaurus PDA search engine at http://www.killefiz.de/zaurus. Be prepared to release another version in a couple of weeks after the first release. You should fix any major bugs found with this release so that your program will be useable. Also think like a user when you create your program. Make it as easy to use as possible. For example for my mileage program I added a GUI keypad to enter odometer and fuel and a button to enter today's date. Even though the Zaurus has a keyboard, the GUI keypad makes entry so much easier. So, get your Zaurus start developing and have fun. ### RESOURCES
    How to docs for the Sharp Zaurus - http://docs.zaurus.com
    IPKG How to for Sharp Zaurus - http://docs.zaurus.com/ipkg_howto.shtml
    IPKG Home Page - http://www.handhelds.org/z/wiki/iPKG
    IPKG build script - http://docs.zaurus.com/downloads/ipkg-build.sh
    Programming with Qt book - http://www.oreilly.com/catalog/prowqt2
    Sharp SL-5500 - http://www.sharpusa.com/products/ModelLanding/0,1058,698,00.html
    Sharp SL-5600 - http://www.sharpusa.com/products/ModelLanding/0,1058,1016,00.html
    Zaurus Developer site - http://www.zaurus.com/dev
    Zaurus Program Search Engine - http://www.killefiz.de/zaurus
    Must-Have Zaurus Hardware and Software - Linux Journal Jan 2003 Article, not available on-line yet.
    Linuxdevices.com article - http://www.linuxdevices.com/articles/AT6553340334.html
    Car Mileage PDA Calculator Home Page - http://mileage.sourceforge.net
Bruce is just an average guy having fun with Linux. He is the founder of the Open Source Audio Library Project. He got his start programing freeware on windows 3.1. When he realized that all one had to do was to not return from a message and it would hang the entire operating system, he knew there had to be a better way. Linux was the answer. Copyright © 2003, Bruce Forsberg. Copying license http://www.linuxgazette.com/copying.html Published in Issue 90 of Linux Gazette, May 2003 << Prev | TOC | Front Page | Talkback | FAQ | Next >> |
Linux Gazette
Euskal Linux ORG
Debian Planet
debianHELP
Debian Security

-- This mirror is hosted by: --
© 1995, 2003 Euskal Linux ORG