Monday, November 29, 2010

Schrodenger's Computer

I was working on writing a Modbus Communication Driver for the 7395 and ran into some interesting behavior.

The device I needed to communicate with used the binary style protocol with CRC. This of course means that your data payload can and will have Null chars 0x00. Unfortunately, C/C++ functions that deal with strings or arrays of char will treat the first 0x00 as the end of the data and terminate at that point regardless of the actual size of the string.

At first, I wrote my own functions to ignore null chars by using a length parameter. This seemed to work well enough but I noticed that the data going over the port wasn't always right. Specifically, if I printed the chars with printf (using %x for each character), the data would be as expected. If I did not use printf I would get data that was consistently not what I was loading into the array.

It appeared that by observing the data I could affect it's content!

It actually turns out that this is true. The reason is that the %x argument in my printf (used to print a variable in hex format) was doing an in place cast from char to unsigned integer, thus if I did printf then broadcast the data it would be transmitted as expected.


I wound up reimplementing most of my code to use an array of integer in the first place to avoid this problem but still who would have thought?

Thursday, November 4, 2010

Yet another patch to TSLIB

Once you get everything running on the TS-TPC-73xx you'll probably notice some strange behavior from your touchscreen when you're trying to interact with applications.

When you first open a QT app and tap a widget, the mouse pointer doesn't seem to have a pre-defined location so everything works like it should that first tap. If you watch what is going on  in ts_test you can see that you'll get a few readings at the place you tap with pressure=255 then when you let up you will see a final reading at those X,Y coordinates and pressure=0.

Now when you tap on again what you actually get is this:
$Timestamp:     OLD Xpos     OLD Ypos     255
$Timestamp:     OLD Xpos     OLD Ypos     0
$Timestamp:     NEW Xpos     NEW Ypos      255
$Timestamp:     NEW Xpos     NEW Ypos      255
$Timestamp:     NEW Xpos     NEW Ypos      255
$Timestamp:     NEW Xpos     NEW Ypos      0

To fix it I modified the dejitter filter. In dejitter.c do the following

     Change this:
    if (djt->nr == 1)
        samp [count] = *s;

    To this:
       if (djt->nr  ==  1){
                        samp [count].tv = s->tv;
                        samp [count].x = s->x;
                        samp [count].y = s->y;
                        samp [count].pressure = 0;
                    }

Of course for this to work you need to make sure that you call the dejitter filter in your ts.conf file (if you use the settings I did this will already be taken care of for you).

Sunday, October 24, 2010

Getting TSLIB and QT Embedded on TS-TPC-7395 Debian Lenny EABI Howto

Getting everything working on Lenny/EABI is a totally different ballgame than getting it running on Etch/OABI. This guide is assuming that you are doing your development on a Ubuntu 10.10 machine (either actual hardware or in a VirtualBox VM).

The first thing you need to do is get an EABI cross compiler. Technologic provides one on it's website but it really didn't work well for me. Much better is this one:

http://freaknet.org/martin/crosstool/packages/arm-ep9312-linux-gnueabi-gcc-g++-4.1.1-glibc-2.4-crosstool_0.42-1_i686.deb

Once you download it, go ahead and double click to install via Ubuntu's software center software. Once you have the compiler installed you need a few other packages from the repositories if you don't already have them. To get what you need run the following in your terminal:

$ sudo apt-get install automake libtool build-essential

The stock TSLIB won't work for the 7390/95. You need to get a patched version. You can also run the patch on a stock version yourself. See my post http://smcrook.blogspot.com/2010/10/tslib-patchfile-text-and-link-to.html for more details.

I'm going to assume that you've downloaded the prepatched TSLIB for the rest of the guide.

Unzip Patched TSLIB in ~/Downloads

Edit ~/.bashrc and /root/.bashrc add the following
export PATH=$PATH:/usr/arm-ep9312-linux-arm-gnueabi/bin
alias arm-ep9312-linux-gnueabi-gcc='/usr/arm-ep9312-linux-arm-gnueabi/bin/gcc'
alias arm-ep9312-linux-gnueabi-g++='/usr/arm-ep9312-linux-arm-gnueabi/bin/g++'
alias arm-ep9312-linux-gnueabi-ar='/usr/arm-ep9312-linux-arm-gnueabi/bin/ar'
alias arm-ep9312-linux-gnueabi-objcopy='/usr/arm-ep9312-linux-arm-gnueabi/bin/objcopy'
alias arm-ep9312-linux-gnueabi-strip='/usr/arm-ep9312-linux-arm-gnueabi/bin/strip'

