Qt SDK
Qt is a cross-platform application framework that is used for developing application software with a graphical user interface (GUI).
Qt Creator is a cross-platform C++ IDE, it includes a visual debugger and an integrated GUI layout and forms designer.
The versions used in this SDK are Qt SDK 4.7.4 and Qt Creator 2.4.0.
It is possible to compile applications for x86 and ARM processors.
You can debug the program on the virtual machine or on Pengwyn Board.
Note
Before reading this Chapter you should be able to use HOB, bitbake, and minicom (or a similar program).
Build image with qt
- With HOB or bitbake build qt4e-demo-image. To see how to do this, refer to How to use HOB and/or How to use Poky Chapters.
- Once the image has been built (and assuming your current build directory is /home/architech/architech_sdk/architech/pengwyn/yocto/build/), run the following commands:
cd /home/architech/architech_sdk/architech/pengwyn/sysroot/
sudo rm -rf *
cp /home/architech/architech_sdk/architech/pengwyn/yocto/build/tmp/deploy/images/qt4e-demo-image-pengwyn.tar.gz .
sudo tar -xzf qt4e-demo-image-pengwyn.tar.gz
- Open file /home/architech/architech_sdk/architech/pengwyn/sysroot/etc/inittab and comment line 41:
# 1:2345:respawn:/sbin/getty 38400 tty1
this allows a USB keyboard to be seen by your Qt application.
- We don’t need the qt demo application to start at boot, run the following command:
sudo rm /home/architech/architech_sdk/architech/pengwyn/sysroot/etc/init.d/qt4demo
Debug Hello World project on pengwyn board
- Select build configuration: Qt 4.7.4 (Qt-4.7.4-arm) Debug and build the project.
- Copy the generated executable to ~/architech_sdk/architech/pengwyn/sysroot/home/root.
sudo cp ~/architech_sdk/architech/pengwyn/workspace/qt/QtHelloWorld-build-desktop-Qt_4_7_4__Qt-4_7_4-arm__Debug/QtHelloWorld ~/architech_sdk/architech/pengwyn/sysroot/home/root
- Copy all files from ~/architech_sdk/architech/pengwynsysroot to rootfs of the sdcard.
sudo cp -r * /media/path/to/rootfs
Then turn on the pengwyn board.
- Use minicom to launch gdbserver application on the target board:
gdbserver :10000 QtHelloWorld -qws
In Qt Creator, open the source file main.cpp and set a breakpoint at line 6.
To do this go with the mouse at line 6 and click with the right button to open the menu, select Set brackpoint at line 6
- Go to Debug→Start Debugging→Attach To Remote Debug Server, a form named “Start Debugger” will appear, insert the following data:
- Debugger: /opt/poky/1.2.1/sysroots/i686-pokysdk-linux/usr/bin/armv5te-poky-linux-gnueabi/arm-poky-linux-gnueabi-gdb
- Local executable: /home/architech/architech_sdk/architech/pengwyn/workspace/qt/QtHelloWorld-build-desktop-Qt_4_7_4__Qt-4_7_4-arm__Debug/QtHelloWorld
- Host and port: 192.168.0.10:10000
- Architecture: arm
- GNU target: auto
- Sysroot: /home/architech/architech_sdk/architech/pengwyn/sysroot
Press OK button to start the debug.
- The hotkeys to debug the application are:
- F10: Step over
- F11: Step into
- Shift + F11: Step out
- F5: Continue, or press this icon:
- To successfully exit from the debug it is better to close the graphical application from the target board with the mouse by clicking on the ‘X’ symbol.