Howto setup the cross compiler, the QPE development environment, and create a test application.
Setting up the cross compiler
The development PC should have a Linux distribution pre-loaded on it. Preferably one that natively supports RPM packages, such as RedHat, SuSE, Mandrake or Caldera. You can also use distributions such as Slackware and Debian as well, but you may need to use a RPM conversion utility such as "alien" to support the RPM format.
Note that many of the newer distrobutions now use GCC3.2 or later as their default compiler. This means that when compiling for the desktop it will not be able to link to the sdk files as they were created using GCC 2.95. To fix this problem you need to install 2.95 for your distrobution.
Once the target PC is ready, the following packages should be downloaded:
[gcc-cross-sa1100-2.95.2-0.i386.rpm (gcc compiler for ARM architecture)
[binutils-cross-arm-2.11.2-0.i386.rpm (binary utilities for ARM architecture)
[glibc-arm-2.2.2-0.i386.rpm] (GNU C libraries for ARM architecture)
[linux-headers-arm-sa1100-2.4.6-3.i386.rpm] (linux header files for ARM architecture)
- For RedHat 9 On CD #1 or in the archives, find and install:
Then copy [tmake.conf | http://downloads.zaurususergroup.com/downloads/docs/downloads/tmake.conf] to /opt/Qtopia/tmake/lib/qws/linux-x86-g++/tmake.conf after installing the RedHat SDK rpms.
- For SuSE 8.x also download and install:
Each of the RPM files need to be installed from a command line prompt using the following command:
rpm -Uvh filename.rpm
For example, to install the arm gcc compiler, this should be run:
rpm -Uvh gcc-cross-sa1100-2.95.2-0.i386.rpm
By default, RPM installs the ARM toolchain in the /opt/Embedix/ folder.
Setting up QPE
Native development for the Zaurus is done using C++ and Qt by !TrollTech. QPE comes with a virtual frame buffer (qvfb) so that you can test applications under X11 without having to have a Zaurus. To run applications on the Zaurus (and the qvfb) you need to link against QPE rather then Qt. See section 4 for more details about qvfb.
To start development you need to obtain the QPE SDK from Trolltech (Either the GPL or Commercial edition) Mirrored locally here is the Qtopia-free version. (Qtopia is the name for the qpe libraries and the desktop environment build on it for the Zaurus.) If you are doing commercial development you need to obtain the commercial sdk.
Install the rpm in the same manor as to how the cross compiler was installed.
By default, RPM installs the Qtopia SDK in the /opt/Qtopia/ directory.
After the toolchain and the SDK are installed, you should download the two batch files in your home directory. One sets up the environment variables for compiling x86 versions of Zaurus applications (using the qvfb) and the other for setting the environment variables for doing native ARM crosscompiling for the Zaurus.
For SuSE 8.x add "/opt/gcc295/bin:" to the start of the PATH variable in [dev-x86-qpe.sh].
When you want to compile and test x86 applications run source dev-x86-qpe.sh from your home directory. Conversely, run source dev-arm-qpe.sh when you want to cross compile to run on the Zaurus.
Testing the cross compiler
To test the compiler, you will want to build the example application in the /opt/Qtopia/example/ directory.
- First, run the x86 environment script in your home directory from a shell session. source dev-x86-qpe.sh
2. Next, from within the same session in the /opt/Qtopia/example/ directory, run tmake -o Makefile example.pro. This creates the Makefile. (!RedHat 9 - copy the /opt/Qtopia/example/ directory to your home directory and in it, run tmake -o Makefile example.pro. This creates the example Makefile.)
- To actually build the application, run make within that same directory.
- Start qvfb at the command line qvfb & and then start the example application. example -qws.
Alternatively, to build an ARM version to run on the Zaurus do the following steps.
- First, run the arm environment script in your home directory from a shell session. source dev-arm-qpe.sh
- If there is a Makefile you need to remove it from the example directory. rm Makefile (It is essential that you do this!)
- Run make clean from within /opt/Qtopia/example to clean out the old temporary files from the x86 configuration.
- Run tmake example.pro > Makefile again to create the Makefiles for arm compiling.
- To build the arm binary, run make from within that directory. Once its built to run it, it will need to be copied over to the Zaurus and execute it from the console.
For further information about Qt, !QtDeigner (Qt's gui design tool), how to make application .pro files, qmake, tmake, and most Qt related questions see !TrollTech's site at: http://doc.trolltech.com and the sk documentation.
Qtopia's SDK (including qpe) documentation is located on your pc (it came with the sdk) in /opt/Qtopia/doc/index.html, and is available on http://doc.trolltech.com for the online updated version.
Applications can be tested and run in x11 using qvfb.
- Run ./qvfb & to launch the simulated Zaurus display. Any Qt/Embedded applications compiled for x86 you launch will now display in this window.
- Next, run ./example -qws to run the example app in server mode. Alternatively, you could run the qpe application from /opt/Qtopia/bin to simulate an actual Qtopia environment and then run the example app in non-server mode.
Depending on an application's build system, changing it to compile for arm could be as simply as setting the environment variable CC, but consult your distribution and build system documention.
Utilizing the easy of use of Qmake & Tmake can be done without having QT linked into the application by adding the following option to the .pro file.
CONFIG -= qt # removes the qt linking
When building libraries, make sure arm-linux-ranlib gets called.
For more information about cross compiling you can visit http://www.arm.linux.org.uk/.
If you want to use a graphical IDE for developing Zaurus applications, then you can use the unstable version of KDevelop, codenamed Gideon (which is actually quite stable). See the following link for a full howto for using KDevelop to develop Qtopia apps: http://www.kdevelop.org/doc/tutorial_qtopia/