ts-7000
[Top] [All Lists]

[ts-7000] QT Embedded on TS-TPC-7395

To:
Subject: [ts-7000] QT Embedded on TS-TPC-7395
From: "" <>
Date: Sun, 17 Oct 2010 18:18:56 -0000


Hi all.

I've been working on getting QT Embedded on the 7395 and using Donal O'Connor's guide to getting it running on the 7390. I have been keeping a step by step log of what I did in hopes that it will save someone else some time. This will probably be a little more verbose than most of you will need but since this is my first foray into cross compilation I wanted to be specific so those just getting started with embedded linux could follow along. Unfortunately I left the 7395 at work this weekend so I can't load the final QT Embedded build on it until tomorrow but since I've used Donal's guide as a roadmap I'm confident everything here should be correct. Tomorrow I will follow up with information on how I got the compiled QT-Embedded onto the 7395.

First for some prerequisites. I'm setting up my development environment in a Ubuntu 10.10 VM running on VirtualBox 3.2.10 running on an OS/X host. The first order of business is to get a copy of the Ubuntu 10.10 install iso for i386 architecture from http://www.ubuntulinux.org . Once the OS is installed in your VM we're ready to get started.

Step 1: Get the Cross Compiler for the 7395

Open Firefox and go to ftp://ftp.embeddedarm.com
Find the TS-TPC-7395 and download the cross compiler (crosstool-linux-gcc-3.3.4-glibc-2.3.2-0.28rc39.tar.bz2)

In the file explorer navigate to to the firefox downloads folder (~/Downloads)
Right click on the tar file and extract the contents to this folder (this will create a folder called usr)
Now we need to place the cross compiler in the right place in your filesystem

Open a terminal (Applications -> Accessories -> Terminal)
In the terminal:
    cd ~/Downloads/usr/local
    sudo cp -r opt /usr/local
    gedit ~/.bashrc

This opens up an instance of gedit text editor. On the top line of the file you opened paste the following so that you can call the cross compiler by just typing in arm-linux-gcc instead of having to type the whole path:

export PATH=$PATH:/usr/local/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/bin

Save and close the file. Now we need to add this same item to Root's bashrc file so back in your terminal:

    sudo gedit /root/.bashrc
    Add the following line to the top of the file:

export PATH=$PATH:/usr/local/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/bin

Once you've done this you need to either exit and restart the terminal or at the prompt type 'bash' so that the shell will
reload your path with the new items you just added.

Step 2: Test the Cross Compiler

Open the file explorer and go to your home folder. Create a folder called compiler-test. Inside that folder create two other folders, helloworld-c and helloworld-cpp.

Lets create the C version first. In the termial issue this command:

    gedit ~/compiler-test/helloworld-c/helloworld.c

 for a basic hello world program your text file should look like this:

    #include <stdio.h>

    void main(void){
     
        printf("Hello World!");
    }


    save and close the text file.

Now we see if we can compile our new program. In the terminal issue these commands:
    cd ~/compiler-test/helloworld-c
    arm-gcc-linux helloworld.c -o helloworld.out


You may see some warnings about the main function having a return type of void instead of int. This is really no big deal for our purposes. In your terminal issue:

    file helloworld.out

You should get a response like this:

    helloworld.out: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), for GNU/Linux 2.4.3, not stripped

So now we know that we can compile a C program into an ARM compatible binary. Now lets move onto C++

In your terminal issue the following command:

    gedit ~/compiler-test/helloworld-cpp/helloworld.cpp

In the text editor write a simple C++ hello world program like this:

    #include <iostream>
    using namespace std;

    int main(){
        cout << "Hello World!" << endl;
        return 0;
    }

save and exit the text editor.

In your terminal we will now compile the program. Issue this command:
    cd ~/compiler-test/helloworld-cpp
    arm-linux-g++ helloworld.cpp -o helloworldcpp.out


After the compile is finished, you shouldn't see any errors. In your terminal check the finished binary with the file command like this:

    file helloworldcpp.out

You should get a response like this:

helloworldcpp.out: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), for GNU/Linux 2.4.3, not stripped

Step 3: Get the sources for QT-X11 and QT-Embedded

Open a new terminal (Close any other terminal instances you may have open) and issue the following commands:

    cd ~
    mkdir -p /project/downloads/qt_embedded
    mkdir -p /project/sysapps/host
    mkdir -p /project/sysapps/device
    cd ~/project/downloads/qt_embedded
    wget ftp://ftp.trolltech.com/qt/source/qt-embedded-linux-opensource-src-4.5.3.tar.gz
    wget ftp://ftp.trolltech.com/qt/source/qt-x11-opensource-src-4.5.3.tar.gz
    cd ~/project/sysapps/host
    tar -xzvf ~/project/downloads/qt_embedded/qt-embedded-linux-opensource-src-4.5.3.tar.gz
    tar -xzvf ~/project/downloads/qt_embedded/qt-x11-opensource-src-4.5.3.tar.gz

Step 4: Compile QT-X11 and QT-Embedded on the development machine

    export QT4DIR=~/project/sysapps/host/qt_embedded/qt-x11-opensource-src-4.5.3
    export QTEDIR=~/project/sysapps/host/qt_embedded/qt-embedded/host/qt-embedded-linux-opensource-src-4.5.3

    sudo apt-get install libx11-dev libxmu-dev libpng12.dev
    sudo apt-get install libxtst-dev
    sudo apt-get install build-essential

    mkdir -p qt_embedded/host
    cp -r qt-x11-opensource-src-4.5.3/ qt_embedded/
    cp -r qt-embedded-linux-opensource-src-4.5.3/ qt_embedded/
    cd $QT4DIR
    export QTDIR=$QT4DIR
    $export PATH=$QTDIR/bin:$PATH
    export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
    ./configure -prefix /usr/local/qt4


   
