1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Qt Toolkit - Qt/Embedded Case Study - Cassiopeia E-100</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style></head><body bgcolor="#ffffff">
<p>
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center> Qt/Embedded Case Study - Cassiopeia E-100</h1><br clear="all">
<h2>Introduction</h2>
<p>
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.
<p>
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.
<p>
<h2>Installing Linux</h2>
<p>
All the information and software required to get Linux running on the VR series
of processors is available from the <a href="http://www.linux-vr.org/">Linux VR
</a> web site. In Summary:
<p>
<h3>Install the tools</h3>
<p>
Follow the instructions at
<a href="http://www.linux-vr.org/tools.html">http://www.linux-vr.org/tools.html</a>.
<p>
<h3>Build the kernel</h3>
<p>
Get a sample root ramdisk from
<a href=ftp://ftp.ltc.com/pub/linux/mips/ramdisk/ramdisk>ftp://ftp.ltc.com/pub/linux/mips/ramdisk/ramdisk</a>
<p>
Follow the instructions at
<a href="http://www.linux-vr.org/ramdisk.html">http://www.linux-vr.org/ramdisk.html</a>
to create a ramdisk.o file.
<p>
Now build your kernel
<a href="http://www.linux-vr.org/kernel.html">http://www.linux-vr.org/kernel.html</a>
using this ramdisk object. Make sure you have at least the following
configuration:
<p>
<ul>
<li>Development/incomplete drivers
<li>Casio E105 Platform
<li>Network and System V IPC
<li>RAM disk and Initial RAM disk support
<li>Support for console on virtual terminal (so that you can see boot messages)
<li>/proc and ext2 filesystem support
<li>Simple Frame Buffer with HPC device control
</ul>
<p>
<h3>Booting Linux</h3>
<p>
Follow the instructions at
<a href="http://www.linux-vr.org/booting.html">http://www.linux-vr.org/booting.html</a>.
<p>
You should see the linux boot messages on the LCD display.
<p>
<h2>A Qt/Embedded Application</h2>
<p>
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.
<p>
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.
<p>
<h3>Note Pad</h3>
<p>
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.
<p>
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:
<p>
<ol>
<li>Two fonts are set - helvetica 10 point as the application default font,
and helvetica 12 point for the editor. Since we will use prerendered fonts
these fonts must be prepared as <a href=fonts-qws.html>described here</a>.
<li>The QApplication is constructed with the QApplication::GuiServer type
specified. This makes the note pad a Qt/Embedded server. One server must
be running for Qt/Embedded clients to run. In this case our application is
both server and client because it is the only application we wish to run on
our device.
<li>The Cassiopeia has no keyboard (generally) so we must provide some means
of character input with the pen. The simplest method is to display a small
keyboard. The compact example includes a keyboard, so we use this code.
Key and pointer input is Qt/Embedded specific, so it is surrounded
by #ifdef _WS_QWS_ ... #endif so that we can compile the example with Qt/X11
or Qt/Windows if we wish.
<li>The touch panel needs to be calibrated. There is a calibration module
included in the compact demo, so we use this.
</ol>
<p>
<h3>Creating a suitable Qt/Embedded Library</h3>
<p>
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:
<p>
<pre>
#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
</pre>
<p>
See <a href=features.html>Qt Features</a> 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:
<pre>
cd $QTDIR
./configure -xplatform linux-mips-g++ -platform linux-x86-g++
make
mipsel-linux-strip $QTDIR/lib/libqt.so.2.2.0
</pre>
The library is stripped to conserve ramdisk space.
<p>
<h3>Installation</h3>
<p>
Compile the application:
<pre>
cd examples/notepad
make
mipsel-linux-strip notepad
</pre>
We 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:
<pre>
./configure -static -xplatform linux-mips-g++ -platform linux-x86-g++
</pre>
<p>
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):
<pre>
mkdir /mnt/ramdisk
mount -o loop ~/ramdisk /mnt/ramdisk
</pre>
<p>
Copy the Qt/Embedded library to the ramdisk /lib directory and make the
necessary links:
<pre>
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
</pre>
<p>
The fonts must be installed in /usr/local/qt-embedded/etc/fonts:
<pre>
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
</pre>
<p>
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:
<pre>
cp $QTDIR/examples/notepad/notepad /mnt/ramdisk/bin/sh
mkdir /mnt/ramdisk/tmp
umount /mnt/ramdisk
</pre>
<p>
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.
<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|