⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 emb-casestudy.html

📁 QT 下载资料仅供参考
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/doc/casestudyqws.doc:36 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>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: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr bgcolor="#E5E5E5"><td valign=center> <a href="index.html"><font color="#004faf">Home</font></a> | <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a> | <a href="functions.html"><font color="#004faf">Functions</font></a></td><td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>Qt/Embedded Case Study - Cassiopeia E-100</h1> <p> <h2> Introduction</h2><a name="1"></a><p> This document describes the steps involved in installing Linux on an embeddeddevice and building a Qt/Embedded application.  The target device is theCassiopeia E-100/E-105.  The device has a MIPS Vr4121 processor, 16MB RAM(32MB in the E-105), a Compact Flash slot and a 240x320 16 bit per pixel LCDdisplay.<p> The only part of this document that is specific to the Cassiopeia is theinstallation of Linux and the development tools.  The example applicationcan be compiled and run on your desktop machine.<p> <h2> Installing Linux</h2><a name="2"></a><p> All the information and software required to get Linux running on theVR 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><a name="2-1"></a><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><a name="2-2"></a><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 followingconfiguration:<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> <tt>/proc</tt> and ext2 filesystem support<li> Simple Frame Buffer with HPC device control</ul><p> <h3> Booting Linux</h3><a name="2-3"></a><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><a name="3"></a><p> Usually a device such as the Cassiopeia would have a shell, configured as theQt/Embedded server, that allows client applications to be launched.For the purposes of this tutorial, we will write a simple application thatserves as the Qt/Embedded server and client.  A more complete Qt/Embbededserver can be found in <tt>$QTDIR/examples/compact</tt>.<p> The application that we will write is a simple note pad.  It will allownotes to be created, viewed and deleted.  Since the Cassiopeia doesn't havea keyboard, we will include a simple on-screen keyboard for input.<p> <h3> Note Pad</h3><a name="3-1"></a><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 andan editing area.<p> Take a moment to browse the source code for Note Pad in <tt>$QTDIR/examples/notepad/</tt>. The code is quite simple, but there are somethings worth noting:<p> <ol type=1><li> Two fonts are set - helvetica 10 point as the application's default font,and helvetica 12 point for the editor.  Since we will use prerendered fontsthese fonts must be prepared as <a href="emb-fonts.html">describedhere</a>.<li> The <a href="qapplication.html">QApplication</a> is constructed with the QApplication::GuiServer typespecified.  This makes the note pad a Qt/Embedded server.  One server mustbe running for Qt/Embedded clients to run.  In this case our application isboth server and client because it is the only application we wish to run onour device.<li> The Cassiopeia (usually) has no keyboard so we must provide some meansof character input with the pen.  The simplest method is to display a smallkeyboard.  The compact example includes a keyboard, so we use this code.Key and pointer input is Qt/Embedded specific, so it is surroundedby #ifdef Q_WS_QWS ...  #endif so that we can compile the example with Qt/X11or Qt/Windows if we wish.<li> The touch panel needs to be calibrated.  There is a calibration moduleincluded in the compact demo, so we use this.</ol><p> <h3> Creating a suitable Qt/Embedded Library</h3><a name="3-2"></a><p> Since our application is quite simple we can remove some unnecessaryfeatures from Qt/Embedded.  Edit <tt>$QTDIR/src/tools/qconfig.h</tt> anddisable the following features:<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="emb-features.html">Qt Features</a> for a description of thefeatures that can be disabled.  This leaves us with a small set ofwidgets and dialogs necessary for our application.  Cross-compile thelibrary 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> <p> The library is stripped to conserve ramdisk space.<p> <h3> Installation</h3><a name="3-3"></a><p> Compile the application:<pre>    cd examples/notepad    make    mipsel-linux-strip notepad</pre> <p> We have chosen to link the application dynamically.  While this is importantif we plan to run multiple applications, it is a waste of space in anapplication such as notepad that is supposed to be the only applicationrunning.  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.  Mountthe ramdisk using loopback device (you will need loopback device supportin your kernel):<pre>    mkdir /mnt/ramdisk    mount -o loop ~/ramdisk /mnt/ramdisk</pre> <p> Copy the Qt/Embedded library to the ramdisk <tt>/lib</tt> directory and make thenecessary 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 <tt>/usr/local/qt-embedded/etc/fonts</tt>:<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 tohave our application run when the kernel boots, we change its name to<tt>/bin/sh</tt>.  A <tt>/tmp</tt> 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 flashand boot Linux.  You should see the calibration screen appear on the LCDdisplay.<p> <!-- eof --><p><address><hr><div align=center><table width=100% cellspacing=0 border=0><tr><td>Copyright &copy; 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -