Developing a Qt hello world App for mini2440

We must have precompiled Qt on our /usr/local/Qt as said in earlier post.Install Qt creator on your system from Ubuntu software centre

After sucessful installation you could open it on “Applications” -> “Programming” -> “Qt creator”.

Now we need to configure our new Qt creator to use the cross compiled Qt libraries for mini2440 and its qmake.Bcoz the target for our app is mini2440.

So now on Qt creator select ools > Options.

In “Options” window, click to “Qt4” -> “Qt Version“, on the right part you will see “Auto-detected” and “Manual“. Click on “Manual” and then choose plus (+) button located on the top right, in section “Version Name” you could let down what name you like (I typed “mini2440“). In section “QMake Location“, click on “Browse…” and you should indicate Qt creator know where the directory of qmake is. For what i did, I choose /usr/local/Qt/bin/qmake

If there is no errors we can see “Found Qt version 4.6.3, using mkspec /usr/local/Qt/mkspecs/qws/linux-arm-g++” under “Debugging Helper“. Click “Ok” to complete this mission.

Now is time to make new project, choose “File” -> “New File or Project” -> “Qt Gui Application” in “Project” section. Save it with some name

On clicking “Finish” you will reach here

Now doble click on Mainwindow.ui on the lefthand side

Now a QtDesigner window opens like this

Am adding a pushbutton to the gui window just drag and drop pushbutton from leftside

On task-bar, choose “Build” -> “Build All” to build the program. Click on “Run” button to see the result.we can see our gui window as a popup.

To cross-compile program for mini2440, choose “Project” section located on the left.In “Building Setting” change Qt version and edit build configuration to mini2440.

Okay, now you could cross-compile program for mini2440 by: “Build” ->  “Rebuild All“. Then select qmake.Right now, if you run program in Ubuntu, you will receive a fault with something like this (it’s because the program run on ARM processor, not on Ubuntu)

you can check the filetype of the executable by using file command it will show ARM

Copy the binary to the mini2440 using pendrive or sd card.To execute the binary run like this..

$ ./ex1 -qws

Compiling Qt and tslib for mini2440 and run a demo app

We will create a Qt app that is compatible on mini2440 on our host computer then we will copy the libraries and binary of the app to mini2440 and will run the app….

So first we need to set up the Qt environment that we have in our mini2440(Qtopia) to our host computer…

These are the steps we must follow

1. tslib compilation
2. Qt4.6.2 compilation
3. Copy library of tslib and Qt4.6.2 into mini2440 board.
4. Configure the environment in mini2440 board.
5. Run Qt example program

1. tslib compilation

Tslib is an abstraction layer for touchscreen panel events, as well as a filter stack for the manipulation of those events. It was created by Russell King, of Tslib is generally used on embedded devices to provide a common user space interface to touchscreen functionality.

$sudo apt-get install git-core
$cd /usr/local
$git clone
$export PATH=/usr/local/arm/4.3.2/bin:$PATH
$export CROSS_COMPILE=arm-none-linux-gnueabi-
$export CC=${CROSS_COMPILE}gcc
$export CFLAGS=-march=armv4t
$export CXX=${CROSS_COMPILE}"g++" 
$export AR=${CROSS_COMPILE}"ar" 
$export AS=${CROSS_COMPILE}"as"
$export RANLIB=${CROSS_COMPILE}"ranlib"
$export LD=${CROSS_COMPILE}"ld"
$export STRIP=${CROSS_COMPILE}"strip"
$export ac_cv_func_malloc_0_nonnull=yes
$cd /usr/local/tslib
$./configure --host=arm-linux --prefix=/home/tslib --enable-shared=yes --enable-static=yes
$make install

If everything went ok you will see tslib in you will see tsblib in /home/tslib

2.Qt Compilation

$mv qt-everywhere-opensource-src-4.6.3.tar.gz /usr/local
$cd /usr/local
$tar -zxvf  qt-everywhere-opensource-src-4.6.3.tar.gz
$cd qt-everywhere-opensource-src-4.6.3
$cd mkspecs/common/
$gedit g++.conf

