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
- 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
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