Here it will ask what version of QT you want. If you have a commercial licence type 'C' otherwise type 'O'. The rest of this guide assumes the opensource 'O' option. After you choose the type, it will ask you to accept the license terms. Type 'yes' when prompted and hit enter.

    make
    sudo make install

You now have QT-X11 compiled and installed!

    mkdir -p $QTEDIR/bin
    cp bin/uic $QTEDIR/bin/
    export TMAKEPATH=$TMAKEDIR/lib/linux-g++
    export QMAKESPEC=$QTDIR/mkspecs/linux-g++
    export PATH=$PATH:/usr/local/qt4/bin
    cd ~/project/sysapps/host/qt_embedded/qt-x11-opensource-src-4.5.3/tools/qvfb/
    qmake
    make
    sudo cp ../../bin/qvfb /usr/local/qt4/bin


Close the terminal to clear the envs created earlier and open a new one.

    export QTEDIR= ~/project/sysapps/qt_embedded/host/qt-embedded-linux-opensource-src-4.4.3
    cd $QTEDIR
    export QTDIR=$QTEDIR
    export PATH=$PATH:$QTDIR/bin
    export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
    ./configure -prefix /usr/local/qte4 -qvfb
    make
    sudo make install

You now have QT-Embedded installed on the development machine. To test, launch an instance of qvfb for the qte app to run in

    /usr/local/qt4/bin/qvfb

Create a new terminal window and issue:

    /usr/local/qte4/examples/draganddrop/draggableicons/draggableicons -qws


You should now see an instance of the draggable icons demo appear in the virtual framebuffer you launched.

Close the demo, virtual framebuffer and both terminals. Now launch a new terminal.

Step 5: Cross Compile QT-Embedded for the 7395

First we need to get a copy of TSlib and the install the dependencies to make it:
    cd ~/project/downloads
    wget ftp://ftp.mars.org/debian/pool/main/t/tslib/tslib_1.0.orig.tar.gz
    sudo apt-get install autoconf
    sudo apt-get install automake
    sudo apt-get install libtool
    cd ~/project/sysapps/tslib/tslib-1.0
    sudo ./autogen.sh
    ./configure CC=arm-linux-gcc CXX=arm-linux-g++ PLUGIN_DIR=/usr/local/linux-arm/plugins -prefix=/usr/local/linux-arm -host=arm-linux
    gedit config.h


In gedit scroll towards the end of the file. you will see a line that says: #define malloc rpl_malloc
Comment it out (to do so change the line to this: /* #define malloc rpl_malloc */ )
Save the file and close.

Back in your terminal
    make
    sudo make install


Now that we have TSLib installed we can move on to QT-Embedded

    mkdir ~/project/sysapps/device/qt_embedded
    cd ~/project/sysapps/device/qt_embedded
    tar -xzvf ~/project/downloads/qt_embedded/qt-embedded-linux-opensource-src-4.4.3.tar.gz
    cd qt-embedded-linux-opensource-src-4.4.3
    export QTDIR=$PWD
    export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH


From my conversations with tech support at Technologic, the 7395 is basically the same hardware as the 7390 with a few
mechanical changes to the orientation of the connectors. If my understanding is correct, the color issues Donal ran into with the 7390 will need to be fixed here as well. Before you go further, follow his instructions to fix this issue:
http://automon.donaloconnor.net/qt-embedded-443-and-ts-7390-color-depth-issues/90/ 

Now we need to let QMAKE know where it's INCDIR and LIBDIR are at

In terminal:
    cd mkspecs/qws/linux-arm-g++/
    gedit qmake.conf


In text editor you will see a file like this:
    #
    # qmake configuration for building with arm-linux-g++
    #

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

    # modifications to g++.conf
    QMAKE_CC                = arm-linux-gcc
    QMAKE_CXX               = arm-linux-g++
    QMAKE_LINK              = arm-linux-g++
    QMAKE_LINK_SHLIB        = arm-linux-g++

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

    load(qt_config)

Add the following lines after the include() statements:
    QMAKE_INCDIR += /usr/local/linux-arm/include
    QMAKE_LIBDIR += /usr/local/linux-arm/lib


The final file should look like this:
    #
    # qmake configuration for building with arm-linux-g++
    #

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

    QMAKE_INCDIR += /usr/local/linux-arm/include
    QMAKE_LIBDIR += /usr/local/linux-arm/lib

    # modifications to g++.conf
    QMAKE_CC                = arm-linux-gcc
    QMAKE_CXX               = arm-linux-g++
    QMAKE_LINK              = arm-linux-g++
    QMAKE_LINK_SHLIB        = arm-linux-g++

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

    load(qt_config)

Save the file and close it.

Back in the terminal:
    cd $QTDIR
    ./configure -embedded arm -xplatform qws/linux-arm-g++ -no-qvfb -depths all -qt-mouse-tslib -qt-kbd-usb -I/usr/local/arm/tslib/include -L/usr/local/arm/tslib/lib
    make
    sudo make install

 
You will now have QT-Embedded for your 7395 installed on your development box at  /usr/local/Trolltech/QT-Embedded-4.5.3-arm/


Once again, special thanks goes to Donal O'Connor for his guide on the 7390. I probably never would have gotten this far without it.

Scott Crook
Automation/Test Engineer
Beverage-Air Corp




__._,_.___


Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: =Email Delivery: Digest | m("yahoogroups.com?subject","ts-7000-fullfeatured");=Change Delivery Format: Fully Featured">Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | =Unsubscribe

__,_._,___
<Prev in Thread] Current Thread [Next in Thread>
  • [ts-7000] QT Embedded on TS-TPC-7395, scott.crook@rocketmail.com <=
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU