Can't Get ULP Include Files Found

BrianP
Posts: 78
Joined: Mon Apr 13, 2020 1:48 pm

Can't Get ULP Include Files Found

Postby BrianP » Tue Mar 24, 2026 4:27 pm

Hello and thanks for the help.

I thought I would experiment with moving some of my functions over to the RISCV ULP in my custom ESP32-S3 board.

Some time ago I got the ADC example to compile. More recently I decided I would try and incorporate ULP into my project.

When I investigated further, I noticed the ULP include files, with the exception of #include <stdint.h> all have include errors (i.e. cannot open source file "ulp_riscv_utils.h"C/C++(169).

This includes #include "example_config.h", which complains
cannot open source file "hal/adc_types.h" (dependency of "example_config.h")C/C++(1696)

Nonetheless, when I open example_config.h, hal/adc_types.h does not have a squiggly line and if I right click and Go To Definition, hal/adc_types.h opens. (If I right click on ulp_riscv_utils.h nothing happens.

I have tried all sorts of things, such as changing include paths, etc., and nothing seems to work.

EDIT: I should mention this is Windows 11/VS Code. ESP-IDF v5.5.3 (I cannot for the life of me get anything to work with V6.0 but that is another matter)

Please help

Thanks

MicroController
Posts: 2661
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Can't Get ULP Include Files Found

Postby MicroController » Tue Mar 24, 2026 8:03 pm

Without knowing where you get "errors", seeing any code, and your CMakeLists.txt, how can we know where, or even if, your build takes the wrong turn?

Just a general remark: The ULP code is compiled separately from the main firmware, uses a different compiler and gets its own libraries and include paths set by the build system. When VSCode works with your 'main' project, it doesn't know about the differing configuration for the ULP code, so VSCode may not find some header files used by the ULP code, or find header files which aren't actually the ones used at build time.

And the mandatory referrals:
https://docs.espressif.com/projects/esp ... isc-v.html
https://github.com/espressif/esp-idf/tr ... /ulp_riscv

BrianP
Posts: 78
Joined: Mon Apr 13, 2020 1:48 pm

Re: Can't Get ULP Include Files Found

Postby BrianP » Tue Mar 24, 2026 11:35 pm

Microcontroller thank you for the reply.

You are correct: I guess the fact I was very frustrated and working on the actual ADC example produced by ESP IDF I figured it wasn't likely an issue with what I had done but the way the system works. The ULP related documentation is pretty sparse.

I have attached a zip of the complete project directory (except the build part to save space). I believe the only modification I made to the files was fixing the compiler path in c_cpp_properties.json.
adc.zip
(20.02 KiB) Downloaded 11 times

MicroController
Posts: 2661
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Can't Get ULP Include Files Found

Postby MicroController » Wed Mar 25, 2026 10:38 am

Hmm.
I don't think ULP code can just include main CPU components/headers ("hal"). Wonder if the ULP code as provided by Espressif in the ADC example could actually compile in the first place.

BrianP
Posts: 78
Joined: Mon Apr 13, 2020 1:48 pm

Re: Can't Get ULP Include Files Found

Postby BrianP » Wed Mar 25, 2026 12:40 pm

Well, it compiles and runs. And the only include which isn't flagged as not found is <stdint.h>

MicroController
Posts: 2661
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Can't Get ULP Include Files Found

Postby MicroController » Wed Mar 25, 2026 1:49 pm

Ok. If it compiles then my remark from above probably explains the "error". There may be some way to fudge VSCode to regard both the main and the ULP's include paths (at the same time...).

BrianP
Posts: 78
Joined: Mon Apr 13, 2020 1:48 pm

Re: Can't Get ULP Include Files Found

Postby BrianP » Wed Mar 25, 2026 1:56 pm

OK I may have discovered what is going on.

I had an (old) version of my software which included ulp and it flagged no issues. I had forgotten about this since later versions of the code had the issues.

Since the code compiled I figured it was likely vscode related so I did a comparison of all the files in the directories using Winmerge. Obviously there were many differences but I 'walked through' the changes. It turned out the ESP-IDF ADC example c_cpp_properties.json and my working one were different.

The working one had

"includePath": [
"${config:idf.currentSetup}/components/**",
"${workspaceFolder}/**"
],

but the one produced by ESP_IDF had

"includePath": [
"${workspaceFolder}/**"
],

adding
"${config:idf.currentSetup}/components/**",

caused the red squiggles to go away.

It seems the order matters! In the versions of my code which didn't work I had

"includePath": [
"${workspaceFolder}/**",
"${config:idf.currentSetup}/components/**"
],

In that file, setting it to

"includePath": [
"${config:idf.currentSetup}/components/**",
"${workspaceFolder}/**"
],

causes the red squiggles to disappear.

Who is online

Users browsing this forum: Applebot, Baidu [Spider], Google [Bot], PetalBot, Semrush [Bot] and 18 guests