This topic helps you setup the development environment for STM's STM32L4R9I-Disco.
Use the Qt online installer to install the following prerequisites. You can download the installer from your Qt account .
注意： Ninja is an optional build tool and can be replaced with others like JOM or NMake. It is not needed when using Qt Creator.
Ensure that it is installed in the default location (
注意： The Qt online installer does not install the STM Cube Programmer by default. You must select it explicitly from the list of third-party tools and SDKs.
注意： You could also manually create/remove kits using Create Kit and Remove Kit .
注意： Automatically create kits for all available targets on start option is available from Qt Creator v4.14 onwards. On older versions of Qt Creator, you have to explictly create or remove kits using Create kit or Remove kit .
To get started from the command line, ensure that the following these instructions:
Qul_DIRto the Qt for MCUs SDK install path.
<QT_INSTALL_PATH>is the Qt install directory,
<VERSION>is the directory containing the Qt Quick Ultralite version you are using, for example
ARMGCC_DIRto the ARM Toolchain install path.
IAR_ARM_COMPILER_DIRto the IAR Build Tools install path.
PATH. If you installed these tools using the Qt online installer, they are installed under
ST-LINK_gdbserver.exedirectory to your
is the Cube IDE install path.
注意： STM32CubeIDE is optional and required only for on-chip debugging purposes.
STM32Cube_FW_L4_SDK_PATHenvironment variable and set it to:
where, <QT_INSTALL_PATH> points to the Qt install directory.
Qt Creator provides a build configuration with the kit that you created earlier for the Qt for MCUs 1.7 - STM32L4R9I-DISCOVERY-BAREMETAL 24bpp target. If you are using a command-line setup, configure using the following CMake variables. For more information, see the CMake 手册 .
The platform to build must be set to
for this board.
The supported color depth by this platform is 24-bit.
注意： If this variable is not set, default color depth is used while configuring for the platform.
By default, the asset data for application is copied to SDRAM on application startup. In order to keep resources in external flash, and not load it to RAM on startup, use the
CMake option with the value
when adding assets to the application with
The package for
board comes with a prebuilt
demo binary. You can find it in the
见 Flashing Instructions for ST boards , for information about flashing the device.
For this board, select MX25LM51245G_STM32L4R9I-DISCO as the external loader.
Open the CMake project file for the example you want to build and configure it with the kit you created earlier. Once the project is configured, select 运行 or press Ctrl+r on your keyboard to build and flash the binary to the target.
demo for this board:
cd %Qul_DIR%\demos\watch mkdir build cd build cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=%Qul_DIR%\lib\cmake\Qul\toolchain\armgcc.cmake -DQUL_PLATFORM=STM32L4R9I-DISCOVERY-baremetal cmake --build .
Once you have successfully built the
demo, you can flash it from the command line:
cmake --build . --target flash_watch
The same procedure applies to any other application.
By default, the output of
calls are redirected to a virtual serial port, which is exposed on the host machine via USB.
ST-LINK_gdbserver.exe -cp "<STM32_CUBE_PROG_INSTALL_PATH>\bin"
is the directory where you've installed the Cube Programmer tool.
GDB Server is now listening for TCP connections on the default port,
Actual TCP port used by
is printed out on gdbserver's console.
arm-none-eabi-gdbin a separate console
(gdb) target remote 127.0.0.1:61234
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 工具。
If the problem persists after upgrade, retry with
tool from the ST webpage (
STM32L4R9AII6 MCU does not have double-precision floating-point support. Care should be taken to avoid using them.