C
Using Zephyr on NXP IMXRT1060-EVKB
Compatible versions
Qt Quick Ultralite for Zephyr has been tested on Zephyr 3.6.0, which is the officially supported version for NXP IMXRT1060-EVKB.
Note: Zephyr 3.7.0 LTS is currently not supported.
Prerequisites
- Qt Quick Ultralite 2.9.0
- Qt Quick Ultralite NXP i.MX RT1060 EVKB platform package
- NXP i.MX RT1060 EVKB
- RK043FN66HS-CTG
- Zephyr RTOS 3.6.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.9.0 export ZEPHYR_DIR=/path/to/zephyrproject
set QUL_ROOT=C:\Qt\QtMCUs\2.9.0 set ZEPHYR_DIR=C:\path\to\zephyrproject
Patching Zephyr
You need a patch for Zephyr 3.6.0 to compile a Zephyr application using Qt Quick Ultralite. This patch is provided with the Qt Quick Ultralite Zephyr platform port and you can apply it using git am
:
cd $ZEPHYR_DIR/zephyr git am $QUL_ROOT/platform/boards/nxp/common/zephyr/0001-Fix-the-z_impl_k_usleep-argument-type.patch
cd %ZEPHYR_DIR%\zephyr git am %QUL_ROOT%\platform\boards\nxp\common\zephyr\0001-Fix-the-z_impl_k_usleep-argument-type.patch
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 \ --generate-entrypoint \ --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 ^ --generate-entrypoint ^ --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.
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
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 -b mimxrt1060_evkb /path/to/project_output_dir west flash
set ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb set GNUARMEMB_TOOLCHAIN_PATH=C:\Qt\Tools\QtMCUs\arm_gcc_12_3_1 cd %ZEPHYR_DIR%\zephyr west build -b mimxrt1060_evkb C:\path\to\project_output_dir west flash
Note: By default, west
expects J-Link to be used. The used flashing tool can be changed to NXP MCUXpresso LinkServer by specifying --runner linkserver
. For more info, see Zephyr documentation.
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 the J-Link gdbserver) 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
Note: By default, west
expects the J-Link gdbserver to be used. The used debug server can be changed by specifying --runner <debug_server>
. For more info, see Zephyr documentation.
The default debug server sets up a TCP socket listening to port 2331, which you can connect with the GDB in another terminal:
cd $ZEPHYR_DIR/zephyr/build $GNUARMEMB_TOOLCHAIN_PATH/bin/arm-zephyr-eabi-gdb -tui -ex "target remote localhost:2331" zephyr/zephyr.elf
cd %ZEPHYR_DIR%\zephyr\build $GNUARMEMB_TOOLCHAIN_PATH\bin\arm-zephyr-eabi-gdb -tui -ex "target remote localhost:2331" zephyr\zephyr.elf
Available under certain Qt licenses.
Find out more.