How to bind ti sitara sdk to your Qt Eommercial Edition -转自 大为的杂谈

---------------------------------------

prothes:在 大为的杂谈 上看到这个文章,刚好我在研究TI的A8,故而转来以备观瞻。。。

感谢 大卫。。。。

---------------------------------------

 

 

TI have provide the Industry Leading Coretex A8 product family, called Sitara.

And TI have provide a SDK for customer to develop application based on Sitara family.
The SDK includes:
1. Qt 4.6.2 SDK (Evaluation Edition, each package have a suffix E, libQtGuiE.so, libQtCoreE.so)
2. Code Composer Studio
3. A lot of demos, include the nice launch matrix_gui.
4. Platform support packages.

And CodeSourcery toolchain is a must to install the sdk.



But, maybe you are planing to develop a product with you own license but nor GPL3 neither LGPL.

And, maybe you've already have a customised or commercial edition toolchain.

Does it worth to take the risk to use Evaluation Edition Qt?
Does it worth to take an hour to download CodeSourcery toolchain and use it? (Code generated with my own toolchain runs 15% faster than with CodeSourcery one.)



By here, I think you are just think about to Integrate TI SDK with your own toolchain and you Qt Commercial license.

Here I'll show you how to do it.  Note that all armv7a-isunriver-linux- below should be replaced with your toolchain's prefix.


Prerequisites:
     1. Optimized GCC toolchain.   What I customized have a prefix armv7a-isunriver-linux-.
     2. TI ti-sdk-am37x-evm-4.0.1.0 for AM3715 or the proper one for your hardware.
     3. Ubuntu desktop edition ver 10.04
     4. DBus source code pack.  My choice is dbus-1.4.6.
     5. expat source code pack. My choice is expat-2.0.1
     6. zlib source code pack.  My choice is zlib-1.2.5
     7. tslib http://prdownload.berlios.de/tslib/tslib-1.0.tar.bz2

A. Basic preparement:
     1.  Ubuntu 10.04 installation.  Download the cd image from http://www.ubuntu.com/desktop/get-ubuntu/download.
    Burn it to a cdrom, the boot the computer that you want to install ti sdk with this cd and install follow the wizard.
    
     2. Install development support packages for ubuntu.
    $ sudo apt-get install build-essential libncurses-dev flex bison autoconf automake libmpfr-dev texinfo nfs-kernel-server tftpd-hpa libcloog-ppl

        If you are runing a ubuntu X86_64 edition, you should also install ia32-libs libc6-dev-i386. Otherwise ti-sdk-am37x-evem-4.0.1.0 want work.

     3. Install your toolchain according to the guide. Set the environment variable PATH to include your toolchain. Create a link or fake named arm-none-linux-gnueabi-gcc to make ti-sdk happy.
    <in your toolchain bin dir>$ ln -s armv7a-isunriver-linux-gcc arm-none-linux-gnueabi-gcc.

     4. Install ti-sdk. When it ask you where the CodeSourcery located, please show the sdk the path of the fake arm-none-linux-gnueabi-gcc.

 
B. Create the basic target filesystem and prepare NFS server:
     There is a base-rootfs-am37x-evm.tar.gz  within a subpath ti-sdk-am37x-evm-4.0.1.0/filesystem to ti-sdk installation location.
     Extract it to a folder suchas /opt/arma8fs. Then export this path as a nfs location.

    $ sudo echo "/opt/arma8fs  *(rw,sync,no_root_squash,no_all_squash,no_subtree_check)" >> /etc/exports
    $ sudo exportfs -a
    $ sudo service nfs-kernel-server restart

C. Build the kernel under ti-sdk-am37x-evm-4.0.1.0/psp/linux-2.6.32-psp03.00.01.06.sdk, and prepare TFTP server
    $ make ARCH=arm CROSS_COMPILE=armv7a-isunriver-linux- omap3_evm_defconfig
    $ make ARCH=arm CROSS_COMPILE=armv7a-isunriver-linux- uImage modules
    $ make ARCH=arm CROSS_COMPILE=armv7a-isunriver-linux- modules_install INSTALL_MOD_PATH=/opt/arma8fs
    $ cp arch/arm/boot/uImage /var/lib/tftpboot

