Simplify Your Development Toolset with Qt for Everything from MCUs to Desktop PCs

Posted on December 18, 2020 by Sam Kreuze

Fragmented toolsets are insidious. While not blocking development at any one step, the constant start and stop, context switching, and other inefficiencies can slow progress to a crawl.

Where there is a single framework that can be applied to multiple platforms, you will almost always see it being used.

Qt is one of those frameworks, now enabling a unified graphical user interface (GUI) for everything from microcontrollers (MCU) to desktop PCs.

Qt on the NXP RT1050

Qt recently released Qt for MCU which allows developers to deploy GUIs for bare-metal or real-time operating systems. Having used Qt on projects before, I was curious to see how Qt for MCU compared and what it was capable of. With a i.MX RT1050 EVK (and touchscreen) in hand, I set off.

Trying the pre-built demo

Before setting up a development environment, I first wanted to see what Qt for MCUs would look like on an actual target. No sense walking through all those getting started guides if the end-product isn’t a capable GUI.

Qt has pre-built applications for the supported targets so you can get a feel of the capabilities firsthand. I downloaded the binary for the RT1050 EVK and loaded it onto the kit over its USB interface.

I was pleasantly surprised by the thermostat GUI with its fluidity and animations. Let’s see if I can build it on my own…

Setting up the development environment

I first needed to install Qt for MCUs and then the RT1050 SDK. A lot of resources were found in Qt’s own instructions.

Building from a windows machine, I installed Qt for MCUs with the Qt unified installer. A license needs to be connected to your Qt account so that the appropriate options appear in the installer (for now, I’m using a trial license). I was sure to install Qt Creator as well from under Developer Tools.

For the NXP tools, I already had MCUXpresso installed and installed SDK_2.3.0_EVK-MIMXRT1050_MCUX_IDE as well.

Next, I launched Qt Creator where I was able to find the Thermostat Demo, pictured below.

I was then prompted to select a kit. I wanted it to run on my desktop so I could see quick edits, as well as on the RT1050 EVK.

I was next meant to configure the kits for my development machine

(Tools -> Options, if not obvious).

This took some trial and error before I realized I was making it more difficult that it needed to be. For the Desktop kit, make sure you have MSVC installed and select the compilers. Qt creator is usually pretty good at finding all the compilers on your machine. I was also sure to select the CMake tool included in the Qt install.

The kit for the EVK has a similar setup except the appropriate ARM GCC compiler must be selected.

The thermo project should now appear. If it doesn’t automatically run CMake, right click on the project and do so. At the bottom left of Qt creator, you can select the kit to build with and run it.

If your kits are set up appropriately and you selected the Desktop kit, you should see the thermostat appear in a window on your machine.

In order to flash the thermostat project, I had to change its name from “thermo” to “thermo_small” on line 3 of CMakeLists.txt:

project(thermo_small VERSION 0.0.1 LANGUAGES C CXX ASM)

After that, I was able to flash the application on the target.

First impressions

I was able to set up the build environment quite easily. I then created my own application to see what I could do myself.

At first, I struggled with the differences between the regular Qt Quick Libraries and the Quick UltraLite Libraries needed for the MCU. I found myself setting up components as I would in regular Qt to discover later that they are not supported or certain properties are not there. This was particularly disappointing because I had an existing GUI on an embedded Linux platform that I was hoping to transfer to a RT1050 more easily. However, with Qt for MCUs obviously being different from full-fledged Qt, this task is not as trivial as I hoped.

The documentation found on Qt’s website specific to Qt for MCUs is invaluable, but I haven’t yet found out how to access it inside QT creator with a simple key press.

Even with its limitations, the capability of Qt for MCU is quite vast. I like that I can learn one GUI framework and apply it to many platforms, now including MCUs. Qt for MCUs is a useful option when selecting a GUI framework. It can help teams streamline the development process, reduce risk, and build better products.

Sam Kreuze
by Sam Kreuze
Embedded Engineer
Sam Kreuze is an embedded engineer at DornerWorks.