One of the new and a quite remarkable items we’re introducing with Qt 5.6 is the possibility to use Windows host computer for embedded Linux development and deployment. The aim of the feature is to make embedded development workflow as seamless as possible regardless of the host OS. So now Windows users can use their machine to host their embedded development, too.
For an overview and a demo of the feature, check out this small video clip from Embedded World:
The workflow is based on our pre-built software stack, Boot to Qt, which is part of our Qt for Device Creation offering. Boot to Qt is a lightweight, Qt-optimized Linux software stack that fully utilizes the Yocto Project tooling. This gives you an immediate, pre-configured kick-start to embedded development with many common development boards. It also provides a good basis for customizing the stack for your own production needs and boards. For an overview of whole Qt for Device Creation offering and the workflow with Boot to Qt, take a look at this video, recorded under Linux host, but now with the workflow also being available for Windows host:
Here in this post, I will also give you instructions on how to get started with development on a Windows host computer. To successfully set up Qt for Device Creation on Windows, you must closely follow the instructions in this section.
Setting up Qt for Device Creation on Windows
1. Install adb from the Android SDK Tools
Qt Creator is using the Android Build Bridge (adb) for the target device deployment. You can install adb as a part of the Android SDK Tools Package, which can be downloaded from the Android developer site. Make sure to select Tools > Android SDK Platform-tools and Extras > Google USB Driver in the Android SDK manager (everything else is not needed and can be disabled).
2. Installing VirtualBox for the Emulator
In addition to working directly on real hardware, Qt for Device Creation comes with a full emulator. The emulator relies on VirtualBox virtualization software which you need to install separately. You can download it from here.
After installation, start the VirtualBox user interface and select File > Preferences > Network to open VirtualBox network settings.
Edit the properties of the first host-only network (If you do not have an host-only network create one):
- Change the IPv4 address to 192.168.56.1 and the IPv4 network mask to 255.255.255.0.
- In the DHCP Server tab, select the Enable Server check box.
- Change the server address to 192.168.56.1.
- Change both the lower and upper address bounds to 192.168.56.101.
- If a firewall is enabled on the development host, it needs to allow TCP and UDP packets between your host and the virtual machine.
3. Installing Qt for Device Creation
Download the Qt for Device Creation installer, either from your Qt Account web portal (if you already are an existing Qt licensee) or request for a free 30-day evaluation. The installer will let you select a directory where Qt for Device Creation will be installed.
In this post the installation directory is referred to as <INSTALL_DIR>. The default installation directory is C:\Qt.
4. Install Boot to Qt on Target Devices
Boot to Qt comes pre-built for a variety of common development boards. If you target only the emulator you can skip this step.
Before you are able to deploy and test your Qt application on hardware, you must flash the target device with an image that contains the Boot to Qt stack. On windows you can create bootable drives with the Boot to Qt Flashing Wizard. It can be found under <INSTALL_DIR>\Tools\b2qt\b2qt-flashing-wizard.exe or in Qt Creator under Tools > Flash Boot to Qt device.
After flashing the device it contains not only the stack but also by default launches into the demo launcher which you can use to explore all kinds of Qt demos for embedded.
The next step is setting up the connection between the host computer and the device for developing and deploying your own applications.
5. Setting up USB Access to Embedded Devices
Again, if you are targeting only the emulator, you can skip this step.
You can confirm that the connection is working by running the following cmd command:
<android sdk install dir>/platform-tools/adb.exe devices -l
The output should be a list of connected Boot to Qt (and Android) devices, identified with a serial number and a name. If your device is missing from the list, or the serial number is displayed as “??????”, the connection is not working properly. Check that the device is powered on, and disconnect and reconnect the USB cable.
Additionally on Windows, you may need to install or update the Android Device driver. You can check whether a driver is already installed when a device is attached via the Device Manager. If you haven’t installed any driver there should be an USB Function Filesystem under Other devices. If this is the case you have to install the USB driver by the following steps:
- Open Other devices > USB Function Filesystem.
- Switch to the Driver tab and click Update Driver.
- Do not let windows search automatically for an updated driver, but select “Browse My Computer for driver software”.
- Select “Let me pick from a list of device drivers on my computer”.
- Open “Have Disk…”
- Install the driver that is located at <Android-SDK-Tools-install-dir>\extras\google\usb_driver\android_winusb.inf
If you already have an Android ADB Interface under Android Device and can not discover any devices you may need to update the driver. This can be achieved by running the previous steps on the Android Device > Android ADB Interface.
The emulator may be listed as well. Its serial number is its IP and the port number: 192.168.56.101:5555.
6. Configuring a Device Kit in Qt Creator
After you have prepared the hardware, you must perform one final step to set up the development tools in Qt Creator for your device. That is, you must configure the correct device to be used for each build and run kit. Connect your device to the development host via USB and launch Qt Creator. In Qt Creator:
- Select Tools > Options > Build & Run > Kits.
- Select one of the predefined kits starting with Boot to Qt… that matches the type of your device.
- Select the correct device in the Device field.
- Select OK.
You are now ready to start developing for your device. For more information, see Building and Running an Example.
Create your first example
There you go, everything is set up. You are now ready to write your first small application!
From Qt Creator, create a new “Qt Quick Application (Boot to Qt)” with the ‘New File or Project’ dialog and select the kits that should be used to build the project. When you have finished the wizard select the current platform via the kit selector and everything is in place to build your first project.
When the project is built it can be directly executed. The application gets automatically deployed to the device before the execution. The project could also be manually deployed via Build > Deploy Project <projectname>.
Let me know what you think!