Difference between revisions of "Qt/Embedded"

From ArmadeusWiki
Jump to: navigation, search
(Work in progress / to do list)
m (Embedded system configuration)
 
(36 intermediate revisions by 7 users not shown)
Line 6: Line 6:
  
 
You will also find instructions to setup a Host development environment for simulating applications before deploying them on the target (Qt virtual frame buffer). The Builroot tree must be installed before the installation of Qt.
 
You will also find instructions to setup a Host development environment for simulating applications before deploying them on the target (Qt virtual frame buffer). The Builroot tree must be installed before the installation of Qt.
 +
 +
{{Note| We recommand at least 32 MBytes of RAM if you plan to design and run Qt based GUIs.}}
  
 
==Installation==
 
==Installation==
 +
 +
 +
{{Note| If you are using '''Armadeus BSP 5.2''' version or less, you must modify Qt FTP URL in ''buildroot/package/qt/qt.mk'':
 +
<pre>
 +
# Replace line16:
 +
QT_SITE    = http://get.qt.nokia.com/qt/source
 +
# By:
 +
QT_SITE    = ftp://ftp.qt-project.org/qt/source/
 +
</pre>
 +
}}
  
 
From November 20th 2007, Qt Embedded is now fully integrated in Armadeus Buildroot (old procedure is kept [[QtEmbedded Installation|here]]). So to install it you have to:
 
From November 20th 2007, Qt Embedded is now fully integrated in Armadeus Buildroot (old procedure is kept [[QtEmbedded Installation|here]]). So to install it you have to:
Line 13: Line 25:
 
  [armadeus]$ make menuconfig
 
  [armadeus]$ make menuconfig
 
</pre>
 
</pre>
{{BuildrootPackageGraphicsConfig}}
+
<pre class="config">
<br> and then
+
[*] Package Selection for the target  --->
 
+
  [*] Graphic libraries and applications (graphic/text)  --->
[[Image:Menuconfig_package_qtopia.png]]
+
    *** other GUIs ***
 +
    [*]  Qt  --->
 +
        --- Qt
 +
        [ ]   Compile with debug support
 +
              Library type (Shared library)  --->
 +
        [*]   Approve free license
 +
        [ ]  Compatibility with Qt3
 +
        [*]  Gui Module
 +
                Pixel depths  --->
 +
                Fonts  --->
 +
                freetype2 support (no freetype2 support)  --->
 +
        [*]    Enable GIF support
 +
        [ ]    Enable libmng support
 +
                JPEG support (System libjpeg)  --->
 +
                PNG support (No PNG support)  --->
 +
                TIFF support (No TIFF support)  --->
 +
              zlib support (Qt zlib)  --->
 +
        (arm) The embedded platform we are making Qt for
 +
        [ ]  SQL Module  --->
 +
              Graphics drivers  --->
 +
              Mouse drivers  --->
 +
              Keyboard drivers  --->
 +
        [ ]  Phonon Module
 +
        [*]  XML Module
 +
        [ ]    XML Patterns Module
 +
        [ ]  SVG Module
 +
        -*-  Network Module
 +
        [ ]    WebKit Module
 +
        [ ]  STL support
 +
        [ ]  Enable OpenSSL support
 +
        [*]  Script Module
 +
        [ ]    Script Tools Module
 +
</pre>
  
'''(don't forget -depths 8,16 option)'''
+
'''(don't forget Pixel depths submenu options (at least 8 and 16))'''
  
 
*If you want touchscreen support:
 
*If you want touchscreen support:
Line 32: Line 76:
  
 
1 hour and ~1 GBytes later (depending on your system and the configuration you choosed) your will have the beast. You can then reflash your rootfs.
 
1 hour and ~1 GBytes later (depending on your system and the configuration you choosed) your will have the beast. You can then reflash your rootfs.
 +
 +
==Compilation for QVFB (Embedded x86/64)==
 +
