Quick Starter Guide

This topic provides instructions to develop the classic hello world application. It lets you quickly explore the Qt for MCUs offering by creating this simple application. It uses the Qt Creator's new project template that is designed specifically for the MCU platforms.

Setting up development environment

Before you start, ensure that the following prerequisites for the Windows development host are met:

  • MSVC++ compiler v14.16 (Visual Studio 2017 15.9) up to v14.26 (Visual Studio 2019 16.6)
  • CMake 3.15 or newer (you can install it using the Qt Online installer)
  • Clang 8.0.0 or newer (it's installed as part of Qt Creator)

    Note: Add the Clang binary directory to your system PATH. If you installed Qt Creator using the Qt online installer, clang binaries are installed under <QT_INSTALL_PATH>\Tools\QtCreator\bin\clang\bin. This step is not needed when using Qt Creator.

In addition, install Qt for MCUs using the Qt online installer that is available for download on Qt account.

Now that the prerequisites are installed, follow the instructions in these sections to set up Qt Creator.

Configure the Qt Creator IDE

To develop for MCUs using the Qt Creator IDE, the MCU plugin is required. The Qt online installer enables it by default when you install the Qt for MCUs SDK.

To enable or disable the plugin, follow these instructions:

  1. Select Help > About Plugins and choose the MCU Support plugin from the list.
  2. Restart Qt Creator to apply changes

To build and run your application on MCUs, you must create a kit:

  1. Select Tools > Options > Devices > MCU
  2. If not already set, provide the path to the Qt for MCUs installation directory.
  3. Select a Target supported by the Qt for MCUs SDK. For example, Qt for MCUs 1.6 - Desktop.
  4. In the Requirements section, ensure that the platform-specific requirements are met.
  5. Select Automatically create kits for all available targets on start to create kits automatically.

    Note: You could also manually create/remove kits using Create Kit and Remove Kit.

  6. Click Apply and restart Qt Creator if you choose to create kits automatically.

Note: The Automatically create kits for all available targets on start option is available from Qt Creator v4.14 onwards. On older versions of Qt Creator, you have to explictly create or remove kits using Create kit or Remove kit.

Creating the project

Now, assuming that your development environment is ready, the following list guides you through the process:

  1. Open Qt Creator and select File > New file or Project.
  2. Choose the Application (Qt for MCU) > MCU Support template.

  3. Select Choose and give a Name to the project.

    \eHelloMCU for example

  4. Select Next and follow the wizard to create the project.

After you select Finish on the project wizard, your project explorer looks like this:

Notice (1) that the wizard creates the necessary files, including the HelloMCU.qml file. This QML file (2) defines a Rectangle containing the Text item with the text, "Hello World".

Modify the Text item

The Text item's font.pixelSize is set to 14 by default. Try increasing the font size to 18 and also color to teal for example. You could also set a background color, by setting the color property of the Rectangle. This is how the QML file looks after you have made these changes:

import QtQuick 2.0

Rectangle {
    width: 480
    height: 272
    color: "black"
    Text {
        anchors.centerIn: parent
        color: "teal"
        text: "Hello World!"
        font.pixelSize: 18

Now, run the application to see how it looks.

Run on a target hardware

The application is configured to run on the desktop, but you can also retarget it run on a NXP hardware for example. Before you do so, ensure that you have necessary setup to run on any of the supported hardware platforms. To get started on any of these platforms, follow instructions in these topics:

In addition, configure Qt Creator to build and run applications on these targets. For more details, refer to Qt Creator manual.

Once the setup is ready, select Run or use the Ctrl + R keyboard shortcut to see your application running on the target.

Available under certain Qt licenses.
Find out more.