C
Tutorial: Deploying Your First Project with Boot to Qt
You can deploy all kinds of Qt projects to your target device: Qt Examples and projects that you have created yourself. In this tutorial, we use Qt Creator's project wizard and create a new Qt Quick project. We build and run the project, and deploy it to a target device.
This tutorial guides how you deploy a project to one of the reference target devices with pre-built Boot to Qt images (see Supported Target Devices and Development Hosts). However, you should follow similar steps when you deploy to a target device where you have built an image yourself.
The tutorial assumes that you have installed the Boot to Qt Software Stack to your development host and flashed it to your target device. That is, the Get Started with Boot to Qt appears on the device screen when you power on the device.
Preparation of Boot to Qt Kit
Qt Creator groups build and run specific settings as kits. Each kit consists of a set of values that define one environment, such as a target device, tool chain, Qt version, and debugger command to use.
Before deploying, make sure that your kit contains the target device. Connect your target device to the host platform, open Qt Creator, and execute the following steps:
- Select Edit > Preferences > Kits.
- Select one of the predefined kits starting with Boot to Qt... that matches the type of your device (1).
- Select the appropriate device in the Run device field (2).
- Select OK.
Troubleshooting: Device Is Not Found
When your target device is connected to the host platform, Qt Creator should automatically detect it and the device should appear in the kit's Device field. If it does not appear, you can try if replugging the device or rebooting the host platform helps.
Note: In Linux, ensure that you have access to plugged in devices. For more information, see Setting Up USB Access to Embedded Devices.
Creating New Qt Quick Project
Create a new Qt Quick project with the steps in Creating Qt Quick Applications. When creating the project, you can use the default values defined in the wizard pages. In the Kit Selection page, select the Boot to Qt Software Stack kit that matches the type of your target device. The following picture illustrates how to select the kit where the device was added in Preparation of Boot to Qt Kit:
After you complete the steps in the project wizard, the generated Qt Quick project is automatically opened in the Edit mode (1).
You can see the project's structure by selecting Projects in the sidebar (2). If you select the CMakeLists.txt file (3) under your project, you see its content in the editor view. The last lines in the CMakeLists.txt file (4) define the path where your project is deployed. Qt's project wizard generates the path automatically for Qt Quick projects. For other projects, you might need to define the path manually in the CMakeLists.txt file.
For more information on CMake, see Build with CMake. For more information on Qt Creator configurations for Boot to Qt, see Boot to Qt Deploy Configuration.
Building, Running, and Deploying Project
Now it is time to build and run your project, and deploy it to the target device. When you run the project, Qt Creator automatically both builds it and deploys it to the device. Thus, you just need to select the Run button (1) in Qt Creator.
Your project should now be running on the target device.
For more information on CMake deployment, see Deployment in CMake documentation.
Custom Deployment Steps
Qt Creator allows you to execute custom commands on the embedded device connected to the development host. You can add the custom commands to the deployment phase of your project.
To add a custom step to be executed during deployment:
- In Qt Creator, go to Projects > Run for the Boot to Qt version you want to customize.
- Click Add Deploy Step and select Run custom remote command.
- Enter the command to be executed.
Available under certain Qt licenses.
Find out more.