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

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.

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:

https://github.com/espressif/esp-idf/tree/master/examples/system/ulp_adc/main

Regards,
Pascal.

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.

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 #252 ESP32 Ultra Low Power (ULP) core made easy in the Arduino IDE including 100$ challenge - YouTube). 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 GitHub - platformio/platformio-core: A professional collaborative platform for embedded development)

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

Regards,
Pascal.

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

https://github.com/espressif/esp-iot-solution/blob/master/documents/low_power_solution/esp32_ulp_co-processor_and_assembly_environment_setup_en.md#32-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 https://www.linkedin.com/company/platformio/ or https://twitter.com/PlatformIO_Org

2 Likes

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 platform-espressif32/examples/espidf-ulp-adc at develop · platformio/platform-espressif32 · GitHub

1 Like