PlatformIO Community

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


#1

Hello,

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.

Regards,
Pascal.


#2

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


#3

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

Regards,
Pascal.


#4

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.

Regards,
Pascal.


#5

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 https://www.youtube.com/watch?v=-QIcUTBB7Ww). 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 https://github.com/platformio/platformio-core/)


#6

Yeah pretty much what I thought.

Under the Hood:

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

Also this issue already exists in the espressif32 platform: https://github.com/platformio/platform-espressif32/issues/95


#7

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.

Regards,
Pascal.


#8

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?


#9

Bottom line:

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


#10

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


#11

@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:


#12

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:


#13

I asked @valeros to take a look at this feature. Please stay tuned with us on https://www.linkedin.com/company/platformio/ or https://twitter.com/PlatformIO_Org


#14

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