Right now, I will show you build a "hello world" program by Qt creator. Firstly, you should install Qt creator. Then, opening Qt creator to make a simple program "hello world". And lastly, copying it from host computer (Ubuntu) to mini2440.
1. Installing Qt creator:
On Ubuntu, click on "Applications" -> "Ubuntu Software Center". In the new window appearing, you should type "Qt creator" on the search section located on the top right. Searching results should be presented with "Qt creator" in the first line. Click on it, then you will see "Install" button lying on the right.
After successful installing Qt creator on your computer, you could open it on "Applications" -> "Programming" -> "Qt creator".
2. Making a simple program:
Before typing a new program, it should indicate Qt creator know the cross-tool you are using to compile. Because we use a cross-tool to build program for ARM processor on mini2440, we will signify Qt creator knowing where qmake is (qmake is a cross-tool that is in Qt4.6.2 directory which is cross-compiled already. To know compiling Qt4.6.2, please have a look here).
Okay, on screen of Qt creator, choose "Tools" -> "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 (That directory is generated by cross-compiled Qt4.6.2, if possible, you can have a look cross-compiling Qt4.6.2 here). Okay, if there is no fault, you will see a noted line of "Found Qt version 4.6.2, 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 name "ex1" (click Next...next.. until face to Finish). In the IDE environment, drag "Label" and drop it in main window, change it into "hello world".
On task-bar, choose "Build" -> "Build All" to build the program. Click on "Run" button to see the result on Ubuntu, if there is no fault, you will receive a window appearing with "hello world" line.
To cross-compile program for mini2440, choose "Project" section located on the left. In "Building Setting", click "Release" on "Edit Build Configuration" part. At "General", choose "Show Details" button and choose "mini2440" (as the name I made before) in "Qt Version" section.
Okay, now you could cross-compile program for mini2440 by: "Build" -> "Set Build Configuration" -> "Release", then "Build" -> (MUST CHOOSE) "Rebuild All". 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):
/home/phuc/ex4/ex4 exited with code 255
Okay, now you can use SDcard to copy ex1 program into mini2440 and run it with command:
$ ./ex1 -qws
Normally, it will run as in Ubuntu.
3. Loading automatically my own program before qtopia
The first thing we should do is to stop qtopia, do this:
$cd /etc/init.d/ $vi rcS
Comment last three lines:
#echo" "> /dev/tty1
#echo"Starting Qtopia, please waiting..." > /dev/tty1
Reset the board, you will see that there is no qtopia desktop anymore but a black screen.
The second thing we do is to add the code to run our own program, for example, our program has a name as "ex1" and it is located in /mnt/ex1. In this step, we will make some changes from the files in article Upgrade Qt4.6.2
Cut those line:
Close and save it. Then:
Paste above lines into the end of this rcS file, and add following line into the end of rcS file too
Close and save it. Reset the board, the program ex1 will be loaded automatically instead of Qtopia.