CLion 2024.3 Help

PlatformIO

PlatformIO is an open-source ecosystem for embedded development. It allows working with various MCUs (such as ARM Cortex, AVR, MSP430), development boards, frameworks, and environments (Arduino, ESP-IDF, and many others).

CLion's integration with PlatformIO is provided by the PlatformIO for CLion plugin, created in collaboration with the PlatformIO team.

Installation

Install PlatformIO

Install the PlatformIO plugin

  1. Go to Settings | Plugins and switch to Marketplace.

  2. Search for PlatformIO for CLion and click Install.

    PlatformIO plugin install
  3. After the installation is finished, click Restart IDE.

Create/open a PlatformIO project

Create a new project

  1. Call File | New Project from the main menu and select PlatformIO in the left-hand pane.

  2. Set the project name, choose a board or framework, and click Create.

    Platformio project wizard
  3. CLion will generate a PlatformIO project:

    New PlatformIO project generation

    For Arduino-based boards, CLion generates main.cpp instead of main.c and fills it with Arduino-specific stub code:

    Arduino-specific source stub

Open a project

  1. Click Open on the Welcome screen or select File | Open from the main menu.

  2. Navigate to the project folder and select the platformio.ini file.

  3. Click Open as Project.

PlatformIO actions

Several PlatformIO commands are available as IDE actions. In the main menu, go to Tools | PlatformIO or right-click platformio.ini in the Project tree and select the PlatformIO node:

PlatformIO actions
  • Reload PlatformIO Project - calls pio project init. Use this action to update your project following the changes in platformio.ini.

  • Static Code Analysis - calls pio check for static code analysis.

  • PlatformIO Serial Monitor - calls pio device monitor.

  • Update Platforms, Toolchains, etc - calls pio pkg update.

  • PlatformIO Home - calls pio home and opens PlatformIO Home in your browser.

PlatformIO tool window

PlatformIO tool window gives quick access to the most used commands and project actions.

PlatformIO tool window

Hover over an action to see the corresponding command:

Tooltips for commands in PlatformIO tool window

At the bottom, you can find the COM port switcher. Use it to configure the COM port number for upload if you don’t want to rely on automatic port detection.

Debug features

The Debug action starts a debug session with PIO Unified Debugger by calling pio debug.

All the CLion debug features are available, including peripheral registers view, memory view, and disassembly.

If there is an .svd file for the given platform, CLion will load it automatically. You can also specify it manually:

Specify the .svd file

Coding assistance in platformio.ini

The Ini plugin, which comes in pair with the PlatformIO plugin, provides syntax highlighting, code formatting, and structure view for .ini files.

To open the structure view for platformio.ini, open it in the editor and then select View | Tool Windows | Structure from the main menu or press Ctrl+F12.

You can navigate to a property via Go to Symbol (Ctrl+Alt+Shift+N or Navigate | Symbol in the main menu).

Coding assistance for ini files

Also, the Ini plugin provides inspections for detecting duplicate properties and sections. You can change the severity of these inspections and turn them on/off in Settings | Editor | Inspections | Ini files.

Last modified: 30 August 2024