Edit that file

change         QMAKE_CFLAGS_RELEASE += -O2
into               QMAKE_CFLAGS_RELEASE += -O0
Then save the file

$cd /usr/local/qt-everywhere-opensource-src-4.6.3/mkspecs/qws/linux-arm-g++/
$gedit qmake.conf

Edit the file.Copy paste the below content , note that, the path /usr/local/arm/4.3.2/ is the path which you installed tool chain.Remember that the PATH variable should have the location of arm-none-linux-gnueabi-gcc

# qmake configuration for building with arm-linux-g++


# modifications to g++.conf
QMAKE_CC = /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-gcc -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts
QMAKE_CXX = /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-g++ -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts
QMAKE_LINK = /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-g++ -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts
QMAKE_LINK_SHLIB = /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-g++ -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts

# modifications to linux.conf
QMAKE_AR = /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY = /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-objcopy
QMAKE_STRIP = /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-strip

QMAKE_INCDIR += /home/tslib/include/
QMAKE_LIBDIR += /home/tslib/lib/

QMAKE_CFLAGS_RELEASE += -march=armv4 -mtune=arm920t
QMAKE_CFLAGS_DEBUG += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_MT += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_MT_DBG += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_MT_DLL += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_MT_DLLDBG += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_SHLIB += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_THREAD += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_WARN_OFF += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_WARN_ON += -march=armv4t -mtune=arm920t

QMAKE_CXXFLAGS_DEBUG += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_MT += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_MT_DBG += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_MT_DLL += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_MT_DLLDBG += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_RELEASE += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_SHLIB += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_THREAD += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_WARN_OFF += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_WARN_ON += -march=armv4t -mtune=arm920t


Save the file

$mkdir /usr/local/Qt
$cd /usr/local/qt-everywhere-opensource-src-4.6.3

Then issue this command

$./configure -embedded arm -xplatform qws/linux-arm-g++ -prefix /usr/local/Qt -qt-mouse-tslib -little-endian -no-webkit -no-qt3support -no-cups -no-largefile -optimized-qmake -no-openssl -nomake tools -qt-sql-sqlite -no-3dnow -system-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -no-opengl -gtkstyle -no-openvg -no-xshape -no-xsync -no-xrandr -qt-freetype -qt-gfx-linuxfb -qt-kbd-tty -qt-kbd-linuxinput -qt-mouse-tslib -qt-mouse-linuxinput

chose ‘o’ Open Source Edition
chose ‘yes’ to accept license offer

$make install

Now the compilation is done, you will see the result files in /usr/local/Qt.

3 .Copy library of tslib and Qt4.6.3 into mini2440 board

Use sd card,pendrive or you can copy through network

copy library and example program of Qt to pendrive

$cd /usr/local/Qt/lib
$cp *4.6.3   /media/Pendrive/
$cp -r fonts/   /media/Pendrive/
$cd /usr/local/Qt
$cp -r demos/   /media/Pendrive/

copy tslib into pendrive

$mkdir /media/Pendrive/tslib/lib/
$cd /home/tslib/lib/
$cp -r * /media/Pendrive/tslib/lib/
$cp * /media/Pendrive/tslib/lib/

Now connect the pendrive to the usb port of Mini2440 and in mini2440’s console

