ESP-IDF CLion Plugin for ESP-IDF CMake based projects (4.x and above).
The source for the initial start of the plugin was taken from this project.
To install the plugin, download the release zip file from the releases section. Unzip the file, but do not unzip the internal zip file. The product files are located in the root of the unzipped folder.
Start the CLion.
It is recommended to first configure the CLion using some example project
Click on Plugins from the side window
Next click on the settings wheel on the top and select Install Plugins from Disk...
From the popup window select the zip you extracted and click Ok
After the installation you will be show the plugin installed, but you will have to restart the IDE. So click on the Restart IDE button
At this stage you have installed the plugin but since the plugin is in the beta versions, there are some configurations that are required to be done manually for IDF.
+
Add and select system from the dropdown.espressif
directory in the user home folder.
You can find the tools for the board you are working from there for this example we are using esp32 and the image below shows the paths for those tools.
Next once the paths are configured Click Next
.Ctrl+Alt+S
to open the settings or you can go to settings from the File Menu. Open the settings for Python Interpreter. ...
and select python.exe
from the .espressif/python_env/VERSION_OF_IDF_YOU_INSTALLED_PYTHON_VERSION_ON_YOUR_SYSTEM/Scripts
directory in user home and click OkFile > New > Project
Create
main
in the project root and add a file main.c/main.cpp
there. Also create a CMakeList.txt
in this directory
set(SOURCES "main.c")
idf_component_register(SRCS ${SOURCES} INCLUDE_DIRS "")
* Now add another CMakeList.txt in the project root
```cmake
cmake_minimum_required(VERSION 3.24)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(CMAKE_C_COMPILER C:/Users/your_user/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe)
set(CMAKE_ASM_COMPILER C:/Users/your_user/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe)
project(esp_idf_demo)
include_directories("src")
esp-idf
home directory. Then, run the appropriate export script:
export.ps1
export.sh
idf.py
commands.idf.py set-target esp32
idf.py
commands. If the configurations are correct, you will also see the launch configurations in the dropdown menu. These launch configurations can be used to build, flash, and debug your project. For more information, see Building Flashing and Serial Monitor section.To build the project you can select app from the launch configuration and click build.
To flash the application you can select flash option from launch configuration and click Run
button.
To make sure that you are flashing on the correct port you can modify the env variables in flash configuration.
To do that click on the arrow next to flash configuration from dropdown and click Edit.
From the next screen you can add an environment variable as shown below for the port.
The serial monitor for this version is still a work in progress. You cannot run it from the monitor option in
launch configurations at the moment. Although you can try to use the terminal in the CLion
to run idf.py monitor command
but make sure that your CLion is configured to use the default build
directory since
the default build directory in the CLion is different.
ESP Debug Configuration
is the newly added feature to support debugging using the OpenOCD.
Please follow the below steps to configure.
Run
menu, click on Edit Configurations
and click on +
from the opened window and select ESP Debug Configuration
.
Executable
and Target
from the dropdown. Also Select Board
according to your board.
Once you have selected the board and configured other settings, click OK.Debug
button or press Shift+F9
(the default shortcut for debugging on Windows). Make sure that the debug configuration you created is selected in the plugin. When your breakpoint is hit, you will see the debug view with all the available features in CLion. You can view threads, stacktraces, and access the GDB console.