Transplantation of ARM-ZYNQ platform of Qt5.8 and touch Tslib-1.4 Library

This section mainly introduces the compilation and migration of Tslib-1.4 library, the next section mainly introduces the migration of Qt5.8, and the docking of Qt5.8 and Tslib-1.4 to realize the touch function on Qt;

1, Development environment and tools

PC system: Linux version 4.10.0-38-generic (built @ lgw01-amd64-059) (GCC version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu 1 ~ 16.04.4)) ා42 ~ 16.04.1-ubuntu SMP Tue OCT 10 16:32:20 UTC 2017

Cross compiler: arm Xilinx Linux gnueabi GCC

Hardware platform: XILINX ZYNQ-7000 development board

Two, foreword

Firstly, it introduces the usage of cross compiler. g c C (compiling c language. c program) and g + + compiler (compiling c + + -. cpp program) are generally installed on PC Linux system. The compiled program can only run on X86 platform (32-bit system, such as Windows, Linux) or X64 platform (64 bit PC system). The CPU of PC is generally Intel or AMD architecture; In the embedded platform of Linux, the CPU is generally ARM architecture; if you need to run programs on the embedded platform, you need to use the cross compiler (ARM linux GCC or ARM linux g + +) corresponding to the ARM platform to compile the program source, and then copy it to the ARM development board to run. If the application also needs to rely on some library files (such as dynamic library. So), you need to add the absolute PATH of the library to the environment variable KaTeX parse error: Expected 'EOF', got '#' at position 56: n style="color:#̲000000;">LD_LIB… Add bin PATH of cross compiler under PATH path


Let the environment variable just modified take effect immediately

source /etc/profile

Let's input arm in terminal, and then press Tab (auto complement function), we can see some files of cross compiler tools starting with arm, which means that the environment variables are set successfully, the cross compiler has been installed successfully and can be used.

Or enter the command to view the cross compiler version

arm-xilinx-linux-gnueabi-gcc -v

3, Installation and compilation of Tslib Library

Before compiling the Tslib-1.4 library file, you need to add

Extract the source code of tslib-1.4 Library


Enter the tslib master directory of unzip: first clear the source code and run the script


But the error of. / Autogen. Sh: 3:. / Autogen. Sh: autoreconf: not found can be seen that autoreconf is missing. Du Niang said that it is a plug-in that needs to be installed before transplanting tslib, that is, a preparation tool.

1. Download a autoconf-2.69.tar.xz package for installation

You need to unzip it twice. For the first time, unzip. tar.xz into a. tar package, and then unzip the generated. tar into a directory

  1. xz -d autoconf-2.69.tar.xz
  2. tar -xvf autoconf-2.69.tar

Enter the decompression result autoconf-2.69 Directory run configuration,–prefix Parameter is installation path

./configure --prefix=/usr/local/

But also prompt configure: error: no acceptable m4 could be found in KaTeX parse error: Expected 'EOF', got '&' at position 7927: ...umentation.<br>&̲nbsp;&nbsp;&nbs...TSLIB_ROOT/etc/ts.conf
export TSLIB_PLUGINDIR=TSLIBROOT</span>/lib/ts<spanclass="hljs−builtin">export</span>TSLIBFBDEVICE=/dev/fb0<spanclass="hljs−builtin">export</span>TSLIBCONSOLEDEVICE=none<spanclass="hljs−builtin">export</span>LDLIBRARYPATH=<spanclass="hljs−variable">TSLIB_ROOT</span>/lib/ts <span class="hljs-built_in">export</span> TSLIB_FBDEVICE=/dev/fb0 <span class="hljs-built_in">export</span> TSLIB_CONSOLEDEVICE=none <span class="hljs-built_in">export</span> LD_LIBRARY_PATH=<span class="hljs-variable">TSLIBROOT</span>/lib/ts<spanclass="hljsbuiltin">export</span>TSLIBFBDEVICE=/dev/fb0<spanclass="hljsbuiltin">export</span>TSLIBCONSOLEDEVICE=none<spanclass="hljsbuiltin">export</span>LDLIBRARYPATH=<spanclass="hljsvariable">LD_LIBRARY_PATH:$TSLIB_ROOT/li


  1. TSLIB_TSDEVICE //Touch the interface name reported by the driver coordinate, and you can view it in the directory of dev/input /. The test development board is event0
  2. TSLIB_CALIBFILE //The calibration data file is generated by the TS "calibrate calibration program.
  3. TSLIB_CONFFILE //Profile name.
  4. TSLIB_PLUGINDIR //Plugin directory
  5. TSLIB_CONSOLEDEVICE //Console device filename

TSLIB_FBDEVICE          //fb0 is a piece of memory in ARM. We can understand it as the display memory of PC. to display the graphic interface of application layer, we can't bypass it

Next, run the ts'u calibrate application program of Tslib. First, check the size of the display screen as 1024x600 resolution. Then click four corners and five cursors at the center point at a time to determine whether the position and coordinate printing are consistent. After running, the program will exit automatically;

Before running the program, it displays the information of the serial port terminal

After running the TS calibrate application of Tslib, there will be a cross cursor in the upper left corner. When we click the cross cursor, the serial terminal will print the Topleft X=45 Y=71, and the coordinates of the clicked points will also be printed in the other four points. The demonstration results are as follows:

Run the TS? Test program, click the draw button, you can draw freely, and click qiut to exit the application program;

Then the migration and calibration of tslib are finished. The next section introduces the docking of Qt5.8 and touch, that is, the migration of Qt5.8 and touch Tslib-1.4 library on the embedded ARM-ZYNQ platform (2).

Published 40 original articles, won praise by 137 and visited 370000+

Tags: Linux Qt5 Qt Ubuntu

Posted on Mon, 13 Jan 2020 22:45:15 -0500 by irishpeck