This document describes the steps involved in installing Linux on an embedded device and building a Qt/Embedded application. The target device is the Cassiopeia E-100/E-105. The device has a MIPS Vr4121 processor, 16MB RAM (32MB in E-105), a Compact Flash slot and a 240x320 16 bit per pixel LCD display.
The only part of this document that is specific to the Cassiopeia is the installation of Linux and the development tools. The example application can be compiled and run on your desktop machine.
All the information and software required to get Linux running on the VR series of processors is available from the Linux VR web site. In Summary:
Follow the instructions at http://www.linux-vr.org/tools.html.
Get a sample root ramdisk from ftp://ftp.ltc.com/pub/linux/mips/ramdisk/ramdisk
Follow the instructions at http://www.linux-vr.org/ramdisk.html to create a ramdisk.o file.
Now build your kernel http://www.linux-vr.org/kernel.html using this ramdisk object. Make sure you have at least the following configuration:
Follow the instructions at http://www.linux-vr.org/booting.html.
You should see the linux boot messages on the LCD display.
Usually a device such as the Cassiopeia would have a shell, configured as the Qt/Embedded server, that allows client applications to be launched. For the purposes of this tutorial, we will write a simple application that serves as the Qt/Embedded server and client. A more complete Qt/Embbeded server can be found in $QTDIR/examples/compact.
The application that we will write is a simple note pad. It will allow notes to be created, viewed and deleted. Since the Cassiopeia doesn't have a keyboard, we will include a simple on-screen keyboard for input.
Our note pad user interface is very simple. It consists of a toolbar with "New" and "Delete" buttons, a combo box to select the note to view and an editing area.
Take a moment to browse the source code for Note Pad in $QTDIR/examples/notepad/. The code is quite simple, but there are some things worth noting:
Since our application is quite simple we can remove some unneeded features from Qt/Embedded. Edit $QTDIR/src/tools/qconfig.h and disable unneeded features as follows:
#define QT_NO_IMAGEIO_BMP #define QT_NO_IMAGEIO_PPM #define QT_NO_IMAGEIO_XBM #define QT_NO_IMAGEIO_PNG #define QT_NO_ASYNC_IO #define QT_NO_ASYNC_IMAGE_IO #define QT_NO_TRUETYPE #define QT_NO_BDF #define QT_NO_FONTDATABASE #define QT_NO_MIME #define QT_NO_SOUND #define QT_NO_PROPERTIES #define QT_NO_CURSOR #define QT_NO_NETWORKPROTOCOL #define QT_NO_COLORNAMES #define QT_NO_TRANSFORMATIONS #define QT_NO_PSPRINTER #define QT_NO_PICTURE #define QT_NO_LISTVIEW #define QT_NO_CANVAS #define QT_NO_DIAL #define QT_NO_WORKSPACE #define QT_NO_TABLE #define QT_NO_LCDNUMBER #define QT_NO_STYLE_MOTIF #define QT_NO_STYLE_PLATINUM #define QT_NO_COLORDIALOG #define QT_NO_PROGRESSDIALOG #define QT_NO_TABDIALOG #define QT_NO_WIZARD #define QT_NO_EFFECTS
See Qt Features for a description of the features that can be disabled. This leaves us with a small set of widgets and dialogs necessary for our application. Cross-compile the library for the mips target on the x86 platform:
cd $QTDIR ./configure -xplatform linux-mips-g++ -platform linux-x86-g++ make mipsel-linux-strip $QTDIR/lib/libqt.so.2.2.0The library is stripped to conserve ramdisk space.
Compile the application:
cd examples/notepad make mipsel-linux-strip notepadWe have chosen to link the application dynamically. While this is important if we plan to run multiple applications, it is a waste of space in an application such as notepad that is supposed to be the only application running. You can link statically by configuring with:
./configure -static -xplatform linux-mips-g++ -platform linux-x86-g++
We must install our application and its support files in the ramdisk. Mount the ramdisk using loopback device (you will need loopback device support in your kernel):
mkdir /mnt/ramdisk mount -o loop ~/ramdisk /mnt/ramdisk
Copy the Qt/Embedded library to the ramdisk /lib directory and make the necessary links:
cd /mnt/ramdisk/lib cp $QTDIR/lib/libqt.so.2.2.0 . ln -s libqt.so.2.2.0 libqt.so.2.2 ln -s libqt.so.2.2.0 libqt.so.2
The fonts must be installed in /usr/local/qt-embedded/etc/fonts:
cd /mnt/ramdisk mkdir usr/local mkdir usr/local/qt-embedded mkdir usr/local/qt-embedded/etc mkdir usr/local/qt-embedded/etc/fonts cp helvetica_100_50.qlf helvetica_120_50.qlf usr/local/qt-embedded/etc/fonts
When the kernel boots it looks for several files to run. In order to have our application run when the kernel boots, we rename it to /bin/sh. A /tmp directory is also used by Qt/Embedded:
cp $QTDIR/examples/notepad/notepad /mnt/ramdisk/bin/sh mkdir /mnt/ramdisk/tmp umount /mnt/ramdisk
Create a ramdisk object, link it with the kernel, copy it to the compact flash and boot Linux. You should see the calibration screen appear on the LCD display.
|Copyright © 2005 Trolltech||Trademarks|
Qt version 2.3.10