PlatformIO Community

Ulp_main.h is not found in ESP-IDF when I compile


I’m trying to add the ULP functionality to my project in order to read the Hall Sensor integrated in the ESP32 but VS is not able to find the ulp_main.h library needed.

By looking in to the web, I found recommendations about how to add ULP toolchain but I don’t know if Platformio does it already in some way when adding the ESP32 library.

I need some guidance on this. Thanks in advance.


Can you upload your current to a github repo and reference the working Arduion IDE version of the project?

I copy pasted the ulp_adc_example_main.c and adc.s files into a new project using ESP-IDF framework from this repo:


Hello @maxgerhardt,

Have you had time to take a look on this?

I did some experiments, like removing the ulp_main.h and see what happens but what I get now is that VisualStudio can’t recognize assembly code… so seems like I really need to install the ULP toolchain somehow. I’m block on this, hope someone have time to take a look.

BTW, I’m not using Arduino, I’m using espidf framework.


I’m very sure the ESP-IDF has special build-scripts which invoke the assembler for the ULP and does other magic to the symbols to make the compilation work. The same for the Arduino IDE in which this is now also possible (refer to I’ll take a quick look at what I see, but if it’s missing python core code to compile these sort of projects, then we need that extension in the PlatformIO core itself (aka open an issue in

Yeah pretty much what I thought.

Under the Hood:

All the magic happens in the python script called This along with espressif’s in which both are located in the ulp directory from this repository.

Also this issue already exists in the espressif32 platform: ULP Support ? · Issue #95 · platformio/platform-espressif32 · GitHub

Done, took a look into the video which is not very useful as is for Arduino in Arduino IDE. About the files needed to program the esp32 ulp, well is a tutorial for MAC and again for Arduino IDE… not useful for the reason of this purpose. I’m using Windows.

Also, took a look into the issue in espressif32 and the last comment basically says it all:

I have never used platformIO so I’m really not sure whats going on for you. The .s files are unique to how I differentiate between the ulp and xtensa assembly files for Arduino. Xtensa assembly is not the same as ulp assembly so I you need the binutils compiler files but again I have no idea how platformIO compiles it’s files so you will have to drill down on that first, maybe they have a verbose mode you can glean on how they compile and build your programs and go from there.

If you have a working example using PlatformIO using ESPIDF framework, then that will be useful.


Found the next steps to add the ULP Toolchain for Windows:

How could I adjust it to make it to work in C:.platformio\packages\framework-espidf?

Bottom line:

This will take some amount of code to get it to work.

Ok! Thanks for the information. Is there any expectation that PlatformIO will add this support?

@ivankravets will sure prioritize feature implementations according to their community votes / importances, so the best thing we can do is upvote the issue or start writing code ourselves for a pull request :slight_smile:

Ok! I will make sure it gets the appreciation needed from other engineers from our team who are also blocked in SPI and power management regarding this issue. @ivankravets will really appreciate to consider it in your priorities soon as it has been almost a year that the issue was opened in github :slight_smile:

I asked @valeros to take a look at this feature. Please stay tuned with us on or


Thanks @ivankravets! Sorry if I bother you on this but do you have an ETA of when will this be implemented? @valeros

Hello @ivankravets and @valeros, I would like to know if you have an estimated time for this functionality?

Implementing this feature might seem easy at first sight, but in fact, porting all that peculiar compilation logic to PlatformIO build system is going to be a challenging task. So, unfortunately, there is no ETA for this feature. Anyway, it’s in our todo list. so it’ll be added eventually.

Thanks for answering @valeros. Any expected release date will be helpful, maybe by the end of any quarter of this year?

Solved in latest release see Espressif 32 dev/platform v1.9.0: ULP programming, ESP-IDF 3.2.2 and

1 Like