In terminal (Note: The patched TSLIB comes in a .zip file so when you unzip it it creates a second tslib-1.0 folder in the hierarchy)

$ cd ~/Downloads/tslib-1.0/tslib-1.0
$ sudo sh configure CC=arm-ep9312-linux-gnueabi-gcc CXX=arm-ep9312-linux-gnueabi-g++ PLUGIN_DIR=/usr/local/linux-arm-eabi/plugins -prefix=/usr/local/linux-arm-eabi -host=arm-linux

Edit config.h and comment out rpc_malloc near the end of the file

$ sudo make
$ sudo make install

Download QT Everywhere 4.5.3 from nokia

$ cd ~/Downloads
$ tar -xzvf qt-embedded-linux-src-4.5.3.tar.gz
$ cd qt-embedded-linux-src-4.5.3/
$ export QTDIR=$PWD
$ export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
$ cd /src/gui/embedded
$ gedit qscreenlinuxfb_qws.cpp

Apply TS7390/95 Color patch Per Donal's guide

$ cd $QTDIR/mkspecs/qws/linux-arm-gnueabi-g++
$ gedit qmake.conf

Replace the contents of the file with this:
#
# qmake configuration for building with arm-none-linux-gnueabi-g++
#

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

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

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

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

load(qt_config)

Save the file and quit your text editor.

Back in your 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
As with the Etch/OABI guides, this will install the ARM compiled QT Embedded in /usr/local/Trolltech. For details on loading QT Embedded on the 7395 check out another of Donal's Guides

Before you can use TSLIB you need to run ts_calibrate on your board and set up the proper environment variables. For more information I have a step by step guide here (This was originally for Etch/OABI but it will work for Lenny as well) http://smcrook.blogspot.com/2010/10/getting-tslib-working.html

TSLIB patchfile text and link to prepatched version.

Here is the patch that needs to be applied to TSLIB to get it to run on the TS-TPC-7390 and TS-TPC-7395. You can run this patch on a stock version and you should be good to go. You can also get a pre-patched version from Donal O'connor Here: http://automon.donaloconnor.net/files/tslib-1.0.zip


If you want to run the patch yourself, here is the text of the patch file you need to create (As far as I know, Blogger doesn't have a way to do file uploads so you'll need to copy and paste this into a text file then run the patch command).

--- tslib-1.0/plugins/input-raw.c    2006-08-24 23:02:54.000000000 +0200
+++ tslib-1.0.1/plugins/input-raw.c    2008-10-24 09:55:28.000000000 +0200
@@ -97,13 +97,24 @@
                 case BTN_TOUCH:
                     if (ev.value == 0) {
                         /* pen up */
-                        samp->x = 0;
-                        samp->y = 0;
+                        /* use last i->current_x and i->current_y values */
+                        samp->x = i->current_x;
+                        samp->y = i->current_y;
                         samp->pressure = 0;
                         samp->tv = ev.time;
                         samp++;
                         total++;
                     }
+                    else if (ev.value == 1) {
+                        /* pen down */
+                        /* use last i->current_x and i->current_y values */
+                        samp->x = i->current_x;
+                        samp->y = i->current_y;
+                        samp->pressure = 1;
+                        samp->tv = ev.time;
+                        samp++;
+                        total++;
+                    }
                     break;
                 }
                 break;

Wednesday, October 20, 2010

Building QT Apps for TS-TPC-7395

Sure building the demo apps for QT embedded is easy enough but it's a little confusing if you're not experienced with QT on how to go about creating a new project that will compile for the 7395 on your Linux box. Here's what you need to do:

First let's edit your user's .bashrc file so that we can call qmake without having to specify the entire path:

Open ~/.bashrc in the text editor of your choice and add the following to it:
alias ts-qmake='/usr/local/Trolltech/QtEmbedded-4.5.3-arm/bin/qmake'
Once that's done you can call qmake for the Arm-Compiled QT Embedded as ts-qmake

