Preface
I've been learning Qt programming under Tiny4412 recently. The first step is to build a cross-development debugging environment. After several attempts, it's basically completed. I'd like to sort out my notes during this period and post them on my blog as a summary. I also hope that others will avoid the pitfalls I've fallen into.
Another point to mention (which I learned from searching the Internet afterwards) is that the Yocto/OpenEmbedded framework is popular in the industry. Many manufacturers use this framework to build BSPs (including kernel, rootfs, toolchain, gdb, libraries, and qt libraries) for distribution development boards. Users can directly build a Qt cross-development environment based on this BSP, thus avoiding problems such as missing dependent libraries and toolchain version mismatches encountered when building the environment themselves, saving unnecessary time costs. There are many related cases, and several examples are listed in "References 2~5" (all unverified, for reference only).
However, Tiny4412 doesn't seem to provide Yocto BSP yet, so I can't experience it yet. But Yocto is probably a general trend, so I'll learn about it when I have time.
Go to top
1. Experimental Environment
1.1 Virtual Machine Environment
a) Vmware version: Vmware Workstation 12.5.7
b) Ubuntu version: Ubuntu 16.04.4 LTS (I used the version in the JZ2440 Data CD_20180516 of Baiwen.com, the address is: http://wiki.100ask.org/Download, then find: 002_JZ2440 Data CD_20180516(Free))
c) Kernel version: 4.13.0
d) gcc version: 5.4.0
e) Toolchain version:
arm-linux-gcc 4.3.2
1.2 Development Board Environment
1.2.1 Hardware
Development board: Friendly Arm tiny4412, baseboard: Tiny4412/Super4412SDK 1611, core board: Tiny4412 version number 1412
1.2.2 Software
a) Kernel version (included in the tiny4412 CD): linux-3.5-20170221
b) Root file system (included in the tiny4412 CD): rootfs_qtopia_qt4-20160514
Go to top
2. Specific process
2.1 Compile and install qte-4.8.5
Note: The tiny4412 CD contains the compiled target-qte-4.8.5-to-hostpc.tgz. However, my Ubuntu version is different from the Ubuntu version used by Youshan when compiling target-qte-4.8.5-to-hostpc.tgz. Therefore, after decompression, I cannot use it directly in qt-creator (after clicking the build button, it will report: The Qt version is invalid. Could not determine the path to the binaries of the Qt installation, maybe the qmake path is wrong?). I can only compile it from scratch.
Copy arm-qte-4.8.5-20131207.tar.gz to the development machine, and then execute the following command in the mobaXterm serial terminal:
tar xzvf arm-qte-4.8.5-20131207.tar.gz
cd arm-qte-4.8.5
./build.sh
Note: When executing ./build.sh for the first time, an error message was displayed: tslib functionality test failed. However, after re-executing ./build.sh, this error message did not appear again. The reason is unknown and needs to be investigated.
2.2 Download, compile, and install gdb-7.10, then compile and install gdbserver
Why did I choose this version? Because when I was studying the camera monitoring project of the third phase of Wei Dongshan Embedded Linux Training, I had successfully built a remote debugging environment for the development board using gdb-7.10 (in fact, I chose version 7.10 based on my feeling at that time ).
2.2.1 Download, compile, and install gdb-7.10 (download address: http://ftp.gnu.org/gnu/gdb/gdb-7.10.tar.gz)
Download gdb-7.10.tar.gz to the development machine (assuming it is downloaded to /home/book/Downloads/), and then execute the following command in the mobaXterm serial terminal:
tar xzvf gdb-7.10.tar.gz
cd /home/book/Downloads/gdb-7.10
mkdir build && cd build
../configure --target=arm-linux --prefix=/usr/local/arm-gdb-7.10 --with-python
Note: You may also need to add: --with-expat --includedir=/home/book/Downloads/expat-2.2.9/bin/include --libdir=/home/book/Downloads/expat-2.2.9/bin/lib, see the notes below for details
make
make install
export PATH=$PATH:/usr/local/arm-gdb-7.10
(You can add this sentence to /etc/environment or ~./bashrc to save the changes to the $PATH environment variable)
Note 1: When configuring gdb-7.10, you need to add the --with-python option (you may also need to download and install python2.7-dev first). Otherwise, when you start debugging in qt-creator, you may get an error:
Note 2: If configure adds the --with-python option, it will report: checking for python2.7... no configure: error: python is missing or unusable The solution is: first download and install python2.7-dev: apt-get install python2.7-dev. After the installation is complete, you can execute dpkg -l | grep python2.7-dev to verify whether the installation is successful.
Note 3: After compiling and installing gdb-7.10, if you start debugging in qt-creator and get an error in Application Output: warning: Can not parse XML target description; XML support
./configure --prefix=$PWD/bin mkdir bin make && make install
Then recompile and install gdb-7.10 (when configuring, also add the following options: --with-expat --includedir=/home/book/Downloads/expat-2.2.9/bin/include
Note 4: If you run make and get an error: checking for libexpat... (cached) no configure: error: expat is missing or unusable The solution is: delete the entire gdb-7.10 folder, then re-decompress gdb-7.10.tar.gz, compile, and install. The reasons are: To speed up, configure will cache the last check result as a cache variable (named ac_cv_libexpat) in gdb/configure.cache, and this time configure will first The cache variable is checked in this file. If it is not found, it will actually check whether the libexpat library exists. Therefore, this cache file should be cleared to force configure to perform a real check. |
2.2.2 Compile and install gdbserver
Execute the following command in the mobaXterm serial terminal:
cd /home/book/Downloads/gdb-7.10/gdb/gdbserver
mkdir build && cd build
../configure --target=arm-linux -host=arm-linux
make CC=arm-linux-gcc
After completion, a gdbserver executable file will be generated in the build directory. Copy it to the /usr/bin directory of the development board (you can use ftp or nfs, the process is omitted):
2.3 Copy and unzip the root file system to the development machine
Copy the rootfs_qtopia_qt4-20160514.tgz in the CD-ROM that comes with Tiny4412 to the development machine (assuming it is copied to /home/book/Downloads/friendly_arm/tiny4412/linux_rootfs/), and then execute:
tar xzvf rootfs_qtopia_qt4-20160514.tgz
2.4 Download and install Qt-5.9.0 (download address: https://download.qt.io/archive/qt/5.9/5.9.0/qt-opensource-linux-x64-5.9.0.run)
Why choose this version? Because there are many successful cases online, and cross-debugging platforms have been built using this version, and there is experience to learn from.
Download qt-opensource-linux-x64-5.9.0.run to the development machine, and then execute the following command in the mobaXterm serial terminal:
chmod +x qt-opensource-linux-x64-5.9.0.run
./qt-opensource-linux-x64-5.9.0.run
Then follow the prompts of the installation wizard step by step (Note: In the "Select Components" step, select all components under Qt5.9.0 for safety reasons)
2.5 Open qt-creator and go to Tools==>Options for configuration
2.5.1 Add device
2.5.2 Add Qt version
2.5.3 Adding a compiler
2.5.4 Add debugger
2.5.5 Adding kit
2.5.6 Add environment variables to support touch screen operation
Method 1) Modify /etc/profile on the development board (follow the content of /bin/setqt4env) and add the following environment variables:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export QWS_DISPLAY=:1
export QWS_KEYBOARD=TTY:/dev/tty1
export QWS_MOUSE_PROTO="Tslib MouseMan:/dev/input/mice"
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts-mt.conf
export TSLIB_PLUGINDIR=/usr/lib/ts
export TSLIB_TSDEVICE=/dev/touchscreen-1wire
Method 2) In qt-creator on the development machine, go to project==>Build&Run==>tiny4412==>Run==>Base environment for this run configuration and add the above environment variables:
2.5.7 Modify /usr/local/etc/sshd_config on the development board to solve the problem of "SFTP initialization failed: Server could not start SFTP subsystem" when debugging
Subsystem sftp /usr/libexec/sftp-server
to:
Subsystem sftp /usr/local/libexec/sftp-server
2.6 qt-creator creates a widget test program test, and then does some configuration
2.6.1 Modify the "test.pro" file and add the following two lines:
target.path = /opt #Specify the installation path on the development board for the program
INSTALLS += target
2.6.2 Enter Project==>Build&Run==>Tiny4412==>Run Settings
At this point, the Qt development and debugging environment of Tiny4412 has finally been built, and the effect diagram is as follows:
1) Start debugging:
2) Stop debugging:
Go to top
3. References
1) Tiny4412 User Manual
2) QtCreator+Arm development and online debugging
3) Full record of yocto for imx6 development environment construction (L4.1.15_2.0.0)
4) QTCreator + gdbserver to achieve remote debugging
5) Qt5 porting and development on NXP iMX8
Previous article:ALSA sound card_add recording function from scratch (based on Youlong FS2410 development board, UDA1341 sound card)
Next article:Wei Dongshan Embedded Linux_Issue 3: USB Camera Monitoring_Adding Video Recording Function to Mobile App (I)
Recommended ReadingLatest update time:2024-11-23 19:08
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- How to set line width rules for a single component
- When filling out college entrance examination applications, which majors must be chosen carefully?
- HFSS User Experience (Reposted)
- Differences between CPU and CLA and Error Handling Techniques
- FTP remote download implementation help
- Need help designing a CAN communication solution between two MCUs!
- ATMega48 Bootloader Software Practical Method
- 【NUCLEO-WL55JC2 Review 1】 Overview of STM32WL Chip
- Friends who are familiar with MP2307DN, please take a look!
- Design of wireless communication controller for GPRS data transmission service