D. start your target to have a test of your NFS and TFTP server to see if the basic filesystem is ready.

E. Commercial Qt Integration.
   1.  zlib-1.2.5. TI have already provide a zlib within the baisc filesystem. But for some performance reason I decide to upgrade it.
        $ rm /opt/arma8fs/usr/lib/libz*
        $ CC=armv7a-isunriver-linux-gcc --prefix=/usr
        $ make && make install DESTDIR=/opt/qtsdkdir/misc

   2.  expat.  The example matrix need QtDBus. To build QtDBus, you have to build DBus. To build dbus, expat is a necessary.
        $ PKG_CONFIG_ALLOW_SYSTEM_LIBS=yes PKG_CONFIG_SYSROOT_DIR=/opt/qtsdkdir/misc PKG_CONFIG_PATH=/opt/qtsdkdir/misc/usr/lib/pkgconfig ./configure --host=armv7a-isunriver-linux --prefix=/usr --enable-shared --disable-static --sysconfdir=/etc --localstatedir=/var
        $ make && make install DESTDIR=/opt/qtsdk_dir

   3.  DBus.  It's a must for new matrix demo.
        $ ac_cv_lib_expat_XML_ParserCreate_MM=yes PKG_CONFIG_ALLOW_SYSTEM_LIBS=yes PKG_CONFIG_SYSROOT_DIR=/opt/qtsdkdir/misc PKG_CONFIG_PATH=/opt/qtsdkdir/misc/usr/lib/pkgconfig ./configure --host=armv7a-isunriver-linux --prefix=/usr --enable-shared --disable-static --sysconfdir=/etc --localstatedir=/var --with-xml=expat --with-x=no
       It is very important to provide a --with-x=no as we don't need and have no x backend. Otherwise DBus will show you error like below even the dbus guy said it should works.
        error: ... ... ... dbus FD_ZERO impossible constraint in 'asm'

        $ make && make install DESTDIR=/opt/qtsdkdir/misc
       If you met error the file format of /usr/lib/libexpat.so not recognized, don't worry that's just because the configure script of DBUS is not 100% ready for cross compile. Please modify file bus/Makefile to make DBUS_BUS_LIBS and DBUS_LAUNCHER_LIBS look like:
                DBUS_BUS_LIBS = /home/user/tslib_sdk/usr/lib/libexpat.so -lpthread -lrt
                DBUS_LAUNCHER_LIBS = /home/user/tslib_sdk/usr/lib/libexpat.so -lpthread -lrt
      
       Even as we've disable the x before, DBus is still trying to compile tools/dbus-launch-x11.c. Just pushd "#undef DBUS_BUILD_X11" at the begining of the tools/dbus-launch-x11.c to ask it to shut up.
       Make it again, it should be ok now.

   4. tslib. TI have provide one but you will have to take some time to have it easy to be used when you try to configure Qt. I'd rather to replace it than to waste to make trick.
       $ rm /opt/arma8fs/usr/lib/libts*
       $ ./configure --prefix=/usr --sysconfdir=/etc --host=arm-linux-gnu.
       $ make  && make install DESTDIR=/opt/qtsdkdir/misc

      Edit the file config.h and comment the line "#define malloc rpl_malloc" to avoid this option:"#define malloc rpl_malloc" -> "//#define malloc rpl_malloc". * AC_FUNC_MALLOC in configure.ac seems to cause malloc to be defined to rpl_malloc, which is never implemented and therefore cause a link error.Removing this line from AC_FUNC_MALLOC is a workaround i got after browsing net.

        $ echo "export TSLIB_TSDEVICE=/dev/input/touchscreen0" >> /opt/arma8fs/etc/profile
        $ echo "export TSLIB_CONFFILE=/etc/ts.conf" >> /opt/arma8fs/etc/profile


   5. TI's Graphics SDK.
    Modify the Rules.make. Make it looks like below

        #Rules.make

        ################# FIELDS MODIFIABLE BY THE USER ###############################
        ############### All the fields below are mandatory ############################
        # Set home area (ex /home/user123/)
        #HOME=$(HOME)

        # Set installation folder (typically, OMAP35x_Graphics_***)
        GRAPHICS_INSTALL_DIR=$(HOME)/Graphics_SDK_4_00_00_01

        # Location of demo executables and install information
        GFX_DEMOS_EXECPATH=$(GRAPHICS_INSTALL_DIR)/gfxsdkdemos

        # Toolchain path
        CSTOOL_DIR=/opt/armv7a-isunriver-linux
        CSTOOL_PREFIX=armv7a-isunriver-linux-
        CSTOOL_PATH=$(CSTOOL_DIR)/bin
        CSTOOL_LIBSTDC++_PATH=$(CSTOOL_DIR)/armv7a-isunriver-linux-gnueabi/lib

        # Set the kernel installation path
        KERNEL_INSTALL_DIR=$(HOME)/ti-sdk-am37x-evm-4.0.1.0/psp/linux-2.6.32-psp03.00.01.06.sdk

        # Target NFS root file system location
        #TARGETFS_INSTALL_DIR=/avme_nfs_root/users/mahesh/targetfs
        TARGETFS_INSTALL_DIR=/opt/arma8fs

        ######################### PRE-DEFINED VARIABLES ###############################
        ######################## NOT MODIFIABLE BY USER ###############################

        PLATFORM=LinuxOMAP3

        GFX_OGLES_SDKPATH=$(GRAPHICS_INSTALL_DIR)/GFX_Linux_SDK/OGLES/SDKPackage

        GFX_OGLES2_SDKPATH=$(GRAPHICS_INSTALL_DIR)/GFX_Linux_SDK/OGLES2/SDKPackage

        GFX_OVG_SDKPATH=$(GRAPHICS_INSTALL_DIR)/GFX_Linux_SDK/OVG/SDKPackage

        GFX_REL_ES2_LIB_SRCPATH=$(GRAPHICS_INSTALL_DIR)/gfx_rel_es2.x

        GFX_DBG_ES2_LIB_SRCPATH=$(GRAPHICS_INSTALL_DIR)/gfx_dbg_es2.x

        GFX_REL_ES3_LIB_SRCPATH=$(GRAPHICS_INSTALL_DIR)/gfx_rel_es3.x

        GFX_DBG_ES3_LIB_SRCPATH=$(GRAPHICS_INSTALL_DIR)/gfx_dbg_es3.x

        GFX_REL_ES5_LIB_SRCPATH=$(GRAPHICS_INSTALL_DIR)/gfx_rel_es5.x

        GFX_DBG_ES5_LIB_SRCPATH=$(GRAPHICS_INSTALL_DIR)/gfx_dbg_es5.x

        GFX_REL_ES6_LIB_SRCPATH=$(GRAPHICS_INSTALL_DIR)/gfx_rel_es6.x
       
        GFX_DBG_ES6_LIB_SRCPATH=$(GRAPHICS_INSTALL_DIR)/gfx_dbg_es6.x
       
        GFX_OGLES_REL_LIB_DESTPATH=$(GFX_OGLES_SDKPATH)/Builds/OGLES/LinuxOMAP3
   
        GFX_OGLES2_REL_LIB_DESTPATH=$(GFX_OGLES2_SDKPATH)/Builds/OGLES2/LinuxOMAP3
       
        GFX_OVG_REL_LIB_DESTPATH=$(GFX_OVG_SDKPATH)/Builds/OVG/LinuxOMAP3

        GFX_KERNMOD_SRCPATH=$(GRAPHICS_INSTALL_DIR)/GFX_Linux_KM

        GFX_PKG_TARGETFS_PATH = $(GRAPHICS_INSTALL_DIR)/targetfs

        GFX_LIBRARY_TARGET_PATH = $(TARGETFS_INSTALL_DIR)/opt/gfxlibraries

        GFX_DEVMEM2_SRCPATH = $(GRAPHICS_INSTALL_DIR)/tools/devmem2

        # Where to copy the resulting executables and data to (when executing 'make
        # install') in a proper file structure. This EXEC_DIR should either be visible
        # from the target, or you will have to copy this (whole) directory onto the
        # target filesystem.
        EXEC_DIR=$(TARGETFS_INSTALL_DIR)/opt/gfxsdkdemos
        ################################################################################

          $ make OMAPES=5.x
          $ make install   

          boot up the target via nfs. And run install.sh from the dir /opt/gfxlibraries/gfx_rel_es5.x/ on target to finished the GraphicSDK integration.

    6. Qt 4.7.1

          $ pushd mkspecs/qws
          $ cp -av linux-arm-gnueabi-g++ linux-TIarmv7-g++
         Then modify the qmake.conf within linux-TIarmv7-g++ and make it looks like below.

        #
        # qmake configuration for building with arm-linux-g++
        #
       
        CROSS_COMPILE=armv7a-isunriver-linux-

        include(../../common/g++.conf)
        include(../../common/linux.conf)
        include(../../common/qws.conf)

        # modifications to g++.conf
        QMAKE_CFLAGS_RELEASE    = -O3
        QMAKE_CXXFLAGS_RELEASE    = -O3
        QMAKE_CC                = armv7a-isunriver-linux-gcc
        QMAKE_CXX               = armv7a-isunriver-linux-g++
        QMAKE_LINK              = armv7a-isunriver-linux-g++
        QMAKE_LINK_SHLIB        = armv7a-isunriver-linux-g++

        #User specific Path - To Be edited by User
        #e.g
        SGX_SDK_ROOT    = /home/user/Graphics_SDK_4_00_00_01
        TSLIB_INCDIR    = /opt/qtsdkdir/misc/usr/include
        TSLIB_LIBDIR     = /opt/qtsdkdir/misc/usr/lib

        #Do not edit beyond this
        QT_INSTALL_DIR_TIBLT    = $$PWD/../../..

        QMAKE_INCDIR_OPENGL_ES2 = $$SGX_SDK_ROOT/GFX_Linux_SDK/OGLES2/SDKPackage/Builds/OGLES2/Include/
        QMAKE_INCDIR_OPENGL_ES2 += $$SGX_SDK_ROOT/include
        QMAKE_INCDIR_OPENGL_ES2 += $$SGX_SDK_ROOT/GFX_Linux_SDK/OGLES/SDKPackage/Builds/OGLES/Include/
        QMAKE_LIBDIR_OPENGL_ES2 = $$SGX_SDK_ROOT/gfx_rel_es5.x/
        QMAKE_LIBS_OPENGL_ES2 = -lEGL -lGLESv2 -lGLES_CM -lIMGegl -lsrv_um

        QMAKE_INCDIR_OPENGL += $$SGX_SDK_ROOT/GFX_Linux_SDK/OGLES/SDKPackage/Builds/OGLES/Include/
        QMAKE_LIBDIR_OPENGL = $$SGX_SDK_ROOT/gfx_rel_es5.x
        QMAKE_LIBDIR_OPENGL_QT = $$SGX_SDK_ROOT/gfx_rel_es5.x
        QMAKE_LIBS_OPENGL_ES1 = -lEGL -lGLES_CM -lIMGegl -lsrv_um

        QMAKE_INCDIR_OPENVG = $$SGX_SDK_ROOT/GFX_Linux_SDK/OVG/SDKPackage/Builds/OVG/Include/
        QMAKE_LIBDIR_OPENVG = $$SGX_SDK_ROOT/gfx_rel_es5.x/
        QMAKE_LIBS_OPENVG = -lEGL -lGLESv2 -lGLES_CM -lIMGegl -lsrv_um -lOpenVG -lOpenVGU

        QMAKE_INCDIR_EGL = $$QMAKE_INCDIR_OPENGL_ES2
        QMAKE_INCDIR_EGL += $$QT_INSTALL_DIR_TIBLT/src/3rdparty/powervr/
        QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2
        QMAKE_LIBS_EGL = -lEGL -lIMGegl -lsrv_um -lGLESv2 -lGLES_CM

        QMAKE_INCDIR += $$TSLIB_INCDIR
        QMAKE_INCDIR += $$QMAKE_INCDIR_OPENGL_ES2
        QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2
        QMAKE_LIBDIR += $$TSLIB_LIBDIR
        QMAKE_LIBS = $$QMAKE_LIBS_OPENGL_ES2

        # modifications to linux.conf
        QMAKE_AR                = armv7a-isunriver-linux-ar cqs
        QMAKE_OBJCOPY           = armv7a-isunriver-linux-objcopy
        QMAKE_STRIP             = armv7a-isunriver-linux-strip

        load(qt_config)

 

       $ popd
       $ PKG_CONFIG_ALLOW_SYSTEM_LIBS=yes PKG_CONFIG_SYSROOT_DIR=/opt/qtsdkdir/misc PKG_CONFIG_PATH=/opt/qtsdkdir/misc/usr/lib/pkgconfig ./configure -prefix /opt/qtsdksdkdir/Qt4.7.1-arm -embedded arm -commercial -platform qws/linux-x86_64-g++ -xplatform qws/linux-TIarmv7-g++ -qt-mouse-linuxinput -qt-mouse-tslib -plugin-mouse-tslib -plugin-kbd-linuxinput -plugin-gfx-linuxfb -opengl es2 -openvg -plugin-gfx-powervr -plugin-gfx-transformed -plugin-gfx-qvfb -qt-gfx-multiscreen -qt-freetype -depths 16,24,32 -optimized-qmake -qt-libjpeg -qt-libmng -qt-libpng -qt-libtiff -qt-zlib -qt-sql-sqlite -plugin-sql-sqlite -fast -no-rpath -no-qt3support -D QT_QWS_CLIENTBLIT -D QT_NO_QWS_CURSOR -dbus -force-pkg-config

       Now run make and tell the computer the SN that you've received from Nokia. When the make procedure started, go have some tea, coffee or just go shopping for about 1~2 hours.

       Very import to have -D QT_NO_QWS_CURSOR. Otherwise QT egl won't work.

     7. Final Integration
       $ cp -av /opt/qtsdkdir/misc/* /opt/arma8fs/
       $ cp -av /opt/qtsdkdir/Qt4.7.1-arm/* /opt/arma8fs/
       $ echo "export LD_LIBRARY_PATH='/opt/qtsdkdir/Qt4.7.1-arm/lib'" >> /opt/arma8fs/etc/profile
       $ echo "export QWS_DISPLAY='powervr'" >> /opt/arma8fs/etc/profile
       $ echo "export QWS_MOUSE_PROTO='Tslib:/dev/input/touchscreen0'" >> /opt/arma8fs/etc/profile

F. Replace the c library of the target filsystem to have 15% more performance.
       $ cp /opt/armv7a-isunriver-linux/target/* /opt/arma8fs

G. Build matrix and other demos with you new Commercial Qt sdk.
      Modify the Makefile.build of matrix_gui and make the target qmake looks as below.
           qmake : matrix_gui.pro
                   @. ${ENV_SETUP}; /
                   #qmake2 CONFIG+=debug_and_release QMAKE_CXXFLAGS_DEBUG+=-D${PLATFORM_DEFI ...  matrix_gui.pro
                /opt/qtsdkdir/Qt4.7.1-arm/bin/qmake -spec qws/linux-TIarmv7-g++ matrix_gui.pro


Now the Qt Commercial should work with TI SDK.

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值