Learn how to configure CLion for various hardware types and toolchains, and how to debug on chip.
If it’s possible to debug on the microcontroller of your choice with a GDB Server, you can do it from CLion using a special Embedded GDB Server Run/Debug configuration. It covers OpenOCD, ST-Link GDB Servers, Segger J-Link GDB Server, QEMU, and many other specific GDB Servers.
A wizard helps with creating Embedded GDB Server run configurations with the predefined GDB server arguments corresponding to the GDB server type selected in the wizard settings.
Debugging with the Open On-Chip Debugger is supported by CLion. Use the new Run/Debug configuration template, ‘OpenOCD Download and Run’ to debug on your microcontroller.
If you work with a STM32CubeMX project in CLion, an OpenOCD Run/Debug configuration will be created for you automatically.
Learn more about STM32CubeMX & OpenOCD integration
If you debug applications with RTOS in CLion, a view with the task lists is available. You can switch to the task you are interested in to explore task variables and more. FreeRTOS and Zephyr are supported.
When debugging on-chip, it’s crucial to have the ability to view the peripherals. In CLion, this view is available for two types of Run/Debug configurations: Embedded GDB Server and OpenOCD Download & Run. In both cases, a Peripherals tab appears in the debug tool window when you start debugging. Load the appropriate .svd file for your board and select the active peripherals you need to see.
PlatformIO is a new generation ecosystem that is gaining popularity quickly. To benefit from it in your embedded projects, take advantage of a PlatformIO for CLion plugin, which:
And much more! Check the official documentation for details.
If you use the IAR compiler/toolchain in your embedded projects, you can do so in CLion. Projects using the IAR toolchain load successfully and work in CLion.
A few things to note here:
Suppose you are using a custom compiler or a compiler not yet known to CLion natively, which is often the case in embedded development. There is a way to describe all the necessary information about the compiler to CLion and work with it as if it were natively supported.
Use Settings | Build, Execution, Deployment | Toolchains | Custom Defined Compiler to enable it and provide the *.yaml file that contains your custom compiler definition. Check out the sample configs prepared by the CLion team for you.
CLion comes with partial support for MISRA C 2012 and MISRA C++ 2008, guidelines used widely in embedded development and especially in the automotive industry. This support speeds up the development of such projects by revealing incompatibilities earlier in the development cycle. The list of currently supported checks is available on CLion’s Confluence page .
If you develop for STMicroelectronics boards, you’ll be happy to know that CLion integrates with STM32CubeMX: