Qt Framework Demo Setup
From Texas Instruments Embedded Processors Wiki
Introduction
The AM18xx EVM ships with a preloaded boot image and filesystem that runs an interactive demonstration application at boot-up. This page discusses the components, how to rebuild the application from source on the host, and further steps that can be done with the application.
NOTE: The below steps are not required for using the demo. Binary application is already provided in the default File system.
Software Components
The AM18x demonstration application shows the usage of several features of the chipset, and its software components.
- The Linux kernel and its driver components, including the display driver and ALSA audio driver, and touchscreen
- Usage of a typical UI, based on Qt, running on the ARM core and interfacing with the various peripherals. Audio playback support can be enabled by rebuilding the Qt application as described below.
Visual components
The AM18xx demonstration consists of 3 screens - the Home screen, the Slideshow application, and an Automation HMI application. All of them are accessed through the touchscreen on the board.
1. The Home Screen
The home screen is shown when the application starts up. Other applications can be launched by pressing the icons of the required application in the task bar shown at the bottom - the Slideshow,or the automation applications. This screen can be returned from any of the other screens, by clicking on the Home icon.
2. The Slideshow application
The slideshow application shows the capability of the device using several slides that update at periodic intervals in a loop.
3. The Automation HMI application
This can be launched by clicking on the Automation Icon. The HMI application shows the animation capabilities of Qt, in a typical factory monitoring system. The system is interactive and the dials and the slider can be adjusted manually.
Recreating the demonstration application (from source)
Dependencies
Kernel
http://arago-project.org/git/people/?p=sekhar/linux-omapl1.git;a=summary
- Note that any kernel that works on the EVM (ex, as obtained from Getting Started Guide, can be used).
Arago Filesystem
- This filesystem contains the libts.so library, that is needed for the Qt application to work.
- Untar the file as root:
- host$ sudo tar -xvzf arago-demo-image-da850-omapl138-evm.tar.gz
Qt 4.6 source code
http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.0.tar.gz
Though 4.6.0 is used here, other 4.6.x versions of Qt will also work.
Qt based UI example source code
Get via SVN using instructions in the below page:
https://gforge.ti.com/gf/project/gleslayer/scmsvn/?action=AccessInfo
NOTE: The Sitara code base is at, trunk/Packages/AM18x_SDK/Qt_sitara_app
If you have any issues please see Known issues
Tslib 1.0.0 build setup and binaries (to get tslib.h file)
http://prdownload.berlios.de/tslib/tslib-1.0.tar.bz2
Building the demo application
- Extract the tslib archive, and note the location of tslib.h file in the extracted folder (say, TSLIB_HEADER_LOC)
- Extract the filesystem to a directory (say, TARGETFS_LOC). Note the location of libts.so (or libts-1.0.so.0.0.0) in this directory. Soft linking might need to be done if libts.so is not installed, or simply perform the below command, to get libts.so
>> sudo cp <TARGETFS_LOC>/usr/lib/libts-1.0.so.0.0.0 <TARGETFS_LOC>/usr/lib/libts.so
Note the location of libts.so. (in this case, <TARGETFS_LOC>/usr/lib)
- Qt 4.6.0 has to be extracted to a folder (say, QTDIR)
- Extract the "sitara" folder inside "Qt_Sitara_app" source into <QTDIR>\examples\effects folder (<QTDIR> is the directory where you extracted Qt 4.6 source code). After this step, the file <QTDIR>\examples\effects\sitara\sitara.pro should exist.
- Open the file <QTDIR>\examples\effects\effects.pro, and add "sitara" folder to the list of subdirs. After modification, end of this file will look like below.
SUBDIRS = \
blurpicker \
lighting \
fademessage \
sitara
Change the <QTDIR>/mkspecs/qws/linux-arm-g++/qmake.conf to include the TSLIB header file include path and the library path present on the development machine. Also change the toolchain to suit the codesourcery toolchain. For example,
# # qmake configuration for building with arm-linux-g++ # include(../../common/g++.conf) include(../../common/linux.conf) include(../../common/qws.conf) # modifications to g++.conf #Toolchain QMAKE_CC = arm-none-linux-gnueabi-gcc QMAKE_CXX = arm-none-linux-gnueabi-g++ QMAKE_LINK = arm-none-linux-gnueabi-g++ QMAKE_LINK_SHLIB = arm-none-linux-gnueabi-g++ # modifications to linux.conf QMAKE_AR = arm-none-linux-gnueabi-ar cqs QMAKE_OBJCOPY = arm-none-linux-gnueabi-objcopy QMAKE_STRIP = arm-none-linux-gnueabi-strip QMAKE_INCDIR += /<>/<TSLIB_HEADER_LOC> # This path should contain tslib.h QMAKE_LIBDIR += <TARGETFS_LOC>/usr/lib # path to tslib.so lib load(qt_config)
Configure and build Qt with the below steps (for 4.6.x Qt version) from the <QTDIR>:
>> ./configure -opensource -static -no-qt3support -no-xmlpatterns -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-javascript-jit -no-script -no-scripttools -no-declarative -qt-mouse-tslib -DQT_QWS_CLIENTBLIT -xplatform qws/linux-arm-g++ -embedded arm -confirm-license
>> make
>> make install
This will install by default into /usr/local/Trolltech/Qt-version-arm. on the HOST machine.
Installing Qt and application to the target filesystem
Once this is built, install Qt into the target filesystem with following steps:
1. For the static build, only the <QTDIR>/lib/fonts folder will need to be added/copied. If using default install (ie, no -prefix is specified in configuration), this needs to be copied to /usr/local/Trolltech/QtEmbedded-4.6.0-arm/lib/fonts in the target filesystem.
ex.
mkdir -p /<targetfs>/usr/local/Trolltech/QtEmbedded-4.6.0-arm/lib
cp -rf /usr/local/Trolltech/QtEmbedded-4.6.0-arm/lib/fonts /<targetfs>/usr/local/Trolltech/QtEmbedded-4.6.0-arm/lib
2. Copy the examples/effects/sitara/sitara application into the target filesystem into a location as needed. In the prebuilt example filesystem on the EVM, this file is stored as /usr/tests/am18xx-demo
Running the application on the target
Add below environment variables on the target shell:
>>export LD_LIBRARY_PATH=/usr/lib
>>export TSLIB_PLUGINDIR=/usr/lib/ts
>>export TSLIB_TSDEVICE=/dev/input/touchscreen0
>>export TSLIB_CONFFILE=/etc/ts.conf
>>export QWS_MOUSE_PROTO=Tslib:/dev/input/touchscreen0
Do "ts_calibrate" if running the touchscreen for the first time.
Run the application on the target with the below command:
>> am18xx-demo -qws
This should result in the home screen getting displayed.
Making the application to start at boot-up
Change the script "/etc/init.d/omap-demo" in the target filesystem, to include and run the demo, with the below step, after including the environment variables as mentioned above.
>>start-stop-daemon --start --quiet --background --exec /usr/tests/am18xx-demo
Post-demo steps
Measuring the Performance of the Application
When the application is rebuilt in Debug mode, a performance counter is enabled, that displays each screen-startup time, and the screen-switching time, in the lower right corner of the screen. This can be used to measure performance optimisations in the application.
Extending the demo application
The Class diagram for the demo application is below. Inheriting the ApplicationBase, further applications can be built.
Adding audio support during slideshow
The Sitara application source code contains source code (that is disabled by default), for audio playback during slideshow. To enable this,
1. Qt needs to be rebuilt without the "-static" option, and Alsa library headers and library for AM18x needs to be included. Configuration option for this is,
>>./configure -opensource -no-qt3support -no-xmlpatterns -multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-javascript-jit -no-script -no-scripttools -no-declarative -qt-mouse-tslib -DQT_QWS_CLIENTBLIT -R<TSLIB_LIB path> -R<ALSA LIB PATH> -xplatform qws/linux-arm-g++ -embedded arm -confirm-license
2. "QtMultimedia" needs to be added to the list of libraries to be linked, for the sitara project.
3. Define "_ENABLE_AUDIO_PLAY" in slideshow.h, and rebuild Sitara project
4. Confirm that the needed PCM/WAV file of required sampling rate/format is present in the required folder in the filesystem
With this, audio playback is enabled in the slideshow application. Note that this does not use gStreamer, and only supports PCM file playback.
XgxPerf based Benchmarking
The HMI demo and other base-classes used in this project, have been integrated in a different form, into the Xgxperf toolkit. Please refer to below link,
http://processors.wiki.ti.com/index.php/XgxPerf_HMI
Known issues
- When Accessing SVN via proxy, if you get the error:
Could not resolve hostname `gforge.ti.com'
Please see below for configuring SVN:
https://gforge.ti.com/gf/project/gleslayer/news/?action=NewsThreadView&id=54
Further Debugging
1. Cursor is visible on the screen, but the application does not respond to Touch
- Ensure that libts.so is present in the $LD_LIBRARY_PATH, and QWS_MOUSE_PROTO is defined to right values. See link below for Qt building.
2. I have issues building Qt on Linux.
- Check out the information in the below link
3. Debugging Qt build issues
4. How do I stop the demo application running in the background ?
>>start-stop-daemon --stop --quiet --background --exec /usr/tests/am18xx-demo
Further Information
The below link contains updated code base on creating Industrial HMIs using Vector Graphics and Qt
http://processors.wiki.ti.com/index.php/XgxPerf_HMI
Leave a Comment
