This tutorial requires the ARM GNU tools, which are part of the Xilinx Software Development Kit (SDK), to be installed on your host system. Specify the ARM cross-compiler by setting the CROSS_COMPILE environment variable and adding the cross-compiler to your PATH. Refer to the Zynq Tools
wiki page for more information on how to set up the tool chain and known issues.
Note: These instructions currently require a Linux host for building.
For simplicity we define two environment variables in this tutorial:
- ZYNQ_QT_BUILD refers to the Qt build area
- ZYNQ_QT_INSTALL refers to the Qt install area
3 Cross-Compile Qt4 for Embedded Linux
Qt for Embedded Linux is a C++ framework for GUI and application development for embedded devices. It runs on a variety of processors, usually with Embedded Linux. Qt for Embedded Linux provides the standard Qt API for embedded devices with a lightweight window system. Qt for Embedded Linux applications write directly to the framebuffer, eliminating the need for the X Window System and saving memory.
3.1 Download the Qt Source Archive
the Qt sources and extract the archive to your Qt build area.
3.2 Prepare a mkspec
Before we can do the configuration for the target system, we will need a set of mkspecs that tells qmake which tool chain it should reference when it creates the Makefiles. In this example we will provide an mkspec to go along with the ARM GNU tools.
The mkspec consists of two files:
- qmake.conf – This is a list of qmake variable assignments that tells qmake what flags to pass through to the compiler, which compiler to use etc
- qplatformdefs.h – This is a header file with various platform-specific #includes and #defines. Often this just refers to an existing qplatformdefs.h file from another generic mkspec
Download the qmake configuration file from the link below to override the existing linux-arm mkspec.
The corresponding qplatformdefs.h file just refers to an existing generic one, so nothing needs to be done here.
3.3 Configure the Target Build
We are now ready to configure Qt to use our mkspec and hence use our cross-compiling toolchain.
Here is some information on some of the options that appear:
- -xplatform <mkspec files to use> – Cross compile for the target platform using the environment specified in the mkspec files
- -embedded <target CPU architecture> – The CPU architecture of the target platform
- -prefix <path> – The path to install the cross-compiled Qt to
- -confirm-license – Lazy option to save agreeing to license agreement during configure process
3.4 Build and Install
Run make to build the cross-compiled target version of Qt.
Once the build has completed it is time to install Qt. You may need to su to root to do this part depending upon what prefix you configured the build with.
The Qwt library contains GUI Components and utility classes which are primarily useful for programs with a technical background. Beside a 2D plot widget it provides scales, sliders, dials, compasses, thermometers, wheels and knobs to control or display values, arrays, or ranges of type double.
4.1 Download the Qwt Source Archive
the Qwt sources and extract the archive to your Qt build area.
Note: Make sure you configure, compile and install the qwt libraries in the same shell as the Qt installation as some Qt environment variables are reused for this build.
4.2 Configure the Build using qmake
Projects are described by the contents of project files (.pro). Files that end with the suffix .pri are included by the project files and contain definitions that are common for several project files. The information within these is used by qmake to generate a Makefile containing all the commands that are needed to build each project.
Download the config file from below and replace the existing one.
4.3 Build and Install
Run make to build the cross-compiled target version of Qwt.
Once the build has completed it is time to install Qwt. You may need to su to root to do this part depending upon what prefix you configured the build with.
5 Add the GNU Standard C++ Library
In order to build and run your Qt application, the GNU Standard C++ Library of the ARM GNU Tools needs to be copied to the Qt install area's lib directory.
6 Create a File System Image with Pre-Compiled Qt/Qwt Libraries
NOTE: This step is optional and is needed for Zynq Base TRD 14.x version for copying QT libraries on a formatted ext2 filesystem.
The final step shows how to create an image file of the Qt install area that can be copied onto an SD card and then mounted on the target system. These libraries are required to run the Qt application on the target system. First we create an empty image file of size 80MB, then we format the image with the ext2 file system.
Now we just need to mount the image on our host machine, copy over the libraries from the Qt install area and we are done. You may need to su to root to do this part.
7 Web Sources