QT ARM开发平台 学习入门是本文要介绍的内容,Qt-Embedded 4 install。
1、安装Qt-Embedded-linux
安装Qt-Embedded-linux有两种方法,一种是从源码安装,一种是直接安装。
如果不需要在PC机上进行Qt-Embedded程序调试,可以不需要安装Qt-x11和Qt-Embedded for x86
(1) 源码安装首先从 ftp://ftp.trolltech.com/qt/source/ 下载以下源码包:
- qt-x11-opensource-src-4.5.0.tar qt-embedded-linux-opensource-src-4.5.0.tar
安装Qt-x11
- # tar jxvf qt-x11-opensource-src-4.5.0.tar
- # cd qt-x11-opensource-src-4.5.0
- # echo "yes" | ./configure –qvfb –no-openssl –no-webkit
- # make && make install
安装Qt-Embedded for x86
- # tar jxvf qt-embedded-linux-opensource-src-4.5.0.tar
- # cd qt-embedded-linux-opensource-src-4.5.0
- # echo "yes" | ./configure \ -release \ -shared \ -no-qt3support \ -no-xmlpatterns \ -no-svg \ -no-webkit \ -system-zlib \ -qt-gif \
- -system-libtiff \ -system-libpng \ -qt-libmng \ -system-libjpeg \ -make libs \ -make tools \ -nomake examples \ -nomake docs \
- -nomake demo \ -no-nis \ -no-cups \ -no-iconv \ -no-dbus \ -no-openssl \ -xplatform qws/linux-x86-g++ \ -embedded x86 \ -qt-freetype \
- -depths 16,18 \ -qt-gfx-qvfb \ -no-gfx-transformed \ -no-gfx-multiscreen \ -no-gfx-vnc \ -no-gfx-linuxfb \ -qt-kbd-tty \ -qt-kbd-usb \
- -qt-kbd-qvfb \ -qt-mouse-pc \ -qt-mouse-qvfb \ -no-glib \ -silent
- # make && make install
安装Qt-Embedded for ARM
- # tar jxvf qt-embedded-linux-opensource-src-4.5.0.tar
- # cd qt-embedded-linux-opensource-src-4.5.0
- # echo "yes" | ./configure \ -release \ -shared \ -no-qt3support \ -no-xmlpatterns \ -no-svg \ -no-webkit \ -system-zlib \ -qt-gif \
- -system-libtiff \ -system-libpng \ -qt-libmng \ -system-libjpeg \ -make libs \ -make tools \ -nomake examples \ -nomake docs \ -nomake demo \
- -no-nis \ -no-cups \ -no-iconv \ -no-dbus \ -no-openssl \ -xplatform qws/linux-arm-g++ \ -embedded arm \ -little-endian \ -qt-freetype \
- -depths 16,18 \ -qt-gfx-linuxfb \ -no-gfx-transformed \ -no-gfx-multiscreen \ -no-gfx-vnc \ -no-gfx-qvfb \ -qt-kbd-tty \ -qt-kbd-usb \
- -qt-mouse-tslib \ -qt-mouse-pc \ -no-glib \ -silent
- # make && make install
2.设置环境变量,例如:
仅当前用户有效(其他用户无效):
修改$HOME/.bash_profile,加入:
- PATH=/usr/local/Trolltech/Qt-4.3.5/bin:$PATH
所有用户有效(包括root和普通用户):
修改/etc/profile,加入以下两行(一般在最后一行添加):
- export PATH=/usr/local/Trolltech/Qt-4.5.0/bin:$PATH
2、程序调试和帮助 在PC机上调试Qt-Embedded程序的方法为,使用Qt-Embedded for x86的Qt库来编译Qt-Embedded程序,然后使用Qt-x11的qvfb工具仿真调试。下面以demo程序为例:
- # tar jxvf demo.tar.bz2
- # cd demo
- # /usr/local/Trolltech/QtEmbedded-4.5.0/bin/qmake -project
- # /usr/local/Trolltech/QtEmbedded-4.5.0/bin/qmake
- # make # /usr/local/Trolltech/Qt-4.5.0/bin/qvfb
- & # ./demo -qws
运行以下程序可以查看Qt编程,调试,应用,布署等各方面的帮助。 # /usr/local/Trolltech/Qt-4.5.0/bin/assistant
3、将Qt-Embedded程序运行在目标板上 用Qt-Embedded for ARM编译Qt-Embedded应用程序,以demo为例:
- # tar jxvf demo.tar.bz2
- # cd demo
- # /opt/Trolltech/QtEmbedded-4.5.0/bin/qmake -project
- # /opt/Trolltech/QtEmbedded-4.5.0/bin/qmake
- # make
- 将demo程序下载到目标板上,然后就可以运行demo程序。在运行程序前以下环境变量必须已经设置。
- export QTDIR=/opt/QtEmbedded-4.5.0
- export PATH=$QTDIR/bin:$PATH
- export QWS_DISPLAY=LinuxFb:/dev/fb0
- export QWS_SIZE=640x480
- export QWS_SW_CURSOR=1
- export QWS_MOUSE_PROTO=Tslib:/dev/ep93xx_ts
- export QWS_KEYBOARD=TTY:/dev/ttyS0
- export QT_ONSCREEN_PAINT=0
- export PONTERCAL_FILE=/etc/pointercal
- export LD_LIBRARY_PATH=$QTDIR/lib:/lib:/usr/lib:$LD_LIBRARY_PATH
- export TSLIB_TSDEVICE=/dev/ep93xx_ts
- export TSLIB_CALIBFILE=/etc/pointercal
- export TSLIB_CONFFILE=/etc/ts.conf
- export TSLIB_PLUGINDIR=/lib/ts
- export TSLIB_CONSOLEDEVICE=/dev/tty
- export TSLIB_FBDEVICE=/dev/fb0
小结:浅谈 QT ARM开发平台 学习入门的内容介绍完了,希望本文能读你有所帮助。更多相关内容,请参考编辑推荐。