This page gives an overview of how you can use CLion as your embedded development IDE. For detailed feature descriptions and setup instructions, refer to the dedicated articles in this section.
CLion supports embedded development for any hardware compatible with GCC or IAR toolchains.
For the case of STM32 MCUs and boards, CLion integrates with STM32CubeMX. You can create and open .ioc projects, and get them automatically converted into CMake. Note that some STM32 chips are currently unsupported.
Toolchains and compilers
For ARM Cortex-M and Cortex-R MCUs, use the GNU ARM toolchain.
Install the toolchain, make sure it’s presented in your system
PATH, and set the tools up in .
For STM32 MCUs, STM32CubeMX project setup includes the step of GNU ARM toolchain installation, and CubeMX will generate a linker script and hardware-support libraries for you.
For non-STM32 ARM MCUs, you will need to provide the required libraries and the linker script (which you can obtain from your vendor or create manually using the vendor’s standard examples).
Non-ARM chips compatible with GCC are also supported. The toolchain setup will be similar to the case of ARM (see above).
As an alternative which would cover the whole embedded environment, consider the PlatformIO ecosystem supported in CLion via the PlatformIO plugin. The plugin provides a wizard for creating CMake-based PlatformIO projects, special configurations for debug and upload, and allows running PlatformIO actions from the IDE.
CLion fully integrates with CMake and bundles one of the latest CMake versions, so CMake can be considered as the primary build system for your embedded projects.
However, all the functionality that CLion provides for embedded development (except for STM32CubeMX and PlatformIO support) is also available in the case of Makefiles, as well as any arbitrary build system configured via custom build targets.
If you decide to convert your project into CMake, we recommend that you take our template CMakeLists.txt and adjust it for your needs: fill in the
TODO sections and modify the library paths if required.
Flashing and debugging
GDB Server is a more generic option. It covers various vendor-specific cases like ST-Link/V2, Segger J-Link, QEMU, standalone OpenOCD GDB server, PE-Micro, and others.
In CLion, there are special run/debug configurations for both options: OpenOCD Download & Run and Embedded GDB Server, respectively. For STM32CubeMX projects, OpenOCD configurations are created automatically.
These configurations allow switching the client debugger. You can choose between your toolchain’s GDB or CLion’s bundled GDB (for ARM devices) right in the configuration settings.
When you start a debug session, CLion connects the debugger to the MCU and uploads your binary. After that, your firmware running on-chip can be debugged using the entire set of CLion debug features, which includes memory and disassembly view, peripheral view for ARM devices, and a chip reset action.
PlatformIO projects can be debugged using the PIO Unified Debugger, with all the debug features available as well.
Debugging is not supported for the platforms that lack GDB support. Flashing the target chip in this case should be done using a specific utility (like Avrdude for AVR).
Check out the Embedded Development in CLion FAQs.
In addition to the web help articles and FAQs, you may want to take a look at these posts on embedded development from CLion blog: