[Mill MYB-YT507 development board trial experience] + build QT development environment and test, the most detailed steps to solve all troubles
[Copy link]
After the last article, we will enter our application article. There is still time for experience, so let's not waste time on compilation. Let's experience our QT development today. In fact, Allwinner supports more than just QT display on its platform this year. We choose QT experience because its code can run on multiple terminals and basically can run across multiple platforms.
We can see that there are other GUIs supported on the platform. LVGL is also very popular this year, and basically the SDK in the new Allwinner video supports it. Let's get into the topic, let's install QT development on Ubuntu first.
Here I choose the qt5.9 version on Linux. This version is the one I use most. This version avoids logging in and has a good experience in other aspects. However, it does not correspond to the development version on our development board. But there is no problem with this. The only difference is that running some examples will be different.
After running, the QT installation page will pop up, and we can just click NEXT.
Then the next step is to log in. It seems that you must log in to verify the following steps. You can directly choose to skip this version.
Then choose our installation path. Here I will let it choose by itself. You can choose any path here, there is no problem.
Then jump to our component installation. For component installation, we must choose QT Creator, which is an IDE developed by QT. I also recommend installing other desktop versions of QT5.9.1, so that you can see the running effect directly on Ubuntu.
Next, wait for the installation to complete.
In this step, we are setting up the QT cross-compilation environment. Our computers are usually based on X86 architecture, and the generated executable files cannot be run on our ARM development board, so we need to cross-compile them into ARM versions and provide them to the development board for running. This tool is provided directly by Mir, just unzip it.
Then we install the QT Creator and click Options under Tools to configure our cross compiler.
Go to build&run and select kits to create our cross-compiler here.
Click Add and rename it for easy identification. The following compiler and QT version need to be newly created, and there are corresponding options above.
In QT Versions, we select our qmake. This path is the path of the unzipped file. Select it according to the red box.
After selecting, our version will be prompted directly, which is QT5.12.5, which is also the version on our development board.
Then add our gcc and g++ compilers.
You can check the path yourself. It is also the path where we decompressed it. Choose whatever you want to add. There are two here, one is gcc and the other is g++. Choose both of them.
The addition is completed as above. For the convenience of naming, we still rename it.
Then modify the first kits and change all the contents to the corresponding development board.
The next step is to create a new project using QT Creator. Here we choose one with a graphical display. The first one will do.
Name the command hello_world. Keep your first project simple.
On the Kits page, we check both desktop and cross-compilation.
This step and the following ones are all default and will not be modified for the time being.
Then we can run the desktop directly, and you can see a window pop up with nothing in it. This step completes the new project and verification.
Then modify the .ui file. This is the box that just displays the image. We can add some things ourselves.
You can see that another window pops up after clicking. This window is the QT designer, which can design various UI interfaces. What you see is what you get. We drag a button and a label from the left control to the window, and double-click to modify the content to hello world.
Then run the desktop again and we will see the display.
Then start our cross-compilation build and select T507.
Then there was an error in the build, which we needed to resolve. At first I thought it was a problem with our compiler, so I added the environment variables.
Modify /etc/profile to add the path of our cross compiler. Then restart.
Restart and open QT Creator in the application and select our hello world project. However, the above problem still occurs. Generally, it is a problem of QT itself. The output target folder does not exist during compilation, and the corresponding so file, that is, the dynamically linked file, cannot be found. At this time, we still need to create a new directory and put the file in it.
/home/lcy/t507/out/t507/demo2.0/longan/buildroot/host/usr/
First of all, this string is the path of the error just reported, so we first create the user lcy, use the command sudo adduser lcy
Then keep pressing Enter.
Then enter the lcy directory and create a folder
sudo mkdir -p t507/out/t507/demo2.0/longan/buildroot/host/usr/
Then copy the files in the path.
My path here is missing a t507, but it won’t happen if I create it above. Just copy a folder directly.
Then go in ls and see many so files. That's it.
Then build again and it's fine.
Then our executable file comes out, and you can see that the file type is ARM aarch64. The next step is to run it on the board.
There are many ways to download our program to our development board. Allwinner also provides an ADB method, which we will use later. I am anxious to test it, so we just copy it to the SD card and insert it into the board. Then I found a problem here. There is no prompt for mounting, which is not good. We can find new devices by finding what kind of devices are added in /dev/. Here I found that mmcblk1p1 has appeared. Then we mount it. After mounting, our program appears in the ls directory.
It is not possible to run the program directly afterwards because of the lack of link library. At this time, we can find that it is running its own program. At this time, we need to find it and replace the program brought by Mil with ours.
I usually find the program we run when we start the computer in the file /etc/init.d/rcS, and sure enough, it executes a qtenv.sh. Let's look at this file again.
Find our running program mxapp2, and then simply replace the file name with our program.
We need to search for the location of this file. We found it in /usr/bin and copied our program directly into it. Then boot the computer. The running effect is as follows:
The controls are a bit compressed and not fully displayed. We will release a video later to explain this.
|