Q: How to use PlatformIO IDE with preinstalled ESP-IDF


Yesterday I installed PlatformIO IDE on Ubuntu 20.04 for the first time because, as a long-time user of ESP-IDF, I want to debug the code in a modern way instead of just working with ESP_LOGI.
I am currently using ESP-IDF 4.4 (dev version) because I want to run the code on the ESP32-S2 later.
If you select a board with ESP32, an ESP-IDF that is bent and somewhat out of date is downloaded into the directory "$ {HOME} /. pio. From then on, the chaos begins: PlatformIO calls tools (gcc etc.) from the ESP-IDF 4.4, but the components from the “.pio”. This leads to an error, because the linker cannot find “app_main”. Of course I could disable my ESP-IDF environment, but… “Never touch a running system”!

Is there a way to teach the PlatformIO to only use the pre-installed ESP-IDF?

Thanks in advance,

This should never happen. How did you determine it is calling the system-wide toolchain and not the one in ~/.platformio/packages/toolchain-xtensa32?

Have you tried this exact project?

Hello Max,

I didn’t disable my ESP-IDF enviroment (IDF_PATH=…, IDF_TOOLS_PATH=…).
PlatformIO IDE displays the used tools ("/opt/ESP32/v4.4/…" instead of “.platformio/…”) in the output window during building the project and I can read it… :slight_smile:
But it compiles libraries/components from “.platformio/…” :frowning:
And they do not match…

BTW: Do you speak/understand German? My English isn’t well… I sometimes use “Google Translate” with corresponding results…

Kind Regards,

In theory that should not be a problem because during build-time, PlatormIO replaces these environment variables with its own

IDF_PATH directly and the toolchain path through the PATH environment variable.

Does the behavior change when you unset IDF_TOOLS_PATH?

Yes I’m German but I don’t see a problem with the English posts, they’re all perfectly readable. With English, also more people can participate.

Hello Max,

If my English is not THE problem to you…

I don’t like to disable my existing environment for ESP-IDF because I unfortunately need the version 4.4!
That’s why I asked the question whether the existing version could be used or not, and if so, how to do it?
I’ve already encountered my old problems with the previous versions (which PlatformIO IDE installs again), which is why I had to switch from version 4.2.1 to 4.4, and some incompatibilities in my code with older esp-idf versions.

I’m sorry to say, as a computer scientist I’m a little ashamed to say it: I can read python, but I don’t have neither the time nor the inclination to learn this language.
It is not necessary to follow every fad, to learn every new programming language just because the rest of the world does it. You can achieve the same goal with languages like C, which already exist for almost 50 years. Many other programming languages were quickly born and disappeared even more quickly.

Kind Regards,

I meant this only as a quick test, not as a permanent solution. If you are using pio from the commandline, executing unset IDF_TOOLS_PATH and then pio run should suffice as a test.

If that is the cause, it can be fixed in the python code by means of doing a del idf_env["IDF_TOOLS_PATH"] in the populate_idf_env_vars function, but that’s for the PlatformIO devs to implement.

Hello Max,
Hello others,

Please forgive me, but I no longer want to play the tester for developers who actually develop tools for the “other developers” that should make the work of these “other developers” easier! Not anymore!
I’ve been doing this to a greater extent in the last few weeks (you can say in the last few months!). The result is: I have invested a lot of time, work and nerves in NOTHING. The Eclipse plug-in for ESP-IDF works only in some heads, the VS Code extension for ESP-IDF works a little bit better, but I/you still can’t debug with it. The people at Espressif say: it has to work this way. But meanwhile I don’t know who or what should work/run, from where and to where it should run, etc. The only thing I realize is that these things are neither practical nor usable! If only no one would have come up with the stupid idea of ​​using “modern” development tools. “Modern” is not equal with good …

Please test it out yourself and fix the error if it actually exists.

And that still doesn’t answer my question yet: Can I use PlatformIO IDE with the pre-installed ESP-IDF?

Kind Regards,

Hi Max,

I’m sorry, but yesterday I was really annoyed because nothing works and I wasted a lot of time.

I “deactivated” the preinstalled ESP-IDF, deleted all files and directories that belong to VS Code in the ${HOME} directory including the extension of Espressif, and installed “PlatformIO IDE” again. Both extensions of VS Code “PlatformIO IDE” and “Espressif IDF” bite each other. There is no doubt about that!
Now PlatformIO seems to work cleaner. I can’t test the debugging yet.

Unfortunately, I have to clean up some (for now a few) bugs in old versions of ESP-IDF in the “.platformio/packages/framework-espidf/components” directory. Without these patches it wont work!

Kind Regards,

Hi Max,

“Upload” can’t connect to the device!

The file “99-platformio-udev.rules” already installed yesterday!


New baudrate entry in “platformio.ini”: “upload_speed=115200”

It does not work yet…

Pressing “Upload” requires internet access! Why? Fortunately, I don’t need this crappy internet to make a coffee yet.

Now it uses “/dev/ttyUSB0” instead of “/dev/ttyUSB1” as before!

New upload port entry in “platformio.ini”: “upload_port=/dev/ttyUSB1”

It works now!!! Wow…

The same procedure as evey year, James… But this time with the “Monitor/Terminal”.

Pressing “Monitor” opens the terminal! Only two unknown characters appear in the “Terminal”!


New baudrate entry in “platformio.ini”: “monitor_speed=115200”
Just in case, I should also enter the port…

Quickly enter the same parameters for debugging to shorten the way.

What is the next trap?

The debugging works!
The first positive experience in weeks!
That seems suspicious!

Is it possible to reduce the very extensive and superfluous output in the “Debug Console” to the essentials? The important information is completely lost in this amount!

My old fashion test output with ESP_LOGI does not appear anywhere! Does building the target supress ESP_LOGI and ESP_LOGE output?

Some board configuration values are wrong: flash size, PSRAM.

But honestly, I am a little happy with what I have achieved with PlatformIO IDE…

Kind Regards,