C
Using Zephyr on NXP IMXRT1060-EVKB
Compatible versions
Qt Quick Ultralite for Zephyr supports Zephyr 4.1.0 and Zephyr 4.4.0 on NXP IMXRT1060-EVKB. The touch input driver is selected automatically based on the Zephyr version in use. See Selecting the touch input driver for details.
Prerequisites
- Qt Quick Ultralite 2.12.3
- Qt Quick Ultralite NXP i.MX RT1060 EVKB platform package
- NXP i.MX RT1060 EVKB
- RK043FN66HS-CTG or RK043FN02H-CT display shield
- Zephyr RTOS 4.1.0 or Zephyr RTOS 4.4.0
- Either Segger J-Link debug probe or MCUXpresso IDE
Flashing prebuilt binaries
Qt for MCUs offers a selection of prebuilt binaries showing various demos and examples. To flash these, follow the flashing instructions.
Preparing the Zephyr environment
Setting up Zephyr
Follow the getting started guide from Zephyr. This will set up the environment for development. You should be able to build and flash the blinky example from the guide.
Setting up the environment
Before building the application, set the following environment variables:
export QUL_ROOT=$HOME/Qt/QtMCUs/2.12.3 export ZEPHYR_DIR=/path/to/zephyrproject
set QUL_ROOT=C:\Qt\QtMCUs\2.12.3 set ZEPHYR_DIR=C:\path\to\zephyrproject
Building the application
Exporting the Qt Quick Ultralite application
Export the application code using the qmlprojectexporter:
$QUL_ROOT/bin/qmlprojectexporter \ /path/to/your/project.qmlproject \ --boarddefaults=$QUL_ROOT/platform/boards/nxp/mimxrt1060-evkb-zephyr/cmake/BoardDefaults_16bpp.qmlprojectconfig \ --toolchain GNU \ --platform mimxrt1060-evkb-zephyr \ --outdir /path/to/project_output_dir \ --project-type zephyr \ --platform-metadata $QUL_ROOT/platform/boards/nxp/mimxrt1060-evkb-zephyr/mimxrt1060-evkb-zephyr_16bpp_Linux_armgcc-metadata.json
%QUL_ROOT%\bin\qmlprojectexporter ^ C:\path\to\your\project.qmlproject ^ --boarddefaults=%QUL_ROOT%\platform\boards\nxp\mimxrt1060-evkb-zephyr\cmake\BoardDefaults_16bpp.qmlprojectconfig ^ --toolchain GNU ^ --platform mimxrt1060-evkb-zephyr ^ --outdir C:\path\to\project_output_dir ^ --project-type zephyr ^ --platform-metadata %QUL_ROOT%\platform\boards\nxp\mimxrt1060-evkb-zephyr\mimxrt1060-evkb-zephyr_16bpp_Windows_armgcc-metadata.json
Note: This export is needed only once per application project. CMake will automatically detect changes to QML files and update the generated code after the initial export.
Note: Some examples do not have main() function in the code. When exporting these examples, use the --generate-entrypoint argument, unless you are writing your own main() function. For more info about writing a main() function initializing Qt Quick Ultralite, see Running Qt Quick Ultralite in applications.
If the Qt Quick Ultralite application uses selectors for different variants, the --selector argument needs to be provided to the qmlprojectexporter. For example, the thermo demo can be configured with the following selectors:
--selector normal,small
The default configuration for Zephyr platforms is to export Qt Quick Ultralite libraries that are built with MinSizeRel configuration. If you have built Qt Quick Ultralite libraries with a different build configuration (such as Debug), you can override the exported library build type by adding --qul-build-type to qmlprojectexporter command:
--qul-build-type Debug
When exporting examples with --include-metadata-extra-target argument, make sure the --outdir is not inside the example source directory.
See the qmlprojectexporter documentation, QmlProject manual, and Generating projects for Zephyr for more information about qmlprojectexporter, qmlprojects and Zephyr project generation.
Building the Zephyr application
Activate the Python virtual environment to make the west command available:
source $ZEPHYR_DIR/.venv/bin/activate
%ZEPHYR_DIR%\.venv\Scripts\activate.bat
Make the flashing tool available in the PATH environment variable to enable flashing with west:
export PATH=$PATH:/path/to/flashing_tool
set PATH=%PATH%;C:\path\to\flashing_tool
Build and flash the application:
export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb export GNUARMEMB_TOOLCHAIN_PATH=$HOME/Qt/Tools/QtMCUs/arm_gcc_12_3_1 cd $ZEPHYR_DIR/zephyr west build /path/to/project_output_dir west flash --runner linkserver
set ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb set GNUARMEMB_TOOLCHAIN_PATH=C:\Qt\Tools\QtMCUs\arm_gcc_12_3_1 cd %ZEPHYR_DIR%\zephyr west build C:\path\to\project_output_dir west flash --runner linkserver
Use the --shield rk043fn02h_ct argument to the west build command to select the older RK043FN02H-CT display shield. RK043FN66HS-CTG is used by default if no argument is given.
Selecting the touch input driver
The platform supports two Zephyr touch input back-ends, selected at build time through the QUL_ZEPHYR_USE_KSCAN build option:
ON- uses the legacy Zephyr KScan driver. This is the default and is available on Zephyr 4.1.0.OFF- uses the Zephyr Input API.
KScan is the default. Since the KScan driver was removed in Zephyr 4.2.0, set QUL_ZEPHYR_USE_KSCAN to OFF when building with Zephyr 4.2.0 or higher:
west build /path/to/project_output_dir -- -DQUL_ZEPHYR_USE_KSCAN=OFF
Debugging
Zephyr supports debugging with west by either debugging directly or launching a debug server and connecting to it with a debugger. The steps below show how to run a debug server with west and how to connect to it using GNU Project Debugger (GDB).
Make the debug server (such as LinkServer) available in the PATH environment variable to enable debugging with west:
export PATH=$PATH:/path/to/debug_server
set PATH=%PATH%;C:\path\to\debug_server
Launch the debug server:
west debugserver --runner linkserver
LinkServer sets up a TCP socket listening to port 3333, which you can connect with the GDB in another terminal:
cd $ZEPHYR_DIR/zephyr/build $GNUARMEMB_TOOLCHAIN_PATH/bin/arm-none-eabi-gdb -tui -ex "target remote localhost:3333" zephyr/zephyr.elf
cd %ZEPHYR_DIR%\zephyr\build %GNUARMEMB_TOOLCHAIN_PATH%\bin\arm-none-eabi-gdb -tui -ex "target remote localhost:3333" zephyr\zephyr.elf
Available under certain Qt licenses.
Find out more.