# Embedded development

This page gives an overview of how you can use CLion as your [embedded development IDE](https://www.jetbrains.com/clion/embedded/). For detailed feature descriptions and setup instructions, refer to the dedicated articles in this section.

## Hardware types

CLion supports embedded development for any hardware compatible with GCC or IAR toolchains.

A few examples: ARM-based MCUs like [STM32 series](https://www.st.com/en/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus.html), Xtensa ([ESP8266](https://www.espressif.com/en/products/socs/esp8266), [ESP32](https://www.espressif.com/en/products/socs/esp32)), [mips32](https://www.mips.com/products/architectures/mips32-2/) (pic32), AVR8 ([Arduino](https://www.arduino.cc/en/Main/Products)), [RISC-V](https://riscv.org/).

For the case of STM32 MCUs and boards, [CLion integrates with STM32CubeMX](embedded-stm32.html). 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](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm). Install the toolchain, make sure it’s presented in your system `PATH`, and set the tools up in `Settings | Build, Execution, Deployment | Toolchain`. * For STM32 MCUs, [STM32CubeMX project](embedded-stm32.html) 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).

You can use the compilers from [IAR Systems](https://www.iar.com/iar-embedded-workbench/). CLion's support for the [IAR toolchain](iar-toolchain.html) is available on Windows with MinGW and Linux. Note that CLion does not provide IAR licenses.

As an alternative which covers the whole embedded environment, consider the PlatformIO ecosystem supported in CLion via the [PlatformIO plugin](https://www.jetbrains.com/help/clion/platformio.html). 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.

## Build systems

### CMake

CLion fully integrates with [CMake](quick-cmake-tutorial.html) 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](makefiles-support.html), as well as any arbitrary build system configured via [custom build targets](custom-build-targets.html).

If you decide to convert your project into CMake, we recommend that you take our [template CMakeLists.txt](https://gist.github.com/elmot/3b4f0e9f8b23864fdf8bb509c329d051) and adjust it for your needs: fill in the `TODO` sections and modify the library paths if required.

### Zephyr West

CLion also supports Zephyr RTOS-based projects. You can [open, build, and run/debug these projects](zephyr.html) with a built-in West plugin. Compared to CLion’s CMake integration, the West integration provides a more native and easier way to work with Zephyr.

If you have an existing Zephyr project that you run as a CMake one, you can [convert it to a West project](zephyr.html#convert-cmake-to-west). You can also convert a West project back to CMake.

## Flashing and debugging

CLion supports [debugging](debugging-code.html) on-chip with [OpenOCD](openocd-support.html) or [GDB Server](embedded-gdb-server.html).

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 &amp; Run](openocd-support.html#opecocd-debug) and [Embedded GDB Server](embedded-gdb-server.html#gdbserver-config), 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](memory-view.html) and [disassembly](disassembly-view.html) view, [peripheral view for ARM devices](peripheral-view.html), and a chip reset action.

[PlatformIO projects](platformio.html) 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](https://www.nongnu.org/avrdude/) for AVR).

## Learn more

Check out the [Embedded Development in CLion FAQs](https://intellij-support.jetbrains.com/hc/en-us/articles/4405160320274-Embedded-Development-in-CLion).

In addition to the web help articles and FAQs, you may want to take a look at these posts on embedded development from the CLion blog:

* [CLion for embedded development part I](https://blog.jetbrains.com/clion/2016/06/clion-for-embedded-development/), [part II](https://blog.jetbrains.com/clion/2017/12/clion-for-embedded-development-part-ii/), [part III](https://blog.jetbrains.com/clion/2019/02/clion-2019-1-eap-clion-for-embedded-development-part-iii/)

* [Arduino Development with CLion part I](https://blog.jetbrains.com/clion/2020/08/arduino-from-hobby-to-prof-p1/), [part II](https://blog.jetbrains.com/clion/2020/12/arduino-dev-with-clion-part-ii/)

* [Using nRF52 with CLion](https://blog.jetbrains.com/clion/2020/01/using-nrf52-with-clion/) and [Tutorial: Using nRF52 With nRF Connect SDK, CMake, and CLion](https://blog.jetbrains.com/clion/2021/04/using-nrf52-with-cmake-connect-sdk/)

* [Webinar Recording: CLion Ask Me Anything Session](https://blog.jetbrains.com/clion/2020/05/webinar-recording-clion-ama/), the Embedded Development part.

