Developing for ESP32 With CLion on Windows
While browsing Twitch on a slow Saturday night, I came across someone who was using CLion for embedded development for an ESP32 board. One thing that instantly caught my attention was that they used CLion merely as an editor and compiled and flashed the chip on a separate terminal. I asked why they were doing it that way, and they said that setting up a CLion project for the esp-idf development framework was a bumpy road, especially on Windows. Since I never use Windows for development and I’ve never worked with esp-idf, it was a challenge I was willing to take.
This tutorial shows how to set up a project in CLion for ESP32 development on Windows, covering all the necessary steps in great detail. Starting from downloading and installing the esp-idf development framework, we’ll take a closer look at how esp-idf uses specific environment variables and a dedicated Python environment to compile programs.
We’ll create a new CLion project from one of the esp-idf examples and adjust the project settings so that CLion knows about all of the underlying esp-idf dependencies. With the correct project settings, we will close the tutorial by demonstrating some of CLion’s code-insight features and show how to compile, flash, and monitor programs for your ESP32 board directly from within the IDE.
The most important part is to set the ESP_IDF_PATH variable correctly and adjust the PATH variable to include all entries pointing to the .espressif folder. All the necessary settings can be discovered when taking a closer look at what is done by the export.bat script of esp-idf. The second important aspect is that CMake warning messages are meant to be read because they often point directly to missing pieces. We saw that in the video when we needed to set the ESPPORT variable to monitor the ESP32 on the correct port.
Subscribe to Blog updates
Thanks, we've got you!
Striving For Better C++ Code, Part II: Function Summaries to Speed Up the Data Flow Analysis
This is the second blog post in the series dedicated to Data Flow Analysis (DFA) and its implementation in CLion. Read the first part here: Striving For Better C++ Code, Part I: Data Flow Analysis Basics Striving For Better C++ Code, Part II: Function Summaries to Speed Up the Data Flow Analysi…
Striving For Better C++ Code, Part I: Data Flow Analysis Basics
CLion comes with a built-in data flow analyzer, which runs constantly when you are writing your code and helps improve your code’s quality. It can reveal various code problems that might later lead to runtime issues, security breaches, and other vulnerabilities. Examples of these useful checks are c…
IDE Features Trainer and Other Improvements in CLion 2023.3 EAP4
Brush up your knowledge of essential IDE functionality easily by using the brand-new IDE Features Trainer.