Veethree D7 SDK
Loading...
Searching...
No Matches
Building a QML application using the D7 SDK

Note
In order to use Qt libraries you must have your own Qt development and distribution licenses. Please refer to https://www.qt.io/qt-licensing for more information.

This application will demonstrate integrating the D7 SDK in a QML project that will run both on the host and the target device. It displays resistance readings from the built-in analog sensors. Each sensor is set up as a 1-wire resistance sensor.

For more information about all the available hardware interfaces and their configurations, please refer to the Hardware interfaces page.

For this example, you will need to have the Qt libraries installed separately from the D7 SDK. Please refer to the guide for installing Qt.

Test harness

While running on the host, the sensor readings are mocked, since there are no sensors that can be used there. They will all read 249 Ohms.

On the target device however, you can connect resistances between AGND (pin 4, 23-way AMPSEAL connector) and each one of pins 4, 5, 6, 15, 16, 17 in the AMPSEAL 35-way connector so that you can see the the device's resistance sensors in action.

Example resistance wiring between VRSNS_0 (pin 6) and AGND

Target build

Similar to the previous example, you will need to open a new terminal, navigate to the D7 SDK installation directory and activate the development environment.

cd $HOME/d7-sdk/
source ./toolchain/environment-setup-armv8a-veethree-linux

On Windows, open a new CMD window, navigate to the D7 SDK installation directory and run:

cd %USERPROFILE%\d7-sdk
.\toolchain\environment-setup-armv8a-veethree-linux.bat
cd examples/gui/qml-analog/
# Create the build directory
mkdir target-build
cd target-build/
# Configure and build the project
cmake -S.. -GNinja
cmake --build .

Assuming the D7 is connected to the network via ethernet and its IP address is known (see Connecting via SSH), run the following command to transfer the executable:

# Replace $device_ip with the D7's IP address
scp qml-analog-app root@$device_ip:/app

Once the transfer is complete, ssh into the device.

Important
If the default app – that displays the board's serial number and IP – is currently on screen, you will need to stop the system service for it in order to allow other QML applications to be on screen.

To do that run:

systemctl stop qml-hello-world-app

If the application was built on Windows, you will also need to mark the application as executable:

chmod +x qml-analog-app

You should now be able to run the application and, if you have connected any resistances as described in the test harness section, their values should be displayed on screen now.

Host build

Linux

As before, if you are on Linux, in a new terminal you will need to source the environment script with this command:

source ./toolchain/environment-setup-x86_64

Then navigate to the source directory and create the build directory:

cd examples/gui/qml-analog/
# Create the build directory
mkdir host-build
cd host-build/

You will then need to configure and compile the project.

Note
For running applications that use the D7 SDK and Qt libraries on the host, you will need to configure the project by setting "CMAKE_PREFIX_PATH" to the installation directory of the Qt libraries.

This guide assumes Qt has been installed at the default location: $HOME/Qt
# Configure and build the project
cmake -S.. -GNinja -DCMAKE_PREFIX_PATH=$HOME/Qt/6.8.3/gcc_64
cmake --build .

Windows

On Windows, open a new CMD window, navigate to the D7 SDK installation directory and run:

cd %USERPROFILE%\d7-sdk
.\toolchain\environment-setup-x86_64-mingw32.bat
cd examples/gui/qml-analog/
# Create the build directory
mkdir host-build
cd host-build/
Note
For running applications that use the D7 SDK and Qt libraries on the host, you will need to configure the project by setting "CMAKE_PREFIX_PATH" to the installation directory of the Qt libraries.

This guide assumes Qt has been installed at the default location: %HOME%/Qt
# Configure and build the project
cmake -S.. -GNinja -DCMAKE_PREFIX_PATH=%HOME%/Qt/6.8.3/gcc_64
cmake --build .

The previous commands should run without any errors and produce output similar to the following.

Example commands and output

You should now be able to run qml-analog-app from the build directory and it should look like this:

QML Resistance reading app

Summary

In this page we have described configuring, building and running a QML application for both the host and the target device, as well as attaching resistances to the sensor pins in the AMPSEAL 35-way connector.

There are other example applications that explore other hardware interfaces, such as the 4-20mA interface or the Digital In/Out interface.

Previous step

Installing Qt libraries and Qt Creator

Next step

If you plan to use Qt Creator for development, the next step is setting up Qt Creator.

Otherwise, you can skip to the Software Updates section of this guide.