
- Clion debugging how to#
- Clion debugging install#
- Clion debugging drivers#
Connect the discovery board with your computer.
Clion debugging drivers#
Let’s see if all drivers are installed properly and we can connect to the board.
Clion debugging install#
For this we will write a simple LED blinking demo and install it on the discovery board. Since we use the STM32F4 discovery board for the first demo, you should select the corresponding config file (board/stm32f4discovery.cfg).
Board Config File: OpenOCD provides different config files for all kinds of boards. OpenOCD Home: Set the location of the OpenOCD project you have downloaded and unzipped earlier. Go to: File | Settings | Build, Execution, Deployment | OpenOCD Support. Search for the plugin ‘OpenOCD + STM32CubeMX support’ and install it. If you only see green check marks you are happy and can continue. Go to: File | Settings | Build, Execution, Deployment | Toolchains. But let’s check first if the toolchain was installed properly. During the installation process you can set up MinGW as the default toolchain. For the first try you can use the 30-days trial license. For example free licences for students and open-source projects. There are different licences available for CLion. Download the newest win32.zip version of OpenOCD and unpack it. Open On-Chip Debugger (OpenOCD) provides debugging and in-system programming for embedded devices. Use the default installation path: 'C:\MinGW'. The MinGW toolchain provides the GNU Compiler Collection (GCC) and the GNU Debugger (GDB) for windows. To test this, just open the command line window and enter ‘arm-none-eabi-gcc -version’. Now you should be able to execute the toolchain from the command line. During installation you will be asked if you want to 'add path to environment variable'. Download and install the GNU Arm Embedded Toolchain. This contains the C/C++ compiler for Arm Cortex-M processors (like the STM32s).
Download and install the STM32CubeMX (you have to register and sign in). Download and install the ST-Link Utility (you have to register and sign in). STM32CubeMX is a tool that allows a very simple configuration of the STM32 microcontrollers and the generation of the corresponding initialization C code. The ST-LINK Utility is a software provided by ST for programming their microcontrollers. This will take some time but is not too complicated. Let’s start and setup the required software.
GNU Arm Embedded Toolchain (gcc-arm-none-eabi 7-17-q4-major).Here is a list of the software and tools we will use.
Clion debugging how to#
And I will also show you how to transform this project into C++. We will create a CLion project based on an initial C-code that is generated by STM32CubeMX. For this purpose we will use a CLion plugin which is called OpenOCD + STM32CubeMX support and was written by Ilya Motornyy. Programming and Debugging of STM32 with ClionĪ short guide on how to program and debug different STM32 boards with CLion on a Windows computer (I use Windows 10).