Mir MYC-YT507 development board review: Development environment part 3: Qt tank game
[Copy link]
Preface
This article uses a popular tank game implemented in Qt to experience the Qt development process of this development board, focusing mainly on the convenience of setting up the development environment from the perspective of secondary development.
Prepare
Refer to "Mil MYC-YT507 Development Board Evaluation: Development Environment Part 1: Linux C Key Control LED" to install the cross-compilation environment.
And basic login file transfer and other operations.
Install Qt development environment
Install the compilation environment
Download the data from http://down.myir-tech.com/MYD-YT507H/ in Windows, and unzip 03_Tools.zip
I unzipped it to E:\BOARD\MYC-YT507\03_Tools
Change the name of the folder Complie Toolchain to Complie_Toolchain because command line file names in Linux cannot have spaces.
wsl
cd ~
mkdir MYD-YT507H
cd MYD-YT507H/
Unzip the files under Windows directly into WSL
tar -xvf /mnt/e/BOARD/MYC-YT507/03_Tools/Complie_Toolchain/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu-qt5.12.5-myir.tar.bz2 -C .
Install Qt Creator
Download QtCreator
wget https://mirrors.tuna.tsinghua.edu.cn/qt/development_releases/qtcreator/5.0/5.0.0-rc1/qt-creator-opensource-linux-x86_64-5.0.0-rc1.run
chmod +x qt-creator-opensource-linux-x86_64-5.0.0-rc1.run
./qt-creator-opensource-linux-x86_64-5.0.0-rc1.run
Need to register an account
Run /home/lhj/qtcreator-5.0.0-rc1/bin/qtcreator.sh &
Configuration
Click Tools -> Options in the menu bar
Configuring the Compiler
Click Kits on the left and select the Compilers tab on the right.
Add G++ compiler
Set Name to YT507H-G++
Compiler path is /home/lhj/MYD-YT507H/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++
Click "Apply"
Add the GCC compiler in the same way
Set Name to YT507H-GCC
Compiler path is
/home/lhj/MYD-YT507H/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc
After configuration, it is as follows
Configure Qmake
Select the "Qt Version" tab and click "Add..." on the right. The qmake path selection dialog box will pop up.
Select /home/lhj/MYD-YT507H/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/Qt_5.12.5/bin/qmake, click Open
Change "Version name" to Qt %{Qt:Version} (MYIR-YT507H-System). Then click the "Apply" button
Configuring Device
Select "Device" on the left and click the "Add..." button on the right.
Configuring Kits
Kits on the left, Kits tab on the right, click Add
Set Name to YT507H-dev-kit
Select Device Type
Select Device
Select Sysroot:/home/lhj/MYD-YT507H/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/Qt_5.12.5/aarch64-buildroot-linux-gnu/sysroot
Compiler selects the C and C++ compilers just configured
Qt version select Qt 5.12.5 (MYIR-YT507H- System)
"Qt mkspec" is filled in with "linux-aarch64-gnu-g++"
Click Apply
Click OK
Tanks
git clone
Open QtCreator
/home/lhj/qtcreator-5.0.0-rc1/bin/qtcreator.sh &
File-> Open File or Project... Select the code you just cloned
Select YT507H-dev-kit
Click Configure Project
Menu Bar
Build->Clean
Build->Build All Projects
hint
Search find ../ -name libGLESv2.so
Find the path as
/home/lhj/MYD-YT507H/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/Qt_5.12.5/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libGLESv2.so
Manually modify /home/lhj/MYD-YT507H/build-tanks-YT507H_dev_kit-Debug/Makefile. The content in the red box above is /home/lhj/MYD-YT507H/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/Qt_5.12.5/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libGLESv2.so
The compiled code is located in
/home/lhj/MYD-YT507H/build-tanks-YT507H_dev_kit-Debug/Tanks
Export to Windows
cp /home/lhj/MYD-YT507H/build-tanks-YT507H_dev_kit-Debug/Tanks /mnt/e
Then import it to the development board.
run
ps check the process number of myapp2 and kill it
export QT_DEBUG_PLUGINS=1 enables debugging printing to facilitate problem analysis
./Tanks Run
If you print
./Tanks: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
but:
export LD_LIBRARY_PATH=/usr/local/Qt_5.12.5/lib/:$LD_LIBRARY_PATH
Check here that the library path is /usr/local/Qt_5.12.5/ and the one referenced in the program is /usr/local/Qt-5.12.5/
So create a soft link
ln -s /usr/local/Qt_5.12.5/plugins/platforms/ /root/platforms
ln -s /usr/local/Qt_5.12.5 /usr/local/Qt-5.12.5
If you print
loaded library "/usr/local/Qt_5.12.5/plugins/egldeviceintegrations/libqeglfs-emu-integration.so"
EGL library doesn't support Emulator extensions
Aborted
but
export QT_QPA_EGLFS_INTEGRATION=none
If you print
QFontDatabase: Cannot find font directory /usr/local/Qt-5.12.5/lib/fonts.
Then soft link to the actual font file
ln -s /usr/local/Qt-5.12.5/fonts/ /usr/local/Qt-5.12.5/lib/fonts
Use USB mouse and keyboard to control
button
W: Forward
S: Back
A: Turn left
D: Turn right
Press buttons 1, 2, and 3 to select the firepower.
Press the q button to shoot.
Press s to pause and continue
Summarize
The development board supports Qt5.12, and the corresponding operating environment has been installed in the image. The SDK also provides a tool chain that can be used directly, so development is very convenient, and the relevant documents are also relatively detailed and developer-friendly.
refer to
MYD-YT507H_QT Application Development Notes.pdf
|