This page provides an overview of how to use CLion as your embedded development IDE. For detailed feature descriptions and setup instructions, please refer to the dedicated articles in this section.
Hardware TypeCLion supports embedded development for any hardware compatible with the GCC or IAR toolchain. Some examples include: ARM-based microcontrollers, such as the STM32 series, Xtensa (ESP8266, ESP32), mips32 (pic32), AVR8 (Arduino), and RISC-V.
For STM32 microcontrollers and boards, CLion integrates with STM32CubeMX. You can create and open .ioc projects and automatically convert them to CMake. Please note that some STM32 chips are currently not supported.
👇Click to receive👇
👉C Language Knowledge Resource Collection
Toolchain and Compiler
-
For ARM Cortex-M and Cortex-R microcontrollers, use the GNU ARM toolchain.
Install the toolchain, ensure it appears in your system PATH, and configure it in Settings | Build, Execution, Deployment | Toolchains.
-
For STM32 microcontrollers, the STM32CubeMX project setup includes installation steps for the GNU ARM toolchain, and CubeMX will generate the linker scripts and hardware support libraries for you.
-
For non-STM32 ARM microcontrollers, you will need to provide the required libraries and linker scripts (which you can obtain from your vendor or manually create using the vendor’s standard examples).
-
Non-ARM chips compatible with GCC are also supported. The toolchain setup will be similar to that of ARM (see above).
You can use the compiler from IAR Systems. CLion’s support for the IAR toolchain is available on Windows with MinGW and on Linux. Please note that CLion does not provide IAR licenses.
As an alternative covering the entire embedded environment, consider using the PlatformIO ecosystem supported in CLion through the PlatformIO plugin. This plugin provides a wizard for creating CMake-based PlatformIO projects, special debugging and upload configurations, and allows you to run PlatformIO operations from the IDE.
Build System
CLion is fully integrated with CMake and bundles the latest version of CMake, so CMake can be considered your primary build system for embedded projects.
However, all the features CLion provides for embedded development (except for STM32CubeMX and PlatformIO support) are also available for Makefiles and any arbitrary build system configured through custom build targets.
If you decide to convert your project to CMake, we recommend using our template CMakeLists.txt and adjusting it as needed: fill in the TODO sections and modify library paths (if necessary).
Flashing and Debugging
CLion supports debugging on the chip via OpenOCD or GDB Server.
GDB Server is the more general option. It covers various vendor-specific scenarios, such as ST-Link/V2, Segger J-Link, QEMU, standalone OpenOCD GDB servers, PE-Micro, etc.
In CLion, there are special run/debug configurations for both options: OpenOCD Download & Run and Embedded GDB Server, respectively. For STM32CubeMX projects, the OpenOCD configuration is created automatically.
These configurations allow switching client debuggers. You can choose to use the GDB from the toolchain or the GDB bundled with CLion (for ARM devices) in the configuration settings.
When you start a debugging session, CLion connects the debugger to the MCU and uploads your binary. After that, your firmware can be debugged using the full set of CLion debugging features, which include memory and disassembly views, peripheral views for ARM devices, and chip reset operations.
PlatformIO projects can be debugged using the PIO unified debugger, with all debugging features available.
For platforms that do not support GDB, debugging is not supported. In this case, specific utilities (such as Avrdude for AVR) should be used to flash the target chip.
Popular Recommendations
-
A screenshot to show you what the front-end looks like now…
-
How does one go from a regular position at Alibaba to outsourcing, what level is that?
-
Resignation reveals character…