* Get an Qt source archive from [ftp://ftp.qt.nokia.com/ Nokia FTP]
 +
* Untar the archive into a compilation directory.
 +
* Go into the source directory.
 +
* Use following command to configure Qt:
 +
** Other configuration options can be used, but the following are essential:
 +
<pre class="host">
 +
$ ./configure -depths 16,18 -embedded x86 -prefix /usr/local/Trolltech/QtEmbedded-4.7.2 -fast
 +
</pre>
 +
 +
* Then compile and install Qt:
 +
<pre class="host">
 +
$ make
 +
$ sudo make install
 +
</pre>
 +
 +
==Touchscreen handling==
 +
 +
===Qt configuration===
 +
 +
*If you manually build Qt, you have to add the USB keyboard driver option in the configuration:
 +
<pre class="host">
 +
$ configure -qt-kbd-linuxinput
 +
</pre>
 +
 +
*If you let Buildroot build Qt, select the USB keyboard option in the configuration menu:
 +
<pre class="config">
 +
[*] Graphic libraries and applications (graphic/text)  --->
 +
    *** other GUIs ***
 +
    [*]  Qt  --->
 +
        --- Qt
 +
        ...
 +
              Mouse drivers  --->
 +
                [*] tslib
 +
        ...
 +
</pre>
 +
 +
===Linux configuration===
 +
 +
To use a touchscreen, there are some drivers to install in Linux.
 +
 +
*First open the Linux configuration menu:
 +
<pre class="host">
 +
[armadeus]$ make linux-menuconfig
 +
</pre>
 +
 +
*Select the driver corresponding to your touchscreen in the menu:
 +
<pre class="config">
 +
Device drivers  --->
 +
    ...
 +
    Input device support  --->
 +
        ...
 +
              *** Input Device Drivers ***
 +
        [*]  Touchscreens  --->
 +
            --- Touchscreens
 +
            < >  ADS7846/TSC2046/AD7873 and AD(S)7843 based touchscreens
 +
            < >  AD7877 based touchscreens
 +
            < >  AD7879 based touchscreens: AD7879-1 I2C Interface
 +
            ...
 +
        ...
 +
    ...
 +
</pre>
 +
 +
*Then clean your Linux installation and rebuild it:
 +
<pre class="host">
 +
[armadeus]$ make linux-clean
 +
[armadeus]$ make linux
 +
[armadeus]$ make
 +
</pre>
 +
 +
===Embedded system configuration===
 +
* Configure your touchscreen by loading the corresponding driver (depends on your APF) and calibrating it (at first use)
 +
* Then, before launching Qt app, do
 +
<pre class="apf">
 +
# export QWS_MOUSE_PROTO="Tslib:/dev/input/eventX"        (replace X with the right number)
 +
</pre>
 +
 +
==Keyboard handling==
 +
 +
===USB Keyboard===
 +
 +
====Qt configuration====
 +
 +
*If you manually build Qt, you have to add the USB keyboard driver option in the configuration:
 +
<pre class="host">
 +
$ configure -qt-kbd-linuxinput
 +
</pre>
 +
 +
*If you let Buildroot build Qt, select the USB keyboard option in the configuration menu:
 +
<pre class="config">
 +
[*] Graphic libraries and applications (graphic/text)  --->
 +
    *** other GUIs ***
 +
    [*]  Qt  --->
 +
        --- Qt
 +
        ...
 +
              Mouse drivers  --->
 +
              Keyboard drivers  --->
 +
                  [ ] tty
 +
                  [*] linux input
 +
                  [ ] qvfb
 +
        ...
 +
</pre>
 +
 +
====Linux configuration====
 +
 +
To use USB keyboard, there are some drivers to install in Linux.
 +
 +
*First open the Linux configuration menu:
 +
<pre class="host">
 +
[armadeus]$ make linux-menuconfig
 +
</pre>
 +
 +
*Select the keyboard drivers in the menu:
 +
<pre class="config">
 +
Device drivers  --->
 +
    ...
 +
    Input device support  --->
 +
        ...
 +
              *** Input Device Drivers ***
 +
        [*]  Keyboards  --->
 +
            --- Keyboards
 +
            <*>    AT keyboard
 +
            < >    Sun Type 4 and Type 5 keyboard
 +
            < >    DECstation/VAXstation LK201/LK401 keyboard
 +
            < >    XT keyboard
 +
            <M>    Freescale MXC/IMX keypad support
 +
            < >    Newton keyboard
 +
            < >    Stowaway keyboard
 +
            < >    GPIO Button
 +
        [*]  Mice  --->
 +
        ...
 +
    ...
 +
</pre>
 +
 +
*Then clean your Linux installation and rebuild it:
 +
<pre class="host">
 +
[armadeus]$ make linux-clean
 +
[armadeus]$ make linux
 +
[armadeus]$ make
 +
</pre>
 +
 +
====Embedded system configuration====
 +
 +
* First flash your new kernel and rootfs and boot the system.
 +
* When you connect the USB keyboard to the system, a device is created in '''/dev/input/eventX'''.
 +
* Then you can tell Qt which driver to connect to the device to make it work:
 +
<pre class="apf">
 +
# export QWS_KEYBOARD="LinuxInput:/dev/input/eventX"
 +
</pre>
 +
 +
* Then you can launch an application and use your USB keyboard with it.
 +
 +
More infos are provided here: [http://doc.qt.nokia.com/4.7-snapshot/qt-embedded-charinput.html]
 +
 +
==Mouse handling==
 +
 +
===USB Mouse===
 +
 +
====Qt configuration====
 +
 +
*If you manually build Qt, you have to add the USB mouse driver option in the configuration:
 +
<pre class="host">
 +
$ configure -qt-mouse-pc .......
 +
</pre>
 +
 +
*If you let Buildroot build Qt, select the USB mouse option in the configuration menu:
 +
<pre class="config">
 +
[*] Graphic libraries and applications (graphic/text)  --->
 +
    *** other GUIs ***
 +
    [*]  Qt  --->
 +
        --- Qt
 +
        ...
 +
              Graphics drivers  --->
 +
              Mouse drivers  --->
 +
                  [*] pc
 +
                  [ ] bus
 +
                  [ ] linuxtp
 +
                  [ ] yopy
 +
                  [ ] vr41xx
 +
                  [ ] tslib
 +
                  [ ] qvfb
 +
              Keyboard drivers  --->
 +
        ...
 +
</pre>
 +
 +
*Then build & install Qt or let Buildroot build.
 +
 +
====Linux configuration====
 +
 +
To use USB mouse, there are some drivers to install in Linux.
 +
 +
*First open the Linux configuration menu:
 +
<pre class="host">
 +
[armadeus]$ make linux-menuconfig
 +
</pre>
 +
 +
*Select the Mouse interface and PS/2 Mouse drivers in the menu:
 +
<pre class="config">
 +
Device drivers  --->
 +
    ...
 +
    Input device support  --->
 +
        ...
 +
              *** Userland interfaces ***
 +
        <*>  Mouse interface
 +
        [*]    Provide legacy /dev/psaux device
 +
        (1024)  Horizontal screen resolution
 +
        (768)  Vertical screen resolution
 +
        ...
 +
              *** Input Device Drivers ***
 +
        [ ]  Keyboards  --->
 +
        [*]  Mice  --->
 +
            --- Mice
 +
            <M>  PS/2 mouse
 +
            [*]    ALPS PS/2 mouse protocol extension
 +
            [*]    Logitech PS/2++ mouse protocol extension
 +
            [*]    Synaptics PS/2 mouse protocol extension
 +
            [*]    IBM Trackpoint PS/2 mouse protocol extension
 +
            [ ]    Elantech PS/2 protocol extension
 +
            [ ]    eGalax TouchKit PS/2 protocol extension
 +
            ...
 +
</pre>
 +
 +
*Then clean your Linux installation and rebuild it:
 +
<pre class="host">
 +
[armadeus]$ make linux-clean
 +
[armadeus]$ make linux
 +
[armadeus]$ make
 +
</pre>
 +
 +
====Embedded system configuration====
 +
 +
* First flash your new kernel and rootfs and boot the system.
 +
* When you connect the USB mouse to the system, a device is created in '''/dev/input/mouseXX'''. The touchscreen devices are also created as '''/dev/input/eventXX'''.
 +
* To know which device is the USB mouse one, you have to check in:
 +
<pre class="apf">
 +
# cat /sys/class/input/mouseXX/device/name
 +
</pre>
 +
* Then you can tell Qt which driver to connect to the device to make it work:
 +
**If you want the USB mouse only:
 +
<pre class="apf">
 +
# export QWS_MOUSE_PROTO="MouseMan:/dev/input/mouseXX"
 +
</pre>
 +
** For multiple pointer inputs, for example if you want to use an USB mouse along with a touchscreen, list all the possible pointers as follow:
 +
<pre class="apf">
 +
# export QWS_MOUSE_PROTO="MouseMan:/dev/input/mouseXX Tslib:/dev/input/eventXX"
 +
</pre>
 +
 +
{{Note| For a dynamic detection of an USB mouse, you can use the automatic driver like this:
 +
<pre class="apf">
 +
# export QWS_MOUSE_PROTO="Tslib:/dev/input/eventXX Auto"
 +
</pre>
 +
}}
 +
 +
* Then you can launch an application and use your USB mouse with it.
 +
 +
More infos are provided  here: [http://doc.qt.nokia.com/4.6/qt-embedded-pointer.html]
 +
 +
==Screen rotation==
 +
* activate it with : ''-qt-gfx-transformed'' (from buildroot menuconfig),
 +
* to use it on the command line (for example 270°) : ''-display transformed:rot270''
 +
* or export the variable (for example 270°) : ''export QWS_DISPLAY=Transformed:Rot270.0
 +
''
  
 
==Test==
 
==Test==
Line 66: Line 373:
  
 
== How to cross-compile an application using Qt Embedded ==
 
== How to cross-compile an application using Qt Embedded ==
 
{{Warning|FOLLOWING INSTRUCTIONS ARE OBSOLETE AND NEED TO BE CHECKED !!}}
 
  
 
The first thing you need to do is to define a specific "'''qmake''' specs directory" for armadeus. Here for example:
 
The first thing you need to do is to define a specific "'''qmake''' specs directory" for armadeus. Here for example:
  
  mkdir $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++
+
  $ mkdir $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++
  
 
and install the two following files into this new directory:  [http://www.armadeus.com/assos_downloads/qt/qmake.conf qmake.conf] & [http://www.armadeus.com/assos_downloads/qt/qplatformdefs.h qplatformdefs.h]. '''qmake.conf''' may be customized if necessary.  
 
and install the two following files into this new directory:  [http://www.armadeus.com/assos_downloads/qt/qmake.conf qmake.conf] & [http://www.armadeus.com/assos_downloads/qt/qplatformdefs.h qplatformdefs.h]. '''qmake.conf''' may be customized if necessary.  
Line 77: Line 382:
  
 
Then, you must define two typical environment variables :  
 
Then, you must define two typical environment variables :  
'''QTDIR''' which defines the Qtopia installation path  
+
'''QTDIR''' which defines the Qt installation path  
 
& '''QMAKESPEC''' which defines the path to the configuration files of the '''qmake''' tool  
 
& '''QMAKESPEC''' which defines the path to the configuration files of the '''qmake''' tool  
  
 
Here two typical lines of a Qtopia application building script
 
Here two typical lines of a Qtopia application building script
  
  export QTDIR=/home/demo/demos/Buitinqt/buildroot/build_armv4t/qtopia-core-opensource-src-4.3.1/
+
  $ export QTDIR=/usr/local/Trolltech/QtEmbedded-4.5.3
  export QMAKESPEC= $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++
+
  $ export QMAKESPEC= $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++
  
 
Adapt the '''QTDIR''' path to your own installation path and compile your code now, using theses commands:
 
Adapt the '''QTDIR''' path to your own installation path and compile your code now, using theses commands:
  
 
  # build the makefile with the '''qmake''' command (See Trolltech documentation for details about '''qmake'''):
 
  # build the makefile with the '''qmake''' command (See Trolltech documentation for details about '''qmake'''):
  qmake -spec $QMAKESPEC my.pro
+
  $QTDIR/bin/qmake -spec my.pro
 
  # and now compile the beast... :
 
  # and now compile the beast... :
  make
+
  $ make
  
 
Good luck....
 
Good luck....
 +
 +
== Phonon installation with Qt Embedded ==
 +
 +
=== Prerequisites ===
 +
In order to use Phonon with Qt, first you need to install some other libraries.
 +
You may even need to cross-compile them, depending on the platform you want to run Qt on.
 +
 +
==== For x86 platform ====
 +
*You only have to install GStreamer and some plugins with the following command :
 +
<pre class="host">
 +
$ sudo apt-get install libgstreamer0.10-0
 +
$ sudo apt-get install libgstreamer0.10-dev
 +
$ sudo apt-get install libgstreamer-plugins-base0.10-0
 +
$ sudo apt-get install libgstreamer-plugins-base0.10-dev
 +
</pre>
 +
{{Note | These packages are available for Linux Ubuntu ; but for other distributions, the names may vary.}}
 +
 +
*To use some audio, image or video format like mp3, mpeg2, png or ogg:
 +
**First you must install on your system the needed libraries for the particular format you want (like libmpeg2, libpng, libmad...)
 +
**Then you can install these gstreamer plugins:
 +
<pre class="host">
 +
$ sudo apt-get install gstreamer0.10-plugins-good
 +
$ sudo apt-get install gstreamer0.10-plugins-ugly
 +
</pre>
 +
There also are other plugin packages which you can find the list at :
 +
[http://gstreamer.freedesktop.org/documentation/ GStreamer]
 +
 +
==== For embedded platform ====
 +
If you want to build Qt with Phonon for embedded platform, you'll need to cross-compile the following libraries for the same platform:
 +
*libxml2 >= 2.7.7
 +
*libcheck >= 0.9.8
 +
*liboil >= 0.3.2
 +
*gstreamer >= 0.10.0
 +
*gst-plugins-base >= 0.10.0
 +
 +
There are some required libraries that you can compile and install with Buildroot:
 +
*glib >= 2.16
 +
*Optional:
 +
**libpng
 +
**tiff
 +
**jpeg
 +
**...
 +
 +
For additional audio and video formats, you have to cross-compile the corresponding libraries and then the following gstreamer's plugins :
 +
*gst-plugins-good >= 0.10.0
 +
*gst-plugins-ugly >= 0.10.0
 +
 +
=== Cross-compiling libraries ===
 +
*First thing to do is to set the PKG_CONFIG_PATH environment variable to the directories containing your embedded libraries' pkgconfig files.
 +
 +
*To see what environment variable you can modify to impact the library cross-compiling, enter the command :
 +
<pre class="host">
 +
$ ./configure --help
 +
</pre>
 +
Then create a file to define all required environment variables for the cross-compiling.
 +
For instance for glib2:
 +
<pre class="config">
 +
$ export CC=arm-linux-gcc
 +
$ export CXX=arm-linux-g++
 +
$ export CFLAGS="-I/usr/local/libxml2/include/libxml2"
 +
$ export LDFLAGS=-L/usr/local/libxml2/lib
 +
</pre>
 +
And then, to create your environment, type :
 +
<pre class="host">
 +
$ source ENVIRONMENT_FILE
 +
</pre>
 +
 +
*Finally you can configure your library like this:
 +
<pre class="host">
 +
$ ./configure --build=x86-linux --host=YOUR_EMBEDDED_PLATFORM --prefix==YOUR_INSTALLATION_PATH
 +
</pre>
 +
Then build and install the library.
 +
 +
=== Build Qt ===
 +
 +
==== For x86 platform ====
 +
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer's and glib's x86 libraries and headers.
 +
 +
All you need to do then is to configure Qt with the phonon option and its backend :
 +
<pre class="host">
 +
$ ./configure -embedded x86 -debug -no-cups -no-nis -depths 16,18,24 -no-qt3support -qvfb -phonon -phonon-backend -prefix YOUR_INSTALLATION_PATH -confirm-license
 +
</pre>
 +
 +
Then build and install Qt and you will be able to use Phonon on your x86 platform.
 +
 +
==== For embedded platform ====
 +
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer's and glib's embedded libraries and headers.
 +
 +
Then you can configure Qt with glib, phonon and its backend and by adding the pkgconfig option :
 +
<pre class="host">
 +
$ ./configure -embedded YOUR_EMBEDDED_PLATFORM -xplatform YOUR_PLATFORM_MKSPECS -depths 16,18 -no-cups -no-nis -no-qt3support -phonon -phonon-backend -glib -prefix YOUR_INSTALLATION_PATH -force-pkg-config
 +
</pre>
 +
 +
{{Note | You may need to give the cross-compiler the paths toward gstreamer's and glib's libraries and headers as configuration options.}}
 +
 +
=== Possible problems encountered ===
 +
During Qt Embedded or prerequisited cross-compiling, you may get the following errors :
 +
 +
*''Impossible constraint in 'asm''':
 +
It means you include the wrong headers needed by the library you compile in CFLAGS or CXXFLAGS. Do not include -I/usr/include or non-cross-compiled headers.
 +
 +
*''Cannot run test program'':
 +
Your best shot is to look in configure.ac (or configure.in) and see if
 +
there's a "cache variable" for that test. If so, you can set that
 +
variable in your environment, to the expected answer for your target,
 +
before running configure, and it should bypass the actual test.
 +
If there's no cache variable, you'll need to modify configure.ac (or
 +
configure.in) to set the variable manually, and rebuild configure.
 +
 +
*Do not forget to set your PKG_CONFIG_PATH variable to point toward the directory containing your embedded library pkgconfig files. By default, the x86 pkgconfig files are checked and so, errors occur.
 +
 +
*When installing libraries : ''arm-linux-g++: command not found''
 +
You have to directly export the PATH toward your cross-compiler in the file libtool to get through this error.
 +
 +
*In gst-plugins-base, delete manually the compilation of ''icles'' in the file tests/Makefile. The lines to delete are l.377 and l.382.
 +
 +
== VNC ==
 +
 +
* You can have a VNC server linked to a Qt application.
 +
 +
=== Qt configuration ===
 +
 +
*If you manually build Qt, you have to add the VNC server option in the configuration:
 +
<pre class="host">
 +
$ configure -qt-gfx-vnc
 +
</pre>
 +
 +
*If you let Buildroot build Qt, select the VNC server option in the configuration menu:
 +
<pre class="config">
 +
[*] Graphic libraries and applications (graphic/text)  --->
 +
    *** other GUIs ***
 +
    [*]  Qt  --->
 +
        --- Qt
 +
        ...
 +
              Graphics drivers --->
 +
                  ...
 +
                  [ ] Qt Virtual Framebuffer
 +
                  [*] VNC
 +
                  [ ] multiscreen
 +
        ...
 +
</pre>
 +
 +
=== Run a VNC server on embedded system ===
 +
 +
* When you execute a Qt application, run it with the following options:
 +
<pre class="apf">
 +
# ./application -qws -display VNC:0
 +
</pre>
 +
 +
* You can replace 0 in the command by any number, that will correspond to the VNC server ID, that you have to use in a VNC client to connect.
 +
 +
* Now you can launch a VNC client and connect.
  
 
== Work in progress / to do list ==
 
== Work in progress / to do list ==
Line 107: Line 564:
 
* [http://doc.trolltech.com/4.2/qtopiacore-envvars.html Qtopia Core Environment Variables]
 
* [http://doc.trolltech.com/4.2/qtopiacore-envvars.html Qtopia Core Environment Variables]
 
* [http://thelins.se/learnqt/category/embedded-linux/ Tutorial on Qt setup for embedded devt]
 
* [http://thelins.se/learnqt/category/embedded-linux/ Tutorial on Qt setup for embedded devt]
 
+
* [http://qt-project.org/doc/qt-4.8/qt-embedded-vnc.html Qt's VNC server]
{{LanguageBar|Qt/Embedded|Qt/Embarqué|Qt/Embedded}}
+
  
 
[[Category: Qt]]
 
[[Category: Qt]]
 
[[Category: Software]]
 
[[Category: Software]]
 
[[Category: Graphical User Interface]]
 
[[Category: Graphical User Interface]]

Latest revision as of 15:58, 3 November 2016

Instructions to install and use QtEmbedded & Qt virtual frame buffer for Armadeus

Introduction

This page will summarize the process to build, install and use Qt Embedded (previously known as Qtopia).

You will also find instructions to setup a Host development environment for simulating applications before deploying them on the target (Qt virtual frame buffer). The Builroot tree must be installed before the installation of Qt.

Note Note: We recommand at least 32 MBytes of RAM if you plan to design and run Qt based GUIs.


Installation

Note Note: If you are using Armadeus BSP 5.2 version or less, you must modify Qt FTP URL in buildroot/package/qt/qt.mk:
# Replace line16:
QT_SITE    = http://get.qt.nokia.com/qt/source
# By:
QT_SITE    = ftp://ftp.qt-project.org/qt/source/


From November 20th 2007, Qt Embedded is now fully integrated in Armadeus Buildroot (old procedure is kept here). So to install it you have to:

 [armadeus]$ make menuconfig
[*] Package Selection for the target  --->
  [*] Graphic libraries and applications (graphic/text)  --->
    *** other GUIs ***
    [*]   Qt  --->
        --- Qt
        [ ]   Compile with debug support
              Library type (Shared library)  --->
        [*]   Approve free license
        [ ]   Compatibility with Qt3
        [*]   Gui Module
                Pixel depths  --->
                Fonts  --->
                freetype2 support (no freetype2 support)  --->
        [*]     Enable GIF support
        [ ]     Enable libmng support
                JPEG support (System libjpeg)  --->
                PNG support (No PNG support)  --->
                TIFF support (No TIFF support)  --->
              zlib support (Qt zlib)  --->
        (arm) The embedded platform we are making Qt for
        [ ]   SQL Module  ---> 
              Graphics drivers  --->
              Mouse drivers  --->
              Keyboard drivers  --->
        [ ]   Phonon Module
        [*]   XML Module 
        [ ]     XML Patterns Module
        [ ]   SVG Module
        -*-   Network Module
        [ ]     WebKit Module
        [ ]   STL support
        [ ]   Enable OpenSSL support
        [*]   Script Module
        [ ]     Script Tools Module

(don't forget Pixel depths submenu options (at least 8 and 16))

  • If you want touchscreen support:
    Mouse drivers  --->
        ...
        [*] tslib

then:

 [armadeus]$ make

1 hour and ~1 GBytes later (depending on your system and the configuration you choosed) your will have the beast. You can then reflash your rootfs.

Compilation for QVFB (Embedded x86/64)

  • Get an Qt source archive from Nokia FTP
  • Untar the archive into a compilation directory.
  • Go into the source directory.
  • Use following command to configure Qt:
    • Other configuration options can be used, but the following are essential:
$ ./configure -depths 16,18 -embedded x86 -prefix /usr/local/Trolltech/QtEmbedded-4.7.2 -fast
  • Then compile and install Qt:
$ make
$ sudo make install

Touchscreen handling

Qt configuration

  • If you manually build Qt, you have to add the USB keyboard driver option in the configuration:
$ configure -qt-kbd-linuxinput
  • If you let Buildroot build Qt, select the USB keyboard option in the configuration menu:
[*] Graphic libraries and applications (graphic/text)  --->
    *** other GUIs ***
    [*]   Qt  --->
        --- Qt
        ...
              Mouse drivers  --->
                [*] tslib
        ...

Linux configuration

To use a touchscreen, there are some drivers to install in Linux.

  • First open the Linux configuration menu:
[armadeus]$ make linux-menuconfig
  • Select the driver corresponding to your touchscreen in the menu:
Device drivers  --->
    ...
    Input device support  --->
        ...
              *** Input Device Drivers ***
        [*]   Touchscreens  --->
            --- Touchscreens
            < >   ADS7846/TSC2046/AD7873 and AD(S)7843 based touchscreens
            < >   AD7877 based touchscreens
            < >   AD7879 based touchscreens: AD7879-1 I2C Interface
            ...
        ...
    ...
  • Then clean your Linux installation and rebuild it:
[armadeus]$ make linux-clean
[armadeus]$ make linux
[armadeus]$ make

Embedded system configuration

  • Configure your touchscreen by loading the corresponding driver (depends on your APF) and calibrating it (at first use)
  • Then, before launching Qt app, do
# export QWS_MOUSE_PROTO="Tslib:/dev/input/eventX"         (replace X with the right number)

Keyboard handling

USB Keyboard

Qt configuration

  • If you manually build Qt, you have to add the USB keyboard driver option in the configuration:
$ configure -qt-kbd-linuxinput
  • If you let Buildroot build Qt, select the USB keyboard option in the configuration menu:
[*] Graphic libraries and applications (graphic/text)  --->
    *** other GUIs ***
    [*]   Qt  --->
        --- Qt
        ...
              Mouse drivers  --->
              Keyboard drivers  --->
                  [ ] tty
                  [*] linux input
                  [ ] qvfb
        ...

Linux configuration

To use USB keyboard, there are some drivers to install in Linux.

  • First open the Linux configuration menu:
[armadeus]$ make linux-menuconfig
  • Select the keyboard drivers in the menu:
Device drivers  --->
    ...
    Input device support  --->
        ...
              *** Input Device Drivers ***
        [*]   Keyboards  --->
            --- Keyboards
            <*>     AT keyboard
            < >     Sun Type 4 and Type 5 keyboard
            < >     DECstation/VAXstation LK201/LK401 keyboard
            < >     XT keyboard
            <M>     Freescale MXC/IMX keypad support
            < >     Newton keyboard
            < >     Stowaway keyboard 
            < >     GPIO Button
        [*]   Mice  ---> 
        ...
    ...
  • Then clean your Linux installation and rebuild it:
[armadeus]$ make linux-clean
[armadeus]$ make linux
[armadeus]$ make

Embedded system configuration

  • First flash your new kernel and rootfs and boot the system.
  • When you connect the USB keyboard to the system, a device is created in /dev/input/eventX.
  • Then you can tell Qt which driver to connect to the device to make it work:
# export QWS_KEYBOARD="LinuxInput:/dev/input/eventX"
  • Then you can launch an application and use your USB keyboard with it.

More infos are provided here: [1]

Mouse handling

USB Mouse

Qt configuration

  • If you manually build Qt, you have to add the USB mouse driver option in the configuration:
$ configure -qt-mouse-pc .......
  • If you let Buildroot build Qt, select the USB mouse option in the configuration menu:
[*] Graphic libraries and applications (graphic/text)  --->
    *** other GUIs ***
    [*]   Qt  --->
        --- Qt
        ...
              Graphics drivers  --->
              Mouse drivers  --->
                  [*] pc
                  [ ] bus
                  [ ] linuxtp
                  [ ] yopy
                  [ ] vr41xx
                  [ ] tslib
                  [ ] qvfb
              Keyboard drivers  --->
        ...
  • Then build & install Qt or let Buildroot build.

Linux configuration

To use USB mouse, there are some drivers to install in Linux.

  • First open the Linux configuration menu:
[armadeus]$ make linux-menuconfig
  • Select the Mouse interface and PS/2 Mouse drivers in the menu:
Device drivers  --->
    ...
    Input device support  --->
        ...
              *** Userland interfaces ***
        <*>   Mouse interface 
        [*]     Provide legacy /dev/psaux device
        (1024)  Horizontal screen resolution
        (768)   Vertical screen resolution
        ...
              *** Input Device Drivers ***
        [ ]   Keyboards  ---> 
        [*]   Mice  ---> 
            --- Mice
            <M>   PS/2 mouse
            [*]     ALPS PS/2 mouse protocol extension
            [*]     Logitech PS/2++ mouse protocol extension
            [*]     Synaptics PS/2 mouse protocol extension
            [*]     IBM Trackpoint PS/2 mouse protocol extension
            [ ]     Elantech PS/2 protocol extension
            [ ]     eGalax TouchKit PS/2 protocol extension 
            ...
  • Then clean your Linux installation and rebuild it:
[armadeus]$ make linux-clean
[armadeus]$ make linux
[armadeus]$ make

Embedded system configuration

  • First flash your new kernel and rootfs and boot the system.
  • When you connect the USB mouse to the system, a device is created in /dev/input/mouseXX. The touchscreen devices are also created as /dev/input/eventXX.
  • To know which device is the USB mouse one, you have to check in:
# cat /sys/class/input/mouseXX/device/name
  • Then you can tell Qt which driver to connect to the device to make it work:
    • If you want the USB mouse only:
# export QWS_MOUSE_PROTO="MouseMan:/dev/input/mouseXX"
    • For multiple pointer inputs, for example if you want to use an USB mouse along with a touchscreen, list all the possible pointers as follow:
# export QWS_MOUSE_PROTO="MouseMan:/dev/input/mouseXX Tslib:/dev/input/eventXX"
Note Note: For a dynamic detection of an USB mouse, you can use the automatic driver like this:
# export QWS_MOUSE_PROTO="Tslib:/dev/input/eventXX Auto"


  • Then you can launch an application and use your USB mouse with it.

More infos are provided here: [2]

Screen rotation

  • activate it with : -qt-gfx-transformed (from buildroot menuconfig),
  • to use it on the command line (for example 270°) : -display transformed:rot270
  • or export the variable (for example 270°) : export QWS_DISPLAY=Transformed:Rot270.0

Test

If you want to test it, compile and put some examples in your TFTP directory:

$ make shell_env
$ source armadeus_env.sh
$ cd $ARMADEUS_QT_DIR/examples/widgets/
$ $ARMADEUS_QT_DIR/bin/qmake widgets.pro
$ make
...
$ cp digitalclock/digitalclock /tftpboot
$ cp calculator/calculator /tftpboot

and then launch it on your APF (supposed you have a running & calibrated touchscreen):

# cd /usr/bin/
# tftp -g -r calculator 192.168.0.xx (Host IP)
# chmod a+x calculator
# export QWS_MOUSE_PROTO="Tslib:/dev/input/event0"
# 
# ./calculator -qws

Demo

A client/server (with GUI) demo is available under: software/demos/ApfDacClientServer/. It could be a good starting point to show you how to create standalone Qt applications (will probably require some modifications in src/build.sh depending on your Host Qt installation).

GUI with widgets taken from http://www.qt-apps.org

Usage

By default Qt libraries are installed in /usr/lib/ directory of your target rootfs.

How to cross-compile an application using Qt Embedded

The first thing you need to do is to define a specific "qmake specs directory" for armadeus. Here for example:

$ mkdir $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++

and install the two following files into this new directory: qmake.conf & qplatformdefs.h. qmake.conf may be customized if necessary.


Then, you must define two typical environment variables : QTDIR which defines the Qt installation path & QMAKESPEC which defines the path to the configuration files of the qmake tool

Here two typical lines of a Qtopia application building script

$ export QTDIR=/usr/local/Trolltech/QtEmbedded-4.5.3
$ export QMAKESPEC= $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++

Adapt the QTDIR path to your own installation path and compile your code now, using theses commands:

# build the makefile with the qmake command (See Trolltech documentation for details about qmake):
$QTDIR/bin/qmake -spec my.pro
# and now compile the beast... :
$ make

Good luck....

Phonon installation with Qt Embedded

Prerequisites

In order to use Phonon with Qt, first you need to install some other libraries. You may even need to cross-compile them, depending on the platform you want to run Qt on.

For x86 platform

  • You only have to install GStreamer and some plugins with the following command :
$ sudo apt-get install libgstreamer0.10-0
$ sudo apt-get install libgstreamer0.10-dev
$ sudo apt-get install libgstreamer-plugins-base0.10-0
$ sudo apt-get install libgstreamer-plugins-base0.10-dev
Note Note: These packages are available for Linux Ubuntu ; but for other distributions, the names may vary.


  • To use some audio, image or video format like mp3, mpeg2, png or ogg:
    • First you must install on your system the needed libraries for the particular format you want (like libmpeg2, libpng, libmad...)
    • Then you can install these gstreamer plugins:
$ sudo apt-get install gstreamer0.10-plugins-good
$ sudo apt-get install gstreamer0.10-plugins-ugly

There also are other plugin packages which you can find the list at : GStreamer

For embedded platform

If you want to build Qt with Phonon for embedded platform, you'll need to cross-compile the following libraries for the same platform:

  • libxml2 >= 2.7.7
  • libcheck >= 0.9.8
  • liboil >= 0.3.2
  • gstreamer >= 0.10.0
  • gst-plugins-base >= 0.10.0

There are some required libraries that you can compile and install with Buildroot:

  • glib >= 2.16
  • Optional:
    • libpng
    • tiff
    • jpeg
    • ...

For additional audio and video formats, you have to cross-compile the corresponding libraries and then the following gstreamer's plugins :

  • gst-plugins-good >= 0.10.0
  • gst-plugins-ugly >= 0.10.0

Cross-compiling libraries

  • First thing to do is to set the PKG_CONFIG_PATH environment variable to the directories containing your embedded libraries' pkgconfig files.
  • To see what environment variable you can modify to impact the library cross-compiling, enter the command :
$ ./configure --help

Then create a file to define all required environment variables for the cross-compiling. For instance for glib2:

$ export CC=arm-linux-gcc
$ export CXX=arm-linux-g++
$ export CFLAGS="-I/usr/local/libxml2/include/libxml2"
$ export LDFLAGS=-L/usr/local/libxml2/lib

And then, to create your environment, type :

$ source ENVIRONMENT_FILE
  • Finally you can configure your library like this:
$ ./configure --build=x86-linux --host=YOUR_EMBEDDED_PLATFORM --prefix==YOUR_INSTALLATION_PATH

Then build and install the library.

Build Qt

For x86 platform

The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer's and glib's x86 libraries and headers.

All you need to do then is to configure Qt with the phonon option and its backend :

$ ./configure -embedded x86 -debug -no-cups -no-nis -depths 16,18,24 -no-qt3support -qvfb -phonon -phonon-backend -prefix YOUR_INSTALLATION_PATH -confirm-license

Then build and install Qt and you will be able to use Phonon on your x86 platform.

For embedded platform

The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer's and glib's embedded libraries and headers.

Then you can configure Qt with glib, phonon and its backend and by adding the pkgconfig option :

$ ./configure -embedded YOUR_EMBEDDED_PLATFORM -xplatform YOUR_PLATFORM_MKSPECS -depths 16,18 -no-cups -no-nis -no-qt3support -phonon -phonon-backend -glib -prefix YOUR_INSTALLATION_PATH -force-pkg-config
Note Note: You may need to give the cross-compiler the paths toward gstreamer's and glib's libraries and headers as configuration options.


Possible problems encountered

During Qt Embedded or prerequisited cross-compiling, you may get the following errors :

  • Impossible constraint in 'asm':

It means you include the wrong headers needed by the library you compile in CFLAGS or CXXFLAGS. Do not include -I/usr/include or non-cross-compiled headers.

  • Cannot run test program:

Your best shot is to look in configure.ac (or configure.in) and see if there's a "cache variable" for that test. If so, you can set that variable in your environment, to the expected answer for your target, before running configure, and it should bypass the actual test. If there's no cache variable, you'll need to modify configure.ac (or configure.in) to set the variable manually, and rebuild configure.

  • Do not forget to set your PKG_CONFIG_PATH variable to point toward the directory containing your embedded library pkgconfig files. By default, the x86 pkgconfig files are checked and so, errors occur.
  • When installing libraries : arm-linux-g++: command not found

You have to directly export the PATH toward your cross-compiler in the file libtool to get through this error.

  • In gst-plugins-base, delete manually the compilation of icles in the file tests/Makefile. The lines to delete are l.377 and l.382.

VNC

  • You can have a VNC server linked to a Qt application.

Qt configuration

  • If you manually build Qt, you have to add the VNC server option in the configuration:
$ configure -qt-gfx-vnc
  • If you let Buildroot build Qt, select the VNC server option in the configuration menu:
[*] Graphic libraries and applications (graphic/text)  --->
    *** other GUIs ***
    [*]   Qt  --->
        --- Qt
        ...
              Graphics drivers --->
                  ...
                  [ ] Qt Virtual Framebuffer
                  [*] VNC
                  [ ] multiscreen
        ...

Run a VNC server on embedded system

  • When you execute a Qt application, run it with the following options:
# ./application -qws -display VNC:0
  • You can replace 0 in the command by any number, that will correspond to the VNC server ID, that you have to use in a VNC client to connect.
  • Now you can launch a VNC client and connect.

Work in progress / to do list

  • Customization of the Qt libs to have a custom Qt/E library well designed for Armadeus usage.

Licenses

Since Qt 4.5.2 new licensing schemes are available: http://www.qtsoftware.com/products/licensing/licensing#qt-gnu-lgpl-v

Links