C
Getting started on STM
Overview
This topic provides all the necessary information to get started on the STM platforms supported by Qt Quick Ultralite.
Note: Make sure you have all the prerequisites installed before setting up the development environment.
Setting up the development environment
Configuring the Qt Creator IDE
To develop for MCUs using the Qt Creator IDE, the MCU plugin is required. Qt Online Installer enables it by default when you install the Qt for MCUs SDK.
To build and run your application on MCUs, you must create a kit:
- Select Edit > Preferences > Devices > MCU.
Note: If you cannot see the MCU tab, select Help > About Plugins, enable the McuSupport plugin, and restart Qt Creator to apply changes.
- If not already set, provide the path to the Qt for MCUs installation directory.
- Select a Target supported by the Qt for MCUs SDK. For example, Qt for MCUs 2.8.2 - STM32F469I-DISCOVERY-BAREMETAL 24bpp.
- In the Requirements section, ensure that the platform-specific requirements are met.
- Select Automatically create kits for all available targets on start to create kits automatically.
Note: You can also create/update kits manually using Create Kit and Update Kit.
- Select Apply and restart Qt Creator if you choose to create kits automatically.
Configuring CMake variables
You can also set up the development environment from the command prompt. For more information on how to use CMake with Qt Quick Ultralite when developing applications for STM boards, see CMake manual for STM boards.
Building applications with prebuilt Qt Quick Ultralite libraries
Building applications using Qt Creator IDE
- Open the CMake project file for the example you want to build.
- In the Configure Project window:
- Select the kit you created earlier. For example, Qt for MCUs 2.8.2 - STM32F469I-DISCOVERY-BAREMETAL 24bpp.
- Select Configure Project.
Once the project is configured, select Run or press Ctrl+r on your keyboard to build and flash the binary to the target.
Building applications using the command prompt
Command line setup
To get started from the command line, make the following changes to System PATH
.
- Add STM32CubeProg install directory to
System PATH
if it is not installed in the default location. - Add
ST-LINK_gdbserver.exe
directory to yourSystem PATH
<STM32_CUBE_IDE_INSTALL_PATH>\stm32cubeide_1.3.0\plugins\com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.win32_1.3.0.202002181050\tools\bin
where,
<STM32_CUBE_IDE_INSTALL_PATH>
is the Cube IDE install path.Note: STM32CubeIDE is optional and required only for on-chip debugging purposes.
Building a minimal example from the command prompt
You can also build applications from the command prompt. The examples below illustrate how to build the minimal
example for the STM32F469I
discovery board.
QUL_ROOT
and QUL_TOOLS
are used in the command line examples below as if they were set as environment variables. For example:
export QUL_ROOT=$HOME/Qt/QtMCUs/2.8.2 export QUL_TOOLS=$HOME/Qt/Tools/QtMCUs
set QUL_ROOT=C:\Qt\QtMCUs\2.8.2 set QUL_TOOLS=C:\Qt\Tools\QtMCUs
cd $QUL_ROOT/examples/minimal mkdir build cd build cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=MinSizeRel -DQul_ROOT=$QUL_ROOT -DCMAKE_TOOLCHAIN_FILE=$QUL_ROOT/lib/cmake/Qul/toolchain/armgcc.cmake -DQUL_TARGET_TOOLCHAIN_DIR=$QUL_TOOLS/arm_gcc_12_3_1 -DQUL_BOARD_SDK_DIR=$QUL_TOOLS/STM/STM32Cube_FW_F4_V1.28.0 -DQUL_PLATFORM=STM32F469I-DISCOVERY-baremetal cmake --build .
cd %QUL_ROOT%\examples\minimal mkdir build cd build cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=MinSizeRel -DQul_ROOT=%QUL_ROOT% -DCMAKE_TOOLCHAIN_FILE=%QUL_ROOT%\lib\cmake\Qul\toolchain\armgcc.cmake -DQUL_TARGET_TOOLCHAIN_DIR=%QUL_TOOLS%\arm_gcc_12_3_1 -DQUL_BOARD_SDK_DIR=%QUL_TOOLS%\STM\STM32Cube_FW_F4_V1.28.0 -DQUL_PLATFORM=STM32F469I-DISCOVERY-baremetal cmake --build .
Once you have successfully built the minimal
example application, use the following command to flash it:
cmake --build . --target flash_minimal
The same procedure applies to other STM boards that are supported by Qt Quick Ultralite.
Debugging
- Open terminal window and run the following command:
ST-LINK_gdbserver -d -cp "<STM32_CUBE_PROG_INSTALL_PATH>/bin"
ST-LINK_gdbserver.exe -d -cp "<STM32_CUBE_PROG_INSTALL_PATH>\bin"
where,
<STM32_CUBE_PROG_INSTALL_PATH>
is the directory where you've installed the Cube Programmer tool.GDB Server is now listening for TCP connections on the default port,
61234
.Note: Actual TCP port used by
ST-LINK_gdbserver
is printed out on gdbserver's console. - Run
arm-none-eabi-gdb
in a separate console$QUL_TOOLS/arm_gcc_12_3_1/bin/arm-none-eabi-gdb <PATH_TO>/your_app.elf
%QUL_TOOLS%\arm_gcc_12_3_1\bin\arm-none-eabi-gdb.exe <PATH_TO>\your_app.elf
- Connect to the target via the gdbserver in the
arm-none-eabi-gdb
console using(gdb) target remote 127.0.0.1:61234
Troubleshooting
ST-LINK_gdbserver
requires up-to-date ST-LINK firmware to be installed. If you see the following error:
Error in initializing ST-LINK device. Reason: ST-LINK firmware upgrade required.
you must upgrade the firmware to the latest version using the STM32CubeProgrammer tool.
If the problem persists after upgrade, retry with ST-LINK Upgrade
tool from the ST webpage ( Download ).
Supported STM boards
Tier 1: Reference Targets
Hardware board | MCU | Compiler | Operating system(s) |
---|---|---|---|
STM32F769I-DISCOVERY | STM32F769NI | GNU Arm GCC 12.3.rel1, IAR Build Tools for Arm V9.40 | Bare Metal, FreeRTOS |
STM32H750B-DISCOVERY | STM32H750XB | GNU Arm GCC 12.3.rel1, IAR Build Tools for Arm V9.40 | Bare Metal |
Tier 2: Verified Targets
Hardware board | MCU | Compiler | Operating system(s) |
---|---|---|---|
STM32F469I-DISCOVERY | STM32F469NI | GNU Arm GCC 12.3.rel1, IAR Build Tools for Arm V9.40 | Bare Metal |
Resource cache policy
By default, an application's resource data is copied to SDRAM on startup. In order to retain these resources in flash and not load them to RAM on startup, add the following QmlProject option to your qmlproject file:
MCU.Config { resourceCachePolicy: "NoCaching" }
Alternatively, it can be enabled only for individual images like this:
ImageFiles { files: [ "big/button.png" ] MCU.resourceCachePolicy: "NoCaching" }
Note: Resources used for blending/blitting operations can be stored on the fast external flash if available, without copying them to RAM.
Available under certain Qt licenses.
Find out more.