Qt4.7.0触摸屏(tslib 1.4)移植到OMAP3530全记录

主机系统:ubuntu 9.10

交叉编译器:arm-none-linux-gnueabi

          gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203)

软件资源:arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

          qt-everywhere-opensource-src-4.7.0.tar.gz

          tslib-1.4.tar.gz

目标板:英码OMAP3530

1 构建交叉编译器

(1)在/usr/local/目录下面创建文件夹arm

#mkdir /usr/local/arm

(2)arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 到/home/ema/tool

#cp arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 /home/ema/tool

(3)解压到/usr/local/arm目录下

#tar jxvf arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 –C /usr/local/arm

(4)设置环境变量

#export PATH= /usr/local/arm/arm-2009q1/bin:$PATH

或者

#gedit /etc/environment

编辑为:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/arm-2009q1/bin"

(5)查看环境变量

#echo $PATH

2 编译tslib对触摸屏的支持

将tslib1.4.tar.gz 放在/root 下,解压并编译:

# cd /root
# tar zxvf tslib1.4.tar.gz
# cd tslib
# ./autogen.sh
# ./configure --prefix=/usr/local/tslib/ --host=arm-none-linux-gnueabi   ac_cv_func_malloc_0_nonnull=yes
# make
# make install

 

./autogen.sh
执行这条命令可能会报错,需要安装以下工具:
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install libtool
3 编译QtE4.7.0

Ubuntu中要安装X11的SDK库,Qtopia编译过程中需要使用里面的一些头文件。

#apt-get install libx11-dev libxext-dev libxtst-dev

将qt-everywhere-opensource-src-4.7.0.tar.gz压缩包放在/opt下,解压:

#cd /opt

#tar zxvf qt-everywhere-opensource-src-4.7.0.tar.gz

#mv qt-everywhere-opensource-src-4.7.0 qt-4.7.0-arm

#cd qt-4.7.0-arm

修改mkspecs/qws/linux-arm-g++/qmake.conf文件,替换所有arm-linux为arm-none-linux-gnueabi

./configure -prefix /usr/local/Trolltech/QtEmbedded-4.7.0-arm -opensource -confirm-license -release -shared -embedded arm -xplatform qws/linux-arm-g++ -depths 16,18,24 -fast -optimized-qmake -pch -qt-sql-sqlite -qt-libjpeg -qt-zlib -qt-libpng -qt-freetype -qt-mouse-pc -qt-mouse-linuxtp -qt-mouse-linuxinput -plugin-mouse-linuxtp -plugin-mouse-pc -little-endian -host-little-endian -no-qt3support -no-libtiff -no-libmng -no-mmx -no-sse -no-sse2 -no-3dnow -no-openssl -no-qvfb -no-nis -no-cups -no-glib -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-separate-debug-info -qt-mouse-tslib -I/usr/local/tslib/include -L/usr/local/tslib/lib

解释:-fast:快速编译,加此项不会生成中间文件,如果你确定你能一次编译通过的话可以加上,否则重新编译会浪费很多时间。

-qt-sql-sqlite:sqlite数据库选项,如果要编写的程序需要数据库就必须加上,或者使用插件的形式,但是两者只能选一个,否则编写的程序会出现加载不上驱动的现象。

注意:最后两个路径如果设置不对则生成的库文件没办法支持触摸屏

#make

#make install

4 移植OMAP3530
A.准备工作
在PC机上建立nfs服务,共享root目录,在OMAP3530板上mount。
B.建立目录
在OMAP3530板建立如下目录:
/usr/local/Trolltech/QtEmbedded-4.7.0-arm/bin
/usr/local/Trolltech/QtEmbedded-4.7.0-arm/lib/fonts
/tslib

C.复制字库文件
把PC机上/usr/local/Trolltech/QtEmbedded-4.7.0-arm/lib/fonts目录上所有字库文件CP到OMAP3530 /usr/local/Trolltech/QtEmbedded-4.7.0-arm/lib/fonts
D.复制运行库
在PC机上复制下列文件到OMAP3530上 /usr/local/Trolltech/QtEmbedded-4.7.0-arm/lib
libQtGui.so.4 libts-0.0.so.0 libQtCore.so.4 libQtNetwork.so.4
一般在PC机上/usr/local/Trolltech/QtEmbedded-4.7.0-arm/lib/和/tslib/上可以找到上述文件。复制时注意如果需要复制的文件是链接文件,则把被链接文件都要复制上。
E.复制触摸屏软件
复制PC机上/tslib/目录上全部文件(含子目录)到OMAP3530上/tslib目录
F.在开发板上建立环境变量。
修改开发板上/etc/profile文件,增加以下内容:
export QTDIR=/usr/local/Trolltech/QtEmbedded-4.7.0-arm
export T_ROOT=/tslib
export PATH=$QTDIR/bin:$PATH
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/touchscreen0
export TSLIB_PLUGINDIR=$T_ROOT/lib/ts
export TSLIB_CONFFILE=$T_ROOT/etc/ts.conf
export TSLIB_CALIBFILE=/etc/pointercal
export QWS_MOUSE_PROTO=tslib:/dev/input/touchscreen0
export QWS_KEYBOARD=tty:/dev/input/event1
 支持键盘
export QT_PLUGIN_PATH=$QTDIR/lib/plugins/ 支持jpeg png
export LD_LIBRARY_PATH=$T_ROOT/lib:$QTDIR/lib
修改OMAP3530上/tslib/etc/ts.conf文件:把第二行#module_raw input前面的#和空格去除,保存退出。
G.校准触摸屏
从新启动开发板,执行:
cd /
cd tslib/bin
./ts_calibrate 校准触摸屏
./ts_test 测试触摸屏
如果正常,QT4 Embedded 移植成功!
 
(1)如果出错:
/usr/local/arm/4.1.2/bin/../lib/gcc/arm-angstrom-linux-gnueabi/4.1.2/../../../../arm-angstrom-linux-gnueabi/bin/ld: warning: libts-0.0.so.0, needed by /home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/lib/libQtGui.so, not found (try using -rpath or -rpath-link)
/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/lib/libQtGui.so: undefined reference to `ts_read_raw'
/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/lib/libQtGui.so: undefined reference to `ts_open'
/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/lib/libQtGui.so: undefined reference to `ts_fd'
/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/lib/libQtGui.so: undefined reference to `ts_config'
/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/lib/libQtGui.so: undefined reference to `ts_close'
/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/lib/libQtGui.so: undefined reference to `ts_read'
collect2: ld returned 1 exit status
make[2]: *** [deform] Error 1
make[2]: Leaving directory `/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.7.0/demos/deform'
make[1]: *** [sub-deform-make_default] Error 2
make[1]: Leaving directory `/home/stillwater/4.1.2/qt-everywhere-opensource-src-4.6.0/demos'
make: *** [sub-demos-make_default-ordered] Error 2
解决办法:
修改qt-4.7.0/mkspecs/qws/linux-mips-g++/qmake.conf 文件( 添加lts参数):
QMAKE_CC                = arm-none-linux-gnueabi-gcc -lts(触摸屏的动态链接库)
QMAKE_CXX               = arm-none-linux-gnueabi-g++ -lts
QMAKE_LINK              = arm-none-linux-gnueabi-g++ -lts
QMAKE_LINK_SHLIB        = arm-none-linux-gnueabi-g++ -lts
(2)如果出现syntax error:“(” unexpected的错误,则需要按照上述的configure配置QTE。


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值