So let's say you have a simple 'Hello World' QT application with just a main.cpp file. How do you compile it?

In your terminal:

$ cd ~/YOUR-PROJECT-DIRECTORY
$ ts-qmake -project 
$ ts-qmake
$ make

Now you will have a binary file that you can transfer over to your 7395 and run.

To run your program, kill the X server (if one is running) via ctrl+alt+backspace (or if you don't have a keyboard hooked up you can always kill the process via a terminal).

Then just navigate to the directory containing your binary and run it like this:

$ ./YOURBINARY -qws

Upgrading TS-TPC-7395 to Debian Lenny with EABI

Not long after getting the stock Etch/OABI distro running with Qt embedded, I tried the QT Embedded Widgets demo apps.

For the curious, you can check out a windows demo of the various available widgets through this package here:
http://qt.nokia.com/files/embedded-widget-demos/qt-embedded-widgets-catalog/view

Unfortunately, the OABI Debian/QT Embedded is a bit sluggish on the 7395 hardware. I spoke with Donal O'Connor via email and he suggested going the EABI route as I'd likely see the performance of the QT/E apps double.

So far I've gotten the new distro running. I'm working on compiling TSlib at the moment but for now here's a guide on how to get Lenny/EABI Running.

First you need to get some files from ftp.embeddedarm.com . Once there, go to the TS-TPC-7395 (or 7390 they're basically the same machine). You will need one of the binary dd sd-card images (I chose 512mbsd-jun282010 but really any of them should be fine). Also you need to go to the distributions folder and get the Debian-Lenny-EABI distribution.

To install follow these steps:
1. Place the files you downloaded on a USB jump drive or other external storage
2. Boot the Ubuntu 10.10 live cd
3. When Ubuntu finishes loading, click on your jump drive in the file explorer to mount it.
4. Un BZ2 the dd file
5. Insert your SD-Card
6. Find where Ubuntu is mounting your SD card (it will vary depending on the number of hard drives and other things you have installed in your system) opening GParted (System->Administration->Gparted Partition Editor). Once there you can look at your storage devices and it should be easy to deduce which /dev is the SD card.

My jump drive is named JUMP DRIVE and was mounted at /dev/sdb (linked to /media/JUMP\ DRIVE . The SD card was /dev/sdc. You will need to change device names and mount points to fit your circumstances but these are the general steps you need to take from here:

In a terminal:
$ cd /media/JUMP\ DRIVE/
$ dd if=512mbsd-jun282010.dd of=/dev/sdc

This should take a few minutes then you will see your command prompt come back signaling that the job is finished.

Now lets see if everything worked out. Remove then reinsert the SD Card. You should see Ubuntu mount 2 filesystems. They will be named 1.6MB Filesystem and 482MB Filesystem respectively.

Now your sd card will have some pretty crazy partition names (mostly just long strings of numbers, nothing too memorable. What you want to do now is figure out in the terminal which is which.

To do so do this:
$ cd /media
$ ls

Here you should see your jump drive, and 2 random devices. What you need to do here is cd into one of them and see which of the two filesystems it is with the ls command.

Once you've found the 482mb filesystem in the terminal change your directory to it. Now do:

$ rm -rf * 

Now you need to un-tar the Lenny Filesystem you downloaded to the 482mb Filesystem. You can use the command line or you can use the GUI and move it over. In either case you will need sudo privileges.

Once you have the Lenny files on the SD Card you can either boot the 7395 off of this card as is or make the Lenny root partition bigger to use up any available unpartitioned space on the SD card.

If you want to expand the filesystem, Ubuntu's GParted won't work as it crashes when confronted with a device with a JFS filesystem. What you need to do is download the GParted Live CD and resize the filesystem from there.

Depending on the base image you dd'ed from you may find that when you boot up you are confronted with nothing but a blinking cursor followed by a blank screen. If that happens to you, simply connect the 7395 to a serial port on your pc while it is booting. You will see the boot sequence then be given an ash shell prompt. Type exit and the full Debian distro will boot. You will now see things going on with the screen on the 7395 and you can carry on as normal.

Tuesday, October 19, 2010

Getting TSLIB working

I emailed Donal O'Connor last night to ask if he had a compiled copy of TSLIB. He sent me his zip file this morning and I was able to get it working with the TS-TPC-7395.

Here is what I did:

On the development VM, Unzip the compiled TSLIB

On the 7395

$ mkdir /usr/local/linux-arm
$ chown -R eclipse:eclipse /usr/local/linux-arm   


Back in the Dev VM
$ cp -r linux-arm/ /usr/local/
$ scp -r linux-arm/ eclipse@192.168.0.50:/usr/local/

Back on the 7395

$ vi /root/.bashrc

Add the following lines to ./bashrc
export TSLIB_TSEVENTTYPE=H3600
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/usr/local/linux-arm/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/local/linux-arm/lib/ts
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/linux-arm/lib/:/usr/local/lib:/usr/local/Trolltech/QtEmbedded-4.5.3-arm/lib/
$ export QWS_MOUSE_PROTO=Tslib


Back in the terminal:
$ su (reload bashrc)$ cd /usr/local/linux-arm/etc$ cp ts.conf ts.conf.old$ rm ts.conf$ vi ts.conf

Add the following lines to the new file (Do not add any blank lines!)
module_raw input
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear  

Save the document and exit 


$chmod 777 /dev/input/event0$cd /usr/local/linux-arm/bin$ ./ts_calibrate

(If it doesn't run you may need to chmod the file so it is executable (chmod 777 ts_calibrate)

Monday, October 18, 2010

Damn You TSLIB!!!!

I spent 3/4 of the workday wrestling with resizing a JFS partition on an SD Card to boot the TPC-7395. Apparently Ubuntu 10.10's Gparted package has some major issues that causes it to crash when scanning any device with a JFS partition. The GParted live disc didn't seem to have that problem so the issue eventually got squared away.

So there I was excited to finally get QT Embedded loaded onto this board and when I go to launch one of the demos I find out that the version of TSLIB I compiled doesn't want to talk to the touchscreen. I can launch the app just fine, just can't interact with it in any way.

Sunday, October 17, 2010

Compiling QT-Embedded on Technologic Systems TS-TPC-7395

I've been trying to get QT embedded working on the 7395 for a few days now and I kept a log of the steps I took to get there. Unfortunately, I left the 7395 at work on Friday so I can't test the compiled binaries until tomorrow but I'm pretty confident that everything here is right...

I based this guide on Donal O'Connor's guide for the TS-TPC-7390 which you can find here:

 http://automon.donaloconnor.net/cross-compiled-qt-embedded-step-by-step/74/

First order of business is to set up a VirtualBox VM with Ubuntu 10.10 (I used VirtualBox 3.2.10 on an OS/X host). Make sure you give the VM at least a 20GB hard drive as the stuff you will need to compile is going to take up more than the default 8GB and you want to have plenty of space left over to do your actual application development on the VM. Once you get the OS installed, you may want to have VirtualBox install the guest OS drivers. This allows the VM to use bigger resolutions than 800x600. You don't have to do this but it only takes a minute and it makes everything else a lot more pleasant.

Once you have the OS set up we're ready to begin:

Step 1: Set up the cross compiler for the TS-7395 on the development machine:

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' (without the quotes). If you don't do this the shell doesn't seem to update itself to include the aliases you added.

Ok so now we're ready to test the cross compiler. To do this we need to write a simple hello world program in C and also C++. We will attempt to compile these with our cross compiler then run each of them on the TS-TPC-7395.

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

So now we know that we can compile C and C++ binaries for our TS-7395 board so lets get started on compiling QT-X11 and QT-Embedded for our development machine


Step 2: Compile and Install QT-X11 and QT-Embedded for the development machine

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

     $ 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

   
$ 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
           Now you need to 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 3: Compile TSLIB and QT-Embedded for the 7395

    $ 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
   
$ 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
Before you build, you should modify some of the QT-Embedded source files to fix the 15/16 bit color issue that Donal mentions in his guide. To see how to make the patch, check out this page on Donal's site:
http://automon.donaloconnor.net/qt-embedded-443-and-ts-7390-color-depth-issues/90/
Now we need to let QMAKE know where to find QMAKE_INCDIR and QMAKE_LIBDIR

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

Make install will install to /usr/local/Trolltech/QtEmbedded-4.5.3-arm/
You can inspect one of the example executables using the file command and you should see that they are also ARM linux binaries.