Example project for STM32H745 Nucleo-144 board. Supports two kernels, both compile and debug. This is temporary solution, until full support is implemented in CLion.
This example is specially made for multi-core MCUs, like some of STM32H7xx chips
Single-core STM32 MCUs are supported out-of-the-box
- STM32CubeMX and STM32H7 software pack
- CLion 2020.2+ and it's bundled
Embedded Development Supportplugin - GNU Arm Embedded Toolchain
- STM32CubeIDE
- (Windows only) MinGW
Two LEDs are blinking. One is controlled by CM4 kernel, another obe by CM7 kernel
The project contains two separate sub-projects, and each one is a complete CLion+CMake project with some shared code at the top level. Obviously CM7 is for Cortex-M7 kernel, CM4 forCortex-M4
Each of the projects is open in it's own CLion instance, and then builds, flashes, and debugs independently.
- Install and configure all the required tools. See CLion Quick start guide
- Start STM32CubeMX and make a new project.
- Note I. On the
Project Managertab,Toolchain/IDEfield must be set toSTM32CubeIDE - Note II. Do not use space, international, or special characters for project name or path
- Note I. On the
- Generate the project code. STM32CubeMX will create a project folder with two separate subprojects
- Open each of them in different CLion windows. Do not open the root project!
- Add
CMakeLists.txtto each of the subprojects using a template - Now check all the
TODOcomments in thoseCMakeLists.txtfiles and put actual values instead. TODO tool window is a great feature for that. It's recommended to set subproject name to a form of<project name>_<kernel name> - Right-click
CMakeLists.txtin theProjecttool window and then clickLoad CMake Project - Your CMake project will be parsed. If there are errors, correct them and select
Tools -> CMake -> Reset Cache and Reload Prpjectfrom the main menu. Repeat until everything is fixed and the CMakeLists is successfully parsed. - Create
Run Configurationsfor both projects- Select create new Embedded GDB Server run configuration.
- Select
Target. There shall be the only one. - Select
Executable. There shall be the only one. - Set
tcp::<port number>to'target remote' argsfield. The port number may be virtually any in range 1024..65535 but it must nt clash with the conterpart project port number. Use the same number below - Locate
ST-LINK_gdbserverexecutable and select for asGDB serverThe executable resides in the inSTM32CubeIDEinstallation folder,plugins/com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.????/tools/bin/subfolder. Actual name varies from version too version, and exact name can't be provided - Locate
STM32_Programmer_CLIexecutable similar way, but the folder expected to beplugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.???/tools/bin/then add path to the folder as a-cpkey value toGDB Server argsfield - Add
-t -d -p <port number> -m <core num>keys toGDB Server argsfield.- The
<core num>parameter is0for Cortex-M7 or3for Cortex-M4 kernels. Other MCU models may support other numbers. - Final arguments form is
-cp <STM32_Programmer_CLI bin folder path> -t -d -p <port number> -m <core num>
- The
- Try to build both projects. If something goes wrong, fix your
CMakeLists.txtand sources. - Click
Debugin both projects. The firmware for both kernels should be flashed and started. - Enjoy your newly-created project.