QT Embedded、Tslib、QT for VS2008的配置与编译
Linux下常用的图形开发库有QT/GTK/MiniGUI等,我这里是选用了QT了。QT可以跨平台编译,同一份代码可以在WINDOWS、 UBUNTU LINUX和MIPS LINUX下编译,因此我们可以在WINDOWS下编写调试程序,再到UBUNTU下交叉编译MIPS的目标程序。
首先是去NOKIA的网站下载QT源码和工具了,下哪个版本自己决定,具体过程不多说。我下载的是qt-embedded-linux- opensource-src-4.5.3.tar.gz、qt-win-opensource-4.6.1-vs2008.exe和qt-vs- addin-1.1.3.exe。如果你一直在LINUX下工作,你可以下载x11的版本。而像我这样在WINDOWS下的话就只需要qt- embedded和VS的版本就可以了。
首先我还是将qt-embedded打包成ISO挂到UBUNTU虚拟机的CDROM上解压,并重命名为qte453:
root@ubuntu :/# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only
root@ubuntu :/# ls /mnt
qt-embedded-linux-opensource-src-4.5.3.tar.gz qt-x11-opensource-src-4.5.3.tar.gz
qt-extended-opensource-src-4.4.2.tar.gz tslib-1.4.tar.gz
root@ubuntu :/# cd /opt
root@ubuntu :/opt# tar -xf /mnt/qt-embedded-linux-opensource-src-4.5.3.tar.gz
root@ubuntu :/opt# ls
hello linux-2.6.24.3 qt-embedded-linux-opensource-src-4.5.3
hello.c mipseltools-gcc412-glibc261 u-boot-1.1.6
root@ubuntu :/opt# mv qt-embedded-linux-opensource-src-4.5.3 qte453
root@ubuntu :/opt# ls
hello hello.c linux-2.6.24.3 mipseltools-gcc412-glibc261 qte453 u-boot-1.1.6
root@ubuntu :/opt# cd qte453
root@ubuntu :/opt/qte453# ls
bin demos include LICENSE.GPL3 qmake translations
changes-4.5.3 doc INSTALL LICENSE.LGPL README
config.tests examples LGPL_EXCEPTION.txt mkspecs src
configure FAQ.txt lib projects.pro tools
root@ubuntu :/opt/qte453#
接着配置交叉编译的环境:
root@ubuntu :/opt/qte453# export PATH=/opt/mipseltools-gcc412-glibc261/bin:$PATH
root@ubuntu :/opt/qte453# export LD_LIBRARY_PATH=/opt/mipseltools-gcc412-glibc261/lib
然后准备进行configure。查资料可知君正4750的目标平台类型应该是linux-mips-g++,但我们用的编译工具其实是linux-mipsel-g++之类的,多了个el,因此需要修改一下配置文件:
root@ubuntu :/opt/qte453# find -name linux-mips-g++
./mkspecs/qws/linux-mips-g++
root@ubuntu :/opt/qte453# cd mkspecs/qws/linux-mips-g++/
root@ubuntu :/opt/qte453/mkspecs/qws/linux-mips-g++# ls
qmake.conf qplatformdefs.h
root@ubuntu :/opt/qte453/mkspecs/qws/linux-mips-g++# vi qmake.conf
在VI里把所有“mips-linux-”替换为“mipsel-linux-”,保存退出:
#
# qmake configuration for building with mipsel-linux-g++
#
include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
# modifications to g++.conf
QMAKE_CC = mipsel-linux-gcc
QMAKE_CXX = mipsel-linux-g++
QMAKE_CFLAGS += -mips32
QMAKE_CXXFLAGS += -mips32
QMAKE_LINK = mipsel-linux-g++
QMAKE_LINK_SHLIB = mipsel-linux-g++
# modifications to linux.conf
QMAKE_AR = mipsel-linux-ar cqs
QMAKE_OBJCOPY = mipsel-linux-objcopy
QMAKE_STRIP = mipsel-linux-strip
load(qt_config)
root@ubuntu :/opt/qte453/mkspecs/qws/linux-mips-g++# cd ..
root@ubuntu :/opt/qte453/mkspecs/qws# cd ../..
root@ubuntu :/opt/qte453#
接下来我们作一个简单的 configure.configure有很多参数,可以用--help命令查看到;另外如果你不是第一次配置,应先执行make confclean清理一下;configure会首先编译qmake,如果qmake都编译不成功,则你需要到qmake目录去清理一下;编译成功后, 默认安装目录是/usr/local/Trolltech/QtEmbedded-4.5.3-mips,可在configure时加-prefix参数 修改之.
root@ubuntu :/opt/qte453# ./configure -embedded mips -xplatform qws/linux-mips-g++ -little-endian -host-little-endian
Which edition of Qt do you want to use ?
Type 'c' if you want to use the Commercial Edition.
Type 'o' if you want to use the Open Source Edition.
o
This is the Qt for Embedded Linux Open Source Edition.
You are licensed to use this software under the terms of
the Lesser GNU General Public License (LGPL) versions 2.1.
You are also licensed to use this software under the terms of
the GNU General Public License (GPL) versions 3.
Type '3' to view the GNU General Public License version 3.
Type 'L' to view the Lesser GNU General Public License version 2.1.
Type 'yes' to accept this license offer.
Type 'no' to decline this license offer.
Do you accept the terms of either license? yes
Creating qmake. Please wait...
g++ -c -o project.o -pipe -DQMAKE_OPENSOURCE_EDITION -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -I/opt/qte453/include -I/opt/qte453/include/QtCore -I/opt/qte453/src/corelib/global -I/opt/qte453/src/script -DQT_NO_PCRE -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL -DQT_NO_COMPRESS -I/opt/qte453/mkspecs/qws/linux-x86-g++ -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT project.cpp
....
class.o qscriptclasspropertyiterator.o qscriptengineagent.o qscriptcontextinfo.o qscriptstring.o
Building on: qws/linux-x86-g++
Building for: qws/linux-mips-g++
Architecture: mips
Host architecture: i386
Build ............... libs examples demos docs translations
Configuration ....... cross_compile release shared dll embedded largefile stl precompile_header exceptions_off minimal-config small-config medium-config large-config full-config qt3support accessibility embedded reduce_exports ipv6 clock-gettime clock-monotonic mremap getaddrinfo ipv6ifname getifaddrs inotify system-jpeg system-mng system-png png system-tiff freetype system-zlib nis openssl svg webkit scripttools release
Debug ............... no
Qt 3 compatibility .. yes
QtDBus module ....... no
QtScriptTools module yes
QtXmlPatterns module no
Phonon module ....... no
SVG module .......... yes
WebKit module ....... yes
STL support ......... yes
PCH support ......... yes
MMX/3DNOW/SSE/SSE2.. no/no/no/no
IPv6 support ........ yes
IPv6 ifname support . yes
getaddrinfo support . yes
getifaddrs support .. yes
Accessibility ....... yes
NIS support ......... yes
CUPS support ........ no
Iconv support ....... no
Glib support ........ no
GStreamer support ... no
Large File support .. yes
GIF support ......... plugin
TIFF support ........ plugin (system)
JPEG support ........ plugin (system)
PNG support ......... yes (system)
MNG support ......... plugin (system)
zlib support ........ system
Session management .. no
Embedded support .... mips
Freetype2 support ... auto (yes)
Graphics (qt) ....... linuxfb multiscreen
Graphics (plugin) ...
Decorations (qt) .... styled windows default
Decorations (plugin)
Keyboard driver (qt). tty
Keyboard driver (plugin)
Mouse driver (qt) ... pc linuxtp
Mouse driver (plugin)
OpenGL support ...... no
SQLite support ...... plugin (qt)
OpenSSL support ..... yes (run-time)
Finding project files. Please wait...
Reading /opt/qte453/src/tools/bootstrap/bootstrap.pro
Reading /opt/qte453/src/tools/moc/moc.pro
Reading /opt/qte453/src/tools/rcc/rcc.pro
Reading /opt/qte453/src/tools/uic/uic.pro
Reading /opt/qte453/src/corelib/corelib.pro
Reading /opt/qte453/src/xml/xml.pro
Reading /opt/qte453/src/network/network.pro
Reading /opt/qte453/src/gui/gui.pro
Reading /opt/qte453/src/sql/sql.pro
...
for /opt/qte453/examples/widgets/icons/icons.pro
for /opt/qte453/examples/widgets/codeeditor/codeeditor.pro
for /opt/qte453/examples/widgets/styles/styles.pro
for /opt/qte453/examples/widgets/calendarwidget/calendarwidget.pro
for /opt/qte453/examples/widgets/digitalclock/digitalclock.pro
for /opt/qte453/examples/widgets/windowflags/windowflags.pro
for /opt/qte453/examples/phonon/capabilities/capabilities.pro
for /opt/qte453/examples/phonon/musicplayer/musicplayer.pro
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /usr/local/Trolltech/QtEmbedded-4.5.3-mips
To reconfigure, run 'make confclean' and 'configure'.
root@ubuntu :/opt/qte453#
反正后面是一大堆日志了,大概好几分钟后完成,这时Makefile已经创建好了,可以执行make进行编译了,这个需要时间更久,大概要大半小时。
root@ubuntu :/opt/qte453# make
cd src/tools/bootstrap/ && make -f Makefile
make[1]: Entering directory `/opt/qte453/src/tools/bootstrap'
g++ -c -pipe -fno-exceptions -O2 -fPIC -Wall -W -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_GEOM_VARIANT -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_STL -DQT_NO_SYSTEMLOCALE -DQT_NO_TEXTSTREAM -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../../mkspecs/qws/linux-x86-g++ -I. -I../../../include -I../../../include/QtCore -I../../../include/QtXml -o .obj/release-static-emb-mips/qisciicodec.o ../../corelib/codecs/qisciicodec.cpp
g++ -c -pipe -fno-exceptions -O2 -fPIC -Wall -W -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_GEOM_VARIANT -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_STL -DQT_NO_SYSTEMLOCALE -DQT_NO_TEXTSTREAM -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../../mkspecs/qws/linux-x86-g++ -I. -I../../../include -I../../../include/QtCore -I../../../include/QtXml -o .obj/release-static-emb-mips/qlatincodec.o ../../corelib/codecs/qlatincodec.cpp
...
过了一会,失败了,提示找不到zlib.h,是因为没安装zlib,装一下,重新make:
root@ubuntu :/opt/qte453# apt-get install zlib1g-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
ssl-cert
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
zlib1g-dev
0 upgraded, 1 newly installed, 0 to remove and 54 not upgraded.
Need to get 163kB of archives.
After this operation, 385kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com karmic/main zlib1g-dev 1:1.2.3.3.dfsg-13ubuntu3 [163kB]
Fetched 163kB in 5s (30.0kB/s)
Selecting previously deselected package zlib1g-dev.
(Reading database ... 42824 files and directories currently installed.)
Unpacking zlib1g-dev (from .../zlib1g-dev_1%3a1.2.3.3.dfsg-13ubuntu3_i386.deb) ...
Processing triggers for man-db ...
Setting up zlib1g-dev (1:1.2.3.3.dfsg-13ubuntu3) ...
root@ubuntu :/opt/qte453# make
...
漫长的等待后,make完成,可以执行安装:
root@ubuntu :/opt/qte453# make install
...
一行行字幕飞过,很快安装完成。
由于我们的开发板根目录是在/nfsroot/root-jz-20090216/,因此其实需要安装到/nfsroot/root-jz-20090216/usr/local/Trolltech/QtEmbedded-4.5.3-mips下:
root@ubuntu :/opt/qte453# cd /
root@ubuntu :/# mkdir -p /nfsroot/root-jz-20090216/usr/local/Trolltech
root@ubuntu :/# cd /nfsroot/root-jz-20090216/usr/local/Trolltech/
root@ubuntu :/nfsroot/root-jz-20090216/usr/local/Trolltech# cp /usr/local/Trolltech/QtEmbedded-4.5.3-mips . -r
root@ubuntu :/nfsroot/root-jz-20090216/usr/local/Trolltech# cd /
root@ubuntu :/#
这时,我们可以写一个QT的helloworld来测试一下:
root@ubuntu :/# cd ~
root@ubuntu :~# mkdir qthello
root@ubuntu :~# cd qthello/
root@ubuntu :~/qthello# vi qthello.cpp
输入以下内容,保存退出:
#include <QApplication>
#include <QLabel>
#include <QFont>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello Qt on JZ4750!");
label->setFont(QFont("Times",36,QFont::Bold));
label->show();
int res=app.exec();
delete label;
return res;
}
注意要有设置字体的代码,不然的话运行起来会很小,基本上要用放大镜才能看见。
然后进行编译链接:
root@ubuntu :~/qthello# /usr/local/Trolltech/QtEmbedded-4.5.3-mips/bin/qmake -v
QMake version 2.01a
Using Qt version 4.5.3 in /usr/local/Trolltech/QtEmbedded-4.5.3-mips/lib
root@ubuntu :~/qthello# /usr/local/Trolltech/QtEmbedded-4.5.3-mips/bin/qmake -project
root@ubuntu :~/qthello# /usr/local/Trolltech/QtEmbedded-4.5.3-mips/bin/qmake
root@ubuntu :~/qthello# ls
Makefile qthello.cpp qthello.pro
root@ubuntu :~/qthello# make
mipsel-linux-g++ -c -pipe -mips32 -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/QtEmbedded-4.5.3-mips/mkspecs/qws/linux-mips-g++ -I. -I/usr/local/Trolltech/QtEmbedded-4.5.3-mips/include/QtCore -I/usr/local/Trolltech/QtEmbedded-4.5.3-mips/include/QtNetwork -I/usr/local/Trolltech/QtEmbedded-4.5.3-mips/include/QtGui -I/usr/local/Trolltech/QtEmbedded-4.5.3-mips/include -I. -I. -o qthello.o qthello.cpp
mipsel-linux-g++ -Wl,-O1 -Wl,-rpath,/usr/local/Trolltech/QtEmbedded-4.5.3-mips/lib -o qthello qthello.o -L/usr/local/Trolltech/QtEmbedded-4.5.3-mips/lib -lQtGui -L/usr/local/Trolltech/QtEmbedded-4.5.3-mips/lib -lpng -lQtNetwork -lQtCore -lz -lm -lrt -ldl -lpthread
root@ubuntu :~/qthello# ls
Makefile qthello qthello.cpp qthello.o qthello.pro
root@ubuntu :~/qthello#
完成后,将编译的结果程序复制到开发板NFS根目录:
root@ubuntu :~/qthello# cp qthello /nfsroot/root-jz-20090216/
root@ubuntu :~/qthello#
然后在开发板COM终端上直接输入以下命令运行:
[email protected]:/# /qthello -qws
运行成功,大概过几十秒就应该能看到界面了(QT编译的东西太多,速度不是一般的慢)。
接下来说一下TSLIB和QT VS2008的配置(理论上应该先编译TSLIB再编译QT)。这两个在网上也有很多资料介绍了,没什么特别的。
解压编译TSLIB(需要先安装autoconf和libtool,apt-get install autoconf libtool):
root@ubuntu :/opt# ls /mnt
qt-embedded-linux-opensource-src-4.5.3.tar.gz qt-x11-opensource-src-4.5.3.tar.gz
qt-extended-opensource-src-4.4.2.tar.gz tslib-1.4.tar.gz
root@ubuntu :/opt# tar -xf /mnt/tslib-1.4.tar.gz
root@ubuntu :/opt# ls
hello hello.c linux-2.6.24.3 mipseltools-gcc412-glibc261 qte453 tslib u-boot-1.1.6
root@ubuntu :/opt# cd tslib
root@ubuntu :/opt/tslib# ls
acinclude.m4 autogen.sh COPYING INSTALL NEWS src
AUTHORS ChangeLog CVS m4 plugins tests
autogen-clean.sh configure.ac etc Makefile.am README tslib.pc.in
root@ubuntu :/opt/tslib# export PATH=/opt/mipseltools-gcc412-glibc261/bin:$PATH
root@ubuntu :/opt/tslib# export LD_LIBRARY_PATH=/opt/mipseltools-gcc412-glibc261/lib
root@ubuntu :/opt/tslib# ./autogen.sh
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./config.guess'
libtoolize: copying file `./config.sub'
libtoolize: copying file `./install-sh'
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in `m4/internal'.
libtoolize: copying file `m4/internal/libtool.m4'
libtoolize: copying file `m4/internal/ltoptions.m4'
libtoolize: copying file `m4/internal/ltsugar.m4'
libtoolize: copying file `m4/internal/ltversion.m4'
libtoolize: copying file `m4/internal/lt~obsolete.m4'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
configure.ac:7: installing `./missing'
plugins/Makefile.am: installing `./depcomp'
root@ubuntu :/opt/tslib# ./configure --host=mipsel-linux --prefix=/opt/tsemb --enable-static
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for mipsel-linux-strip... mipsel-linux-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for mipsel-linux-g++... mipsel-linux-g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... yes
...
config.status: creating tslib-0.0.pc
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
root@ubuntu :/opt/tslib#
接下来需要修改一下config.h,去掉rpl_malloc:
root@ubuntu :/opt/tslib# vi config.h
/* Define to rpl_malloc if the replacement function should be used. */
/*#define malloc rpl_malloc //removed by huz*/
#undef rpl_malloc
然后开MAKE:
root@ubuntu :/opt/tslib# make
make all-recursive
make[1]: Entering directory `/opt/tslib'
Making all in etc
make[2]: Entering directory `/opt/tslib/etc'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/opt/tslib/etc'
Making all in src
make[2]: Entering directory `/opt/tslib/src'
/bin/bash ../libtool --tag=CC --mode=compile mipsel-linux-gcc -DHAVE_CONFIG_H -I. -I.. -DPLUGIN_DIR=/"/opt/tsemb/lib/ts//" -DTS_CONF=/"/opt/tsemb/etc/ts.conf/" -DTSLIB_INTERNAL -fvisibility=hidden -DGCC_HASCLASSVISIBILITY -O2 -Wall -W -MT ts_attach.lo -MD -MP -MF .deps/ts_attach.Tpo -c -o ts_attach.lo ts_attach.c
libtool: compile: mipsel-linux-gcc -DHAVE_CONFIG_H -I. -I.. -DPLUGIN_DIR=/"/opt/tsemb/lib/ts//" -DTS_CONF=/"/opt/tsemb/etc/ts.conf/" -DTSLIB_INTERNAL -fvisibility=hidden -DGCC_HASCLASSVISIBILITY -O2 -Wall -W -MT ts_attach.lo -MD -MP -MF .deps/ts_attach.Tpo -c ts_attach.c -fPIC -DPIC -o .libs/ts_attach.o
libtool: compile: mipsel-linux-gcc -DHAVE_CONFIG_H -I. -I.. -DPLUGIN_DIR=/"/opt/tsemb/lib/ts//" -DTS_CONF=/"/opt/tsemb/etc/ts.conf/" -DTSLIB_INTERNAL -fvisibility=hidden -DGCC_HASCLASSVISIBILITY -O2 -Wall -W -MT ts_attach.lo -MD -MP -MF .deps/ts_attach.Tpo -c ts_attach.c -o ts_attach.o >/dev/null 2>&1
mv -f .deps/ts_attach.Tpo .deps/ts_attach.Plo
/bin/bash ../libtool --tag=CC --mode=compile mipsel-linux-gcc -DHAVE_CONFIG_H -I. -I.. -DPLUGIN_DIR=/"/opt/tsemb/lib/ts//" -DTS_CONF=/"/opt/tsemb/etc/ts.conf/" -DTSLIB_INTERNAL -fvisibility=hidden -DGCC_HASCLASSVISIBILITY -O2 -Wall -W -MT ts_close.lo -MD -MP -MF .deps/ts_close.Tpo -c -o ts_close.lo ts_close.c
libtool: compile: mipsel-linux-gcc -DHAVE_CONFIG_H -I. -I.. -DPLUGIN_DIR=/"/opt/tsemb/lib/ts//" -DTS_CONF=/"/opt/tsemb/etc/ts.conf/" -DTSLIB_INTERNAL -fvisibility=hidden -DGCC_HASCLASSVISIBILITY -O2 -Wall -W -MT ts_close.lo -MD -MP -MF .deps/ts_close.Tpo -c ts_close.c -fPIC -DPIC -o .libs/ts_close.o
libtool: compile: mipsel-linux-gcc -DHAVE_CONFIG_H -I. -I.. -DPLUGIN_DIR=/"/opt/tsemb/lib/ts//" -DTS_CONF=/"/opt/tsemb/etc/ts.conf/" -DTSLIB_INTERNAL -fvisibility=hidden -DGCC_HASCLASSVISIBILITY -O2 -Wall -W -MT ts_close.lo -MD -MP -MF .deps/ts_close.Tpo -c ts_close.c -o ts_close.o >/dev/null 2>&1
mv -f .deps/ts_close.Tpo .deps/ts_close.Plo
...
libtool: link: mipsel-linux-gcc -DGCC_HASCLASSVISIBILITY -O2 -Wall -W -o .libs/ts_harvest ts_harvest.o fbutils.o testutils.o font_8x8.o font_8x16.o ../src/.libs/libts.so -ldl -Wl,-rpath -Wl,/opt/tsemb/lib
make[2]: Leaving directory `/opt/tslib/tests'
make[2]: Entering directory `/opt/tslib'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/opt/tslib'
make[1]: Leaving directory `/opt/tslib'
root@ubuntu :/opt/tslib# make install
我这个配置是安装在/opt/tsemb下,使用时应把所有文件COPY到开发板相应目录:
root@ubuntu :/opt/tslib# cd /opt/tsemb/
root@ubuntu :/opt/tsemb# ls
bin etc include lib
root@ubuntu :/opt/tsemb# mkdir -p /nfsroot/root-jz-20090216/opt/tsemb
root@ubuntu :/opt/tsemb# cp . /nfsroot/root-jz-20090216/opt/tsemb/ -r
root@ubuntu :/opt/tsemb#
然后在开发板COM终端上运行/opt/tsemb/bin里的ts_calibrate程序进行校准测试,并修改/etc/profile.d /tslib.sh以改正环境变量(TSLIB_ROOT=/opt/tsemb,export QWS_MOUSE_PROTO=tslib:/dev/ts),具体不细述了。
QTE要使用同一个TSLIB的话,需要重新配置编译,在configure时加参数:-qt-mouse-tslib -I/opt/tsemb/include -L/opt/tsemb/lib。所以我前面说理论上应先编译TSLIB较好。
而至于WINDOWS下VS2008的QT安装就容易很多了,下载了qt-win-opensource-4.6.1-vs2008.exe和 qt-vs-addin-1.1.3.exe,直接双击运行安装,完成后在VS2008里会多一个QT菜单,执行Qt/QtOptions设置添加一下 QT 4.6.1的安装路径即可,新建VS项目的窗口中会多出 一项Qt4 Projects。也可以执行Qt/Open Qt project file(*.pro)打开QT格式的项目并转换为VC项目。新建项的窗口中也会多出Qt Forms和Qt Resources。双击UI文件的话会调用QtCreator的设计界面。代码在VS2008里编写调试通过后,复制到Linux主机上进行交叉编译即 可发布到开发板上使用。
如果VC的代码自动完成提示功能不可用,可尝试以下办法:在 工具|选项|项目和解决方案|VC++目录|Win32|包含文件 中添加QT的INCLUDE目录然后重启VC;UI文件修改后要重新编译一次;把工程下的NCB文件删除再重新编译工程。
另外有一个不需要VS2008的独立版本,跟LINUX下的QtCreator是一模一样的,兼容性会更好一些。
至此基本上君正4750开发板的整个开发环境已基本搭建完成。