Qt on i.MX6ULL Part 0: Installation and Initial Setup
Charles Dias, M.Sc.
Embedded Software Engineer | M.Sc in Electrical Engineering | C, Modern C++ | IoT | RTOS | Embedded Linux | Yocto Project
In the last few years, I have worked on various projects involving MCU systems (bare-metal and RTOS), Linux embedded, and PC software. Although I enjoy all these projects, I have developed a particular interest in MCU systems and have recently developed a passion for Linux embedded too! hehe
I like implementing simple projects to help me learn crucial topics related to the Linux embedded world, such as Yocto, Device Tree, Linux Kernel Driver, Qt, and more. Yep... that sounds like a long path and, sometimes, a crazy one! ;-) That way, I'd like to share some knowledge I've been acquiring during this journey.
In this inaugural article (everything starts from zero), I will guide you through installing Qt on an Ubuntu 22.04 LTS platform and configuring it to work with the Colibri i.MX6ULL. I'll guide you through each step, providing clear instructions and helpful screenshots to ensure a smooth setup experience.
By the end of this guide, we'll have a build environment set up and ready to build our future Qt embedded projects.
For those interested, the material used in this series of articles will be available in the project's GitHub repository. Visit the repository on my GitHub page and feel free to suggest changes or contribute to this ongoing project.
Stay tuned for the upcoming articles in this series, where I'll learn some interesting points about developing a Qt application that runs on the i.MX6ULL.
Note: I'll work with the Qt version under an Open Source license. I strongly recommend understanding the Open Source requirements before initiating a project under this license type.
Legend
Throughout this text, console commands starting with a "$" signify a command prompt on your PC. Commands beginning with a "#" signify a prompt on the embedded system. For example:
This is a command on Linux PC.
$ cd device-tree
This is a command on Linux embedded.
# ifconfig
Hardware requirements
I'll use the following hardware configuration:
The Embedded System - Colibri i.MX6ULL
According to the Toradex documentation, three platforms are available for developing a Qt application to run on their boards: Torizon, Boot2QT, and Yocto. If you desire to learn more about these options, I recommend checking the documentation available at the Toradex Developer Center.
Let's start with the demo image provided by Toradex company.
Note: The plan for future articles is to explain how to build our custom image.
Install the operating system on i.MX6ULL
Visit the Quickstart page and select the Colibri iMX6ULL as your SoM, Aster as your board, and Linux as your OS. Performs the instructions to unpack and bring up your board.
On the Toradex Easy Installer screen, select and install the Toradex Embedded Linux Reference Multimedia Image (UPSTREAM).
Note: Toradex provides detailed instructions for installing the operating system, and it won't be covered in this article. Please, access the Quickstart page to learn more.
After the installation is complete, power off the board and power it on again. Once the boot process is complete, use a serial port communication program, like Minicom or Putty, and connect to the board through the USB debug connection. See more information on Configuring Serial Port Debug Console.
Check and note down the IP address, e.g
# ifconfig
eth0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC> mtu 1500
inet 192.168.15.11 netmask 255.255.255.0 broadcast 192.168.15.255
. . .
Since the IP address is already known, I strongly recommend you access the board via SSH connection.
Setting the display resolution and touch calibration
The current Linux Kernel version does not automatically set the proper display resolution, resulting in a default resolution of 640x480 pixels. To adjust this to a resolution of 800x600 pixels, we'll need to upload the updated device tree available in the device-tree folder.
Access the device-tree folder and copy the imx6ull-colibri-aster.dtb file to your board. Change the [email protected] for your IP address.
$ cd device-tree
$ scp imx6ull-colibri-aster.dtb [email protected]:/home/root
Into your board, run the following commands to update the device tree and reboot the board.
# ubiupdatevol /dev/ubi0_1 imx6ull-colibri-aster.dtb
# reboot
Upon reboot, the desktop image should now occupy the entire screen size.
Finally, run the following command to initiate the touch calibration process. As the calibration process starts, press the points on the screen.
$ weston-touch-calibrator /sys/devices/platform/soc/2100000.bus/21a4000.i2c/i2c-1/1-002c/input/input0/event0
It's time to install and configure Qt on the host PC. Let's do this!
The Host Machine - Ubuntu 22.04
Install the SDK
The SDK was generated using the Yocto Project/OpenEmbedded-core. I plan to cover how to build the SDK using Yocto in future articles. For now, access the link to download the SDK and execute the installation script. I recommend keeping the default installation path (/opt).
$ ./tdx-xwayland-glibc-x86_64-Reference-Multimedia-Image-armv7at2hf-neon-colibri-imx6ull-toolchain-6.3.0.sh
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script, as shown below:
$ . /opt/tdx-xwayland-upstream/6.3.0/environment-setup-armv7at2hf-neon-tdx-linux-gnueabi
Once we've done this, the SDK will be installed. This step is necessary to allow cross-compilation for the Qt applications that will run on the embedded Linux system.
Install Qt Creator on Host Machine
On Ubuntu, make sure that OpenGL libraries are installed.
$ sudo apt-get install build-essential mesa-common-dev libgl1-mesa-dev
I'll be using the online installer version of Qt. Navigate to the Qt Open Source download page. Scroll down and click on the green Download the Qt Online Installer button.
Choose the option that corresponds to your operating system. In my case, I selected the Linux option and clicked Qt Online Installer for Linux (64-bit).
At this point, a file named qt-unified-linux-x64-4.6.0-online.run will be downloaded. Take note that the version may differ depending on when you perform the download.
Navigate to the download folder and provides the execution permission to the downloaded file by opening your terminal and typing in the following command:
$ sudo chmod +x qt-unified-linux-x64-4.6.0-online.run.
Then, execute the file:
$ ./qt-unified-linux-x64-4.6.0-online.run
We will be prompted to enter an existing Qt account credentials or sign up if we do not have one.
The next screen is related to terms and conditions. We'll need to read and agree to the terms and conditions of use. Click on Next to proceed. Also, enter the company's name or select the individual user option. Click on Next to continue.
Decide whether or not you wish to authorize Qt to collect usage statistics, then click Next.
In the following screen, choose the Custom installation option and click Next. This will lead us to the package selection window, as shown below. After making the selection, click on Next.
Read and accept the License Agreement and click Next. Finally, click Install and wait for the installation process to be complete.
Configuring Qt Creator for the Colibri i.MX6ULL
Adding Your Device in Qt Creator
Once you've installed Qt Creator, launch the application and navigate to Edit > Preferences in the top menu.
In the Preferences - Qt Creator window, select the Devices option on the left-hand side panel. Then, click on the Add button to add a new device. From the dropdown list, choose the Remote Linux Device option. Click on Start Wizard to start the setup process.
In the New Remote Linux Device Configuration Setup - Qt Creator window, enter your device's name, IP address, SSH port number, and username, as shown below. Click on Next.
Attention: Change the IP address to your board IP address.
In the next screen, I won't create a private key. Click on Next.
Then, finalize the setup process.
After clicking the Finish button, Qt Creator will automatically test the connection to your embedded device and verify the required commands. The final result has to be the message "Device test finished successfully".
Upon closing the test screen, you should see a window like the one below. Click on Apply to save your new device configuration.
Setting the Kit
Click on the Kits option on the left side. You should see a window similar to the one below.
First, we'll add a Qt version compatible with the SDK that we installed previously. Select the Qt Versions tab and press Add. Navigate to /opt/tdx-xwayland-upstream/6.3.0/sysroots/x86_64-tdxsdk-linux/usr/bin/, considering that you have installed the SDK under /opt folder, and select qmake, as the image below.
Now, we need to add the new C and C++ compilers that will be used for cross-compilation. Select the Compilers tab and click on Add button.
Select GCC > C on the menu list. Change the Name to GCC (C, ARM32 bits) or another name you prefer. In the Compliers path field, press the Browser button and navigate to /opt/tdx-xwayland-upstream/6.3.0/sysroots/x86_64-tdxsdk-linux/usr/bin/arm-tdx-linux-gnueabi/ and select the arm-tdx-linux-gnueabi-gcc. Click on Apply.
Press the Add button again. This time, select the GCC > C++ option. Change the Name to GCC (C++, ARM32 bits). In the Compliers path field, press the Browser button, navigate to the same previous folder, and select arm-tdx-linux-gnueabi-g++. Click on Apply.
Lastly, we must have the Manual C and C++ cross-compilers configured.
Next, we have to add a Debugger. Select the Debuggers tab and press Add. Under Manual, a New Debugger will appear. Change the Name to GDB (ARM32 bits). In the Path field, go to /opt/tdx-xwayland-upstream/6.3.0/sysroots/x86_64-tdxsdk-linux/usr/bin/arm-tdx-linux-gnueabi/ and select arm-tdx-linux-gnueabi-gdb. Click on Apply.
Return to the Kits tab and click on Add button. A kit named Unnamed will appear under Manual.
Change the name to iMX6ULL. In the Device type, select Remote Linux Device. This refers to our Colibri iMX6ULL board.
In Device, select the device created previously, IMX6ULL_BSP6, if it is not already selected.
Select the previously created GCC (C, ARM32 bits) and GCC (C++, ARM32 bits) in the Compiler field. Also, select the GDB (ARM32 bits) in the Debugger field.
Finally, in the Qt version field, select Qt 5.15.7. We should have a similar configuration to the image below.
Click Apply and OK to close the settings screen.
Conclusion
Whew! It was a good start!
But... I know... where is the "Hello World" application?
In the upcoming article, we'll take our first steps into application development and create a basic Qt "Hello World" project. We'll go through the necessary steps to deploy and debug this application to the i.MX6ULL board.
Please share your thoughts on this tutorial. Your feedback will be appreciated.
And stay tuned for more. See you there!
Developer | SFPC | FREERTOS | C | Python | Microcontroller | Embedded Linux
1 年Hi Charles, congratulations. I will be grateful if you make an article showing like generate an SDK using Yocto project. An article like this, very didactic and clean.
Embedded Systems Engineer | Product Architect | Innovating in Edge Computing & IIoT | Expert in Firmware Development | Passionate About Smart Tech, Real-Time Systems, and Driving Next-Gen Embedded Solutions
1 年Nice work ??
Senior Firmware Engineer | Author
1 年And nice to see an article about Toradex devices. I`ve worked once with Toradex SoM and it was a very pleasant experience.