Yeah, so now that we have all the required libs (read previous post if you are still struggling for that part) so we are embarking on to develop some cute (read Qt) applications for a mini2440 or whatever embedded target you have. Just before we move any further I am about to make some stuff clear. So, your system looks something like this now that you have the Qt power with you
what we are going to do is create an app that uses the Qt APIs which inturn will use some libs that we just ported and therefore do whatever we tell it to. In this post I’ll just make use of a simple adder program that I have created. I’ll demonstrate how to develop for your x86 host machine and then how to get it working on the ARM target. As always, there are some pre-requisites
- Toolchain
- Qt SDK – Offline 689MB
- Target Board – ARM, PPC or whatever arch. I use mini2440.
- Ear-muffs, in case you can still hear your girlfriend’s shouts
You can however do away with the last part only if you have a geek girl or you are deaf 🙂 So we begin our journey.
Setting Up the Host
Install Qt SDK on your system. Its pretty straight forward. Once its done, get some feel of developing application using Qt for just your x86 host. This means going through the tutorials and the usual stuff of creating a hello world application etc. I’ll cover al this in another post if you wish. but for the time being we’ll just create a small project called adder. Now you can either start making your own app or use mine for testing. Get the simple adder utility that I have made. You can download it either as a tarball or just get it from Gitorious
Also, untar the toolchain and set it up in the PATH so that you get ready for cross-compiling.
Application Development on x86 Host
Now, the good thing is that you can first create an applications and test it on your host. the development is done in Qt Creator which comes with the complete installation of Qt SDK. Open the adder project you just got. You can even just browse through the available examples in your system and create your own if you are well versed with Qt Creator. The utility is quite simple to use and I shall explain how to start development in it in the next post. For now, you can build the ‘adder’ project simply for your desktop by selecting the project and pressing the build and execute button on the left panel.
So once the build is over, your application will get executed on your host successfully. SO we have cover now how to build and execute apps for your desktop host.
Application Development on ARM Target
Now you can have nay target architecture. To test the process, I have used my ol’ faithful ARM mini2440 as the target board. Lets begin then. Remember that in the previous post we ported and put the libs on the mini2440? We had our cross compiled Qt libs and other stuff stored in the /usr/local/qt directory both on the host and the target. Now just browse to that directory and see if you have the qmake binary in usr/local/qt/ Now add this to the PATH variable so that you can run qmake.
No go to the adder directory and do a
qmake adder.pro make
You will notice that in the same directory, a binary called adder will be created. if you do a file on it, you will see that its for an ARM target. Of course, make will throw some errors if you have not setup the toolchain properly. Now make sure that you have configured and built Qt with the -qt-mouse-tslib -qt-kbd-linuxinput if you are using a touchscreen interface or need to have a USB keyboard interface.
Also you may need to modify the width and height in the following environment variable according to the proper font size display and the screen. The value below works best for a 15″ VGA monitor
export QWS_DISPLAY=LinuxFB:mmWidth=310:mmHeight=190
Now, Its just a matter of transferring the cross-compiled binary to the target system and running it. I have tested running it on a mini2440 connected to a 3.5″ screen, 12.1″ screen and even on a standard LCD with a VGA interface. Upon execution, the aplication looks something like this :
So we have done it at last. So just keep on developing whatever comes to your mind and port it on to your embedded target. The cool thing is that we can now just get anything made for Qt to work on your target. I have myself tested fully functional browsers (you need Webkit for that, don’t forget!) and image viewers, clock and small games too 🙂 the only limitation you may face of course is the hardware on your target! Feel free to ask for any help and or giving suggestions
I am developing on Mini2440 board and I have compiled qt for embedded linux (qt-everywhere-opensource-src-4.6.3) and tslib successfully by following your instructions. I have run my cross compiled application on the 2440 kit by
./app -qws
and it worked great.
Thanks a lot.
Now I want to run the same application by creating icon on touch screen. Please let me know what is the procedure for loading the application and run it from touch screen
Nice to know that the post helped you 🙂 Do you want some icons like those in Android /iPhone? Please elaborate how exactly you want the GUI. One thing is to make a Qt widget which will display a collection of icons on touchscreen. Make this app boot on startup. In the app, code in a manner that the clicks (touch from a touchscreen) will execute your actual application. This is quite a crude way but thats what comes to my mind right now 😛
Hi,
This tutorial is great, everything worked thus far. Yet when you say that it is only a matter of transferring applications to the mini2440, you are a bit vague. I used all your downloads and files and made sure that everything lined up to your tutorial, but when I actually transferred your adder application to the device, the application will appear on the touch screen but will not open and run. I have been looking all over the internet for the best way to opening these applications that I make in Qt4 and so far yours gets me the closest, but I want to know what steps I need to take to actually make that final step in getting applications to work. I believe I am in the same area as Pavan, the post above.
Thanks,
Nick
I am a bit confused when you say ” the application will appear on the touch screen but will not open and run”. Mail me directly with some screenshots if possible. Does your application starts when you do ./adder -qws ? Assuming that the application runs and you get the display on the screen as I have put up on the blog, remember that you will have to start your qt application every-time through the shell only, by giving the above command. You can automate this process by putting this in the /etc/init.d/rcS script. This way, the system will start your application as soon as it boots up.
Hi,
I was wondering if you could let me know how to set up the debugger in Qt4. I used your Qt configuration, but when I start debugging, a dialog box appears that says it is not a “debug build.”
Thanks,
Nick
Hmm, that I don’t really know but still, assuming you want to debug an application running on a mini2440, I’ll direct you to some debugging documentation we did here using GDB [1] and Eclipse IDE [2]. I’ll try for Qt Creator too in the meantime. An of course, we have not configured it as a debug build. I think it can be done easily using Qt Creator.
[1] http://wiki.embeddednirvana.org/Debugging_Your_Application_on_Embedded_Device
[2] http://wiki.embeddednirvana.org/Using_eclipse_IDE_for_remote_debugging
Dear Suchakra,
Myself atul dixit working in a marine company working as a software engineer.I have purchased ARM9(2440) from market but i am not able to start work on that because most of things are not in english and i am not getting any idea how to start work on that.
Suggest some solution so that i can go ahead if u can?????
thanks.
my emailid:- dixitatul6@gmail.com
conatct no:- +91-8087384386
Hi Suchakra..
am newbie for linux and qt arm.. i installed qt4.8 embedded arm qt for my ubuntu host based this – https://suchakra.wordpress.com/2011/05/17/qt-on-mini2440/
when i am trying to debug or release the project (Using QtEmbedded-4.8.0-arm toolchain linux-arm-g++) it will show
Starting /home/Projects/calculator/calculator…
Failed to start program. Path or permissions wrong?
/home/Projects/calculator/calculator exited with code 0
i googled lot and find this answer for
http://qtcreator.blogspot.in/2009/10/qt-creator-13-beta.html
but i cant solve the problem. can u please help me suchakra…..
Thanks
swetha
Are you planning to run the calculator project for desktop as a target? If yes then clean the project first and then rebuild it. Also check whether the executable generated has proper permissions or not by doing an ‘ls -lh’ in the calulator directory.
By “QtEmbedded-4.8.0-arm toolchain linux-arm-g++” you mean that you have set the cross toolchain in the build settings in your project? For a desktop target, Use the SDK’s qmake and the desktop’s gcc and not the cross toolchain.
Hai,
thank u very much for you reply… i gave the full permission to the calculator project. like this
for debug :
root@swetha:~/Projects/calculator/calculator-debug-arm# ls -lh
total 1.9M
-rwxrwxrwx 1 root root 332K 2012-03-23 11:18 button.o
-rwxrwxrwx 1 root root 657K 2012-03-23 11:18 calculator
-rwxrwxrwx 1 root root 399K 2012-03-23 11:18 calculator.o
-rwxrwxrwx 1 root root 146K 2012-03-23 11:18 main.o
-rwxrwxrwx 1 root root 15K 2012-03-23 11:18 Makefile
-rwxrwxrwx 1 root root 2.3K 2012-03-23 11:18 moc_button.cpp
-rwxrwxrwx 1 root root 155K 2012-03-23 11:18 moc_button.o
-rwxrwxrwx 1 root root 4.1K 2012-03-23 11:18 moc_calculator.cpp
-rwxrwxrwx 1 root root 160K 2012-03-23 11:18 moc_calculator.o
for release :
root@swetha:~/Projects/calculator/calculator-release-arm# ls -lh
total 1.9M
-rwxrwxrwx 1 root root 332K 2012-03-23 11:18 button.o
-rwxrwxrwx 1 root root 657K 2012-03-23 11:18 calculator
-rwxrwxrwx 1 root root 399K 2012-03-23 11:18 calculator.o
-rwxrwxrwx 1 root root 146K 2012-03-23 11:18 main.o
-rwxrwxrwx 1 root root 15K 2012-03-23 11:18 Makefile
-rwxrwxrwx 1 root root 2.3K 2012-03-23 11:18 moc_button.cpp
-rwxrwxrwx 1 root root 155K 2012-03-23 11:18 moc_button.o
-rwxrwxrwx 1 root root 4.1K 2012-03-23 11:18 moc_calculator.cpp
-rwxrwxrwx 1 root root 160K 2012-03-23 11:18 moc_calculator.o
after executing i get the same error : Failed to start program. Path or permissions wrong?
actually am using sdk qmake for Qt-desktop. it builds and release the output perfectly the output showed on the the host machine..
For qt-embedded-arm i have add the qmake for QtEmbedded-arm (tools-options-qt4) from usr/local/trolltech/QtEmbedded-4.8.0-arm/bin/qmake (iby manually)
and added the toolchain from arm-linux-gcc-4.3.2.tgz for arm (usr/local/arm/arm4.3.2/bin – by manually) by selecting Add – GCC
Compiler path : /usr/local/arm/arm4.3.2/bin/arm-none-linux-gnueabi-g++
Debugger : /usr/local/arm/arm4.3.2/bin/arm-none-linux-gnueabi-gdb
ABI : arm-linux-generic-elf-32bit
is this correct or any thing to be implement to run the calculator project…
after successfull running then i have to implement this project to on my embedded target..
help me suchakra.. sorry for disturbing you.. kindly help me..
thanks : swetha
Hey you have done all the steps correctly. If you give the command ‘file calculator’ in your calculator-release-arm directory, you’ll see that the ELF generated is for ARM 🙂 so cheers! The reason its giving error is that the elf is for ARM and QtCreator is trying to execute it on your x86 host (your PC)
Now, you need to deploy the app on the device which is a different story alltogether. To successfully run the cross compiled aplication, you need Qt libs and the application copied to the board. Read Setting up Qt libs section on https://suchakra.wordpress.com/2011/05/17/qt-on-mini2440/
Oh and you are not disturbing. Feel free to ask any questions 🙂
thanks suchakra, now only am happy. 🙂 thanks for your reply…
i cant run the calculator exe on the target
it giving an error
#./calculator -qws
-sh: calculator: not found
i add the all libraries form qt/lib folder to /usr/lib to the target.as well as set the path varible to that libs.
whats the problem its occur in target or the exe. help me to solve this problem
thanks : swetha
I am trying to develop an application in Qt, a simple helloworld program. It runs in desktop. When i tried to run on target board,its not running it gives the following error
#./helloworld
~sh:./helloworld not found
i have created make file using qmake and edited that make file for uclibc compiler .
Could anyone help me out to sort out this issue.
Thanks in advance
Regards.
vineeth
Is it being generated with arm as the target. just do ‘file helloworld’ on your host to check if its really been compiled for arm. Also change permissions on target and set it as executable if its not already set.
Hi suchakra , This is a helpful quide. I am try to develop mini 2440 qt application. I am newbie. I have read many article but ı can’t success. I have last versiton of qt creator from nokia site . But ı can’t add embedded qmake path. I am confused about that.
Would you please tell me step by step How to create a Hello World App on Linux Machine and Load app to mini arm then run it. (By the way my Qtopia is installed on Mini 2440)
)
You don’t tell How to setup Toolchain. Can you tell simply step by step (toolchain, opensource emdeeed, QT creator etc…)
Thank you .
I suggest that before jumping directly to Qt on embedded devices, start off with basics of embedded linux. Embedded Linux primer by Christoper Hallinan is a good place to start. Start with cross-compiling a simple comand line program in C and then transferring it to the mini2440 using a USB drive or ethernet and then executing it. You can simply google how to do it. Once you are comfortable with toolchains and cross compiling, start with cross compiling libs for eg. Qt libs. For that I already have a tutorial! Keep on asking any specific questions if you have 🙂
Hi suchara I have an error which you tell above : When I ./configure
The tslib functionality test failed!
You might need to modify the include and library search paths by editing
QMAKE_INCDIR and QMAKE_LIBDIR in
But My staffs is in qmake.conf is
QMAKE_INCDIR += /home/tslib/include/
QMAKE_LIBDIR += /home/tslib/lib/ And Then tslib folder in /usr/local/tslib does not have any include and lib folder. Tslib folder is in /Home directory have include and lib folder . I can’t understand where mistake is
How to create QT Application for Mini 2440
Hi, I am newbie at Mini 2440 an Qt programming . I have a mini 2440
installed Qtopia in it . I also have a computer Fedora 17 installed. I use Qt
creator to create QT application.
How to create and compile a QT program in Fedora 17 pc for mini 2440 then load program to
mini 2440 and run it.
Can Anyone Please help me…
Thank you..
What are the requirements to create Qt Application for Mini2440?
Can Anyone Please help me…
Thank you..
Dear all,
i am able to cross compile and run Qt application on mini2440 by using “-qws ”
command in terminal.
but how to install Qt application on mini2440 so that directly by Double click on the icon we can able to Run the program..
for this what i have to do.?
please help me…
Thanks and Regards.
Sunil