Howto setup the cross compiler, the QPE development environment, and create a test application.
1) 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)
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.
2) 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.
Batch file #1, dev-x86-qpe.sh
Batch file #2, dev-arm-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.
3) Testing the cross compiler
To test the compiler, you will want to build the example application
in the/opt/Qtopia/example/ directory.
1. 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.
3. To actually build the application, run make within that same directory.
4. 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.
1. First, run the arm environment script in your home directory from a shell session. source dev-arm-qpe.sh
2. If there is a
Makefile you need to remove it from the example directory. rm Makefile (It is essential that you do this!)
3. Run make clean from within /opt/Qtopia/example to clean
out the old temporary files from the x86 configuration.
4. Run tmake example.pro > Makefile again to create the Makefiles for arm compiling.
5. 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
, and is available on http://doc.trolltech.com
for the online updated version.
4) Using qvfb
Applications can be tested and run in x11 using qvfb.
1. Run ./qvfb & to launch the simulated Zaurus display.
Any Qt/Embedded applications compiled for x86 you launch will now display
in this window.
2. 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.
5) Console Development
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
CONFIG -= qt # removes the qt linking
For more information about cross compiling you can visit http://www.arm.linux.org.uk/.
When building libraries, make sure arm-linux-ranlib gets called.