$mkdir /usr/local/Qt/lib/
$cp /sdcard/*4.6.3 /usr/local/Qt/lib/
rename all *.4.6.3 in /usr/local/Qt/lib into *.4, for example
$cp -r /udisk/fonts/ /usr/local/Qt/lib/
$cp -r /udisk/demos/ /mnt/
$cp -r /udisk/tslib/ /usr/local/

On mini2440 the pendrive will appear as /udisk instead of /media/Pendrive

4. Configure the environment in mini2440 board.

Below instructions will make mini2440 board not load its desktop so that our example Qt programs not conflict screen with the desktop

$cd /etc/init.d/
$vi rcS
comment last three lines:

#echo"                                 "> /dev/tty1
#ehco"Starting Qtopia, please waiting..." > /dev/tty1

Configure the environment in mini2440:

$cd /etc/
$vi profile

add those lines at the end of file

export LD_LIBRARY_PATH=/usr/local/tslib/lib
export QTDIR=/usr/local/Qt                 
export QWS_MOUSE_PROTO=tslib:/dev/input/event0
export TSLIB_CALIBFILE=/etc/pointercal        
export TSLIB_CONFFILE=/usr/local/etc/ts.conf  
export TSLIB_CONSOLEDEVICE=none               
export TSLIB_FBDEVICE=/dev/fb0              
export TSLIB_PLUGINDIR=/usr/local/tslib/lib/ts
export TSLIB_TSDEVICE=/usr/local/tslib/lib/ts 
export TSLIB_TSEVENTTYPE=INPUT                
export QWS_DISPLAY=LinuxFB:mmWidth=105:mmHeight=140

Save it

5. Run Qt example program:

Now we can test Qt example programs

$cd /mnt/demos/embedded/fluidlauncher/
$./fluidlauncher -qws

setting up supervivi,kernel & qtopia in mini2440

Download supervivi,zImage,usbpush and qtopia image from

These are the files i used

supervivi –

zImage –

usbpush –

qtopia –

Extract the usbpush this utility helps us to push the image files from our system to mini2440 target.When we extract we can see one more usbpush folder inside that folder there will be a usbpush binary give executable permission to that binary

sudo chmod +x usbpush/usbpush/usbpush

Get the bootloader using command

sudo minicom

select ” x “  and format the NAND flash

Now the next step is to load supervivi to target board using usbpush.supervivi is the bootloader.

First select ” V

Only after this you should push file from the host system.Push the file like this

sudo ./usbpush/usbpush/usbpush supervivi_20100818/supervivi-128M

If the push is sucessful then the minicom promt will be like this and will be back to the bootloader

and the usbpush prompt will be like this

So vivi is sucessfully installed.Next is zImage, Kernel images generated by the kernel build process are either uncompressed “Image” files or compressed zImage we selects zImage N35 bcoz  MINI2440 with 3.5″ NEC display.

Now we selects ” K ” option to download linux kernel and pushes the extracted zImage

sudo ./usbpush/usbpush/usbpush  linux-zImage_20110421/zImage_N35

After this step you may encounter with this error

Enter your selection: k
USB host is connected. Waiting a download.
Length of file is too big : 2517028 > 2097152
Failed downloading file

If you encounter with this error then you can solve this error like this.First go to the shell of vivi by selecting ” q

Then from supervivi promt type this

Supervivi>part del kernel
Supervivi>part del root
Supervivi>part add kernel 0x00060000 0x00500000 0
Supervivi>part add root 0x00560000 0x40000000 0
Supervivi>part save
Supervivi> part show

Now to get back to our previous menu type menu

Supervivi> menu

Now retry to download zImage with previous steps

Now we need to Download the root yaffs image.YAFFS (Yet Another Flash File System) is now in its second generation and provides a fast robust file system for NAND and NOR Flash. It is widely used with Linux and RTOSs, in consumer devices. It is dual licenced under commercial/GPL terms.

Select ” Y ” to download yaffs image and push the qtopia image file

It will take some time…

Now that we have completed all the steps select “ b ”  to boot the system

Here also you will get an error like this

“error – Kernel panic – not syncing: No init found.  Try passing init= option to kernel” –> this will be the error

To fix this error got to supervivi promt and type this

param set linux_cmd_line "noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0"

After this select boot.Then the board will boot and we will get prompt of friendlyarm

Now calibrate the screen by clicking on the crosshairs shown and you will be taken to qtopia screen by default qtopia will be in chineese in second tab there is a flag symbol select that it chnages the language select english and we are done

Happy Hacking 🙂