If you need to make changes in the CMake script (for example, to add external libraries or FPU support), do so in CMakeLists_template.txt and then call Update CMake project with STM32CubeMX.
If you add source or header files, place them in the Src and Inc directories.ĬLion regenerates CMakeLists.txt from the template every time the project is updated.
ATOLLIC TRUESTUDIO DEBUG CONFIGURATION CODE
Also, consider extracting pieces of code into separate. This will protect your code from being overwritten by CubeMX during code regeneration. While editing the files generated by CubeMX, always enclose your code in the /* USER CODE BEGIN. ioc file in Project View and select Update CMake project with STM32CubeMX. You can also update the project manually: right-click the. When you change the MCU configuration in CubeMX and click Generate Code, your CLion project gets updated automatically: You will be able to open and adjust it in the editor. You will also be able to select the board config file, including a custom one, later in the OpenOCD Run/Debug configuration settings.Ĭlick Copy to Project & Use, and the selected board config file will be added to your project tree. The list of suggestions consists of board config files shipped with OpenOCD in Openocd-Installation/share/openocd/scripts/board: Skip this step (click Cancel) if you don't plan to use OpenOCD.īack in CLion, when the CMake project loading completes, you will be prompted to select a board config file. Provide the name manually in Project Manager, and then accept the suggestion to overwrite the project.Īfter the hardware configuration is ready, check that the Toolchain / IDE field is set to STM32CubeIDE and select Generate Under Root, then click Generate Code: Click STM32F030F4Px to invoke the MCU/Board Selector and change the default MCU:ĬubeMX resets the project name when you change the MCU. In CubeMX, the configuration is already set for the newly created project. Click the Open with STM32CubeMX link to open CubeMX from CLion. Now you need to switch to CubeMX to generate the project sources and fill the. In CLion, this file is read-only, and on the current step, it is a place-holder for the configuration that will be set up in CubeMX on the next step. ioc files are CubeMX original project files that contain static initialization settings. ioc file for the default STM32F030F4 MCU: Go to File | New Project and select STM32CubeMX as your project type. ioc file in CLion, or b ) create a project from scratch as described below. ioc file name does not contain spaces, non-latin symbols, or other special characters.įor new projects, you have two options: a) configure your MCU and generate the code in CubeMX, then open the. CLion will automatically generate a CMake project structure.Ĭheck that the. If you already have a project that contains an. Only the MinGW and MinGW-w64 environments are supported ( CPP-15034). If you don't plan to use OpenOCD, leave the OpenOCD Location field empty.įor GNU ARM Toolchain, use version 2019-q3 (and later) or 2018-q2 (and earlier). In Settings/Preferences | Build, Execution, Deployment | Embedded Development, you can check whether the location of CubeMX was detected correctly, and set the path manually if needed.
On Linux and macOS, make sure to have the toolchain path in ~/.profile (not in a shell-specific config like ~/.bash_profile or ~/.zprofile). You can check it by running arm-none-eabi-gcc from the command line - your system should recognize this command. GNU ARM toolchain is a cross-platform set of tools which launches on desktop, while the build result can only run under the target ARM MCU environment.įor CLion to detect the toolchain, it should be presented in system PATH. It generates a stub project which CLion then converts into a CMake project. In CubeMX, you can set up both CPU and peripherals, and adjust frequencies and pin modes. CubeMX is a graphical tool that helps configure STM32 microcontrollers and generate the corresponding C code.