Author Topic: ESP32-IDF/vscode help needed...  (Read 3255 times)

0 Members and 2 Guests are viewing this topic.

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 14805
  • Country: gb
    • Mike's Electric Stuff
ESP32-IDF/vscode help needed...
« on: June 15, 2026, 07:10:30 pm »
I've just started looking at the ESP32-P4, using a Waveshare LCD devboard
I'm using Win11, and have installed VSCode and ESP-IDF, and I got the "blink" example compiled and running on the board- so far, so good.
 
I'm now trying to get the Waveshare examples running, and having all sorts of issues, I suspect at least partially version related.
I have zero experience of ESP-IDF or VSCode, so no clue where to start...

These are the examples I'm trying to use : https://github.com/waveshareteam/ESP32-P4-WIFI6-Touch-LCD-XC/tree/main/examples/esp-idf
A few of these will load, compile and run OK, but not the one I need...

07_Colourbar - attempting to select ESP32-P4 fails  :
Quote
Failed to set target esp32p4: non zero exit code 2

CMake Deprecation Warning at CMakeLists.txt:3 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Build directory 'C:\ASM\esp\esp-idf\07_Displaycolorbar\build' not found. Nothing to clean.
Executing action: set-target
Set Target to: esp32p4, new sdkconfig will be created.
Running cmake in directory C:\ASM\esp\esp-idf\07_Displaycolorbar\build
Executing "cmake -G Ninja -B C:\ASM\esp\esp-idf\07_Displaycolorbar\build -DPYTHON_DEPS_CHECKED=1 -DPYTHON=C:\Espressif\tools\python\v6.0.1\venv\Scripts\python.exe -DESP_PLATFORM=1 -DIDF_TARGET=esp32p4 -DCCACHE_ENABLE=False C:\ASM\esp\esp-idf\07_Displaycolorbar"...
-- Found Git: C:/Espressif/tools/git/bin/git.exe (found version "2.54.0.windows.1")
-- Component directory C:/esp/v6.0.1/esp-idf/components/mqtt does not contain a CMakeLists.txt file. No component will be added
CMake Error at C:/esp/v6.0.1/esp-idf/tools/cmake/project.cmake:493 (message):
  Directory specified in EXTRA_COMPONENT_DIRS doesn't exist:
  C:/esp/v6.0.1/esp-idf/tools/unit-test-app/components
Call Stack (most recent call first):
  C:/esp/v6.0.1/esp-idf/tools/cmake/project.cmake:607 (__project_init)
  CMakeLists.txt:6 (project)


-- Configuring incomplete, errors occurred!
cmake failed with exit code 1, output of the command is in the C:\ASM\esp\esp-idf\07_Displaycolorbar\build\log\idf_py_stderr_output_10524 and C:\ASM\esp\esp-idf\07_Displaycolorbar\build\log\idf_py_stdout_output_10524
..
The CMakeLists.txt file looks like this :
Code: [Select]
# The following lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/unit-test-app/components")
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(test_esp_lcd_jd9365)

As far as I can see, the minimum version requested in  CMakelists.txt is 3.50 and the installed version is 4.0.3, so it shouldn't be complaining.
I can't see any other CMakelists.txt files in the project that may be causing this - I wonder if there is maybe one buried somewhere, unfortunately the error message doesn't include a full path. 

If anyone more knowledgeable who has the current version of ESP-IDF installed (plugin V2.1.0, IDF 6.0.1) could try opening this project ( copy attached) and selecting esp32-p4  & figure out what's wrong I'd be most appreciative.....


 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline Dazed_N_Confused

  • Contributor
  • Posts: 19
  • Country: us
Re: ESP32-IDF/vscode help needed...
« Reply #1 on: June 15, 2026, 08:54:03 pm »
Comment out this line: set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/unit-test-app/components")
 

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 14805
  • Country: gb
    • Mike's Electric Stuff
Re: ESP32-IDF/vscode help needed...
« Reply #2 on: June 16, 2026, 02:26:10 pm »
I noticed this message on initially opening the folder, which may be connected - didn't see it opening another demo ( sdmmc) which runs OK
Quote
[extension] CMake not found during configure-on-open. Waiting for ESP-IDF to finish setup..


Commented out the line as above, still get the same error.
Contents of log files :
Quote
Command: cmake -G Ninja -B C:\ASM\esp\esp-idf\07_Displaycolorbar\build -DPYTHON_DEPS_CHECKED=1 -DPYTHON=C:\Espressif\tools\python\v6.0.1\venv\Scripts\python.exe -DESP_PLATFORM=1 -DIDF_TARGET=esp32p4 -DCCACHE_ENABLE=False C:\ASM\esp\esp-idf\07_Displaycolorbar
CMake Deprecation Warning at CMakeLists.txt:3 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.

CMake Error at C:/esp/v6.0.1/esp-idf/tools/cmake/project.cmake:493 (message):
  Directory specified in EXTRA_COMPONENT_DIRS doesn't exist:
  C:/esp/v6.0.1/esp-idf/tools/unit-test-app/components
Call Stack (most recent call first):
  C:/esp/v6.0.1/esp-idf/tools/cmake/project.cmake:607 (__project_init)
  CMakeLists.txt:6 (project)
Quote
Command: cmake -G Ninja -B C:\ASM\esp\esp-idf\07_Displaycolorbar\build -DPYTHON_DEPS_CHECKED=1 -DPYTHON=C:\Espressif\tools\python\v6.0.1\venv\Scripts\python.exe -DESP_PLATFORM=1 -DIDF_TARGET=esp32p4 -DCCACHE_ENABLE=False C:\ASM\esp\esp-idf\07_Displaycolorbar
-- Found Git: C:/Espressif/tools/git/bin/git.exe (found version "2.54.0.windows.1")
-- Component directory C:/esp/v6.0.1/esp-idf/components/mqtt does not contain a CMakeLists.txt file. No component will be added
-- Configuring incomplete, errors occurred!

I also see this in the bottom-rigt corner
Quote
Bad CMake executable: "". Check to make sure it is installed or the value of the "cmake.cmakePath" setting contains the correct path

So something to do with a CMake version or path or something, but what ?

There seem to be two sets of tools installed, in C:\Espressive by the ESP-IDF VScode extention, and C:\ESP by ESP-IDF installation manager

Now trying uninstalling & reinstalling everything..



 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17813
  • Country: fr
Re: ESP32-IDF/vscode help needed...
« Reply #3 on: June 16, 2026, 03:45:49 pm »
It seems to come from that:

https://components.espressif.com/components/espressif/unit-test-app/versions/1.0.0/readme

The key is there:
Code: [Select]
Directory specified in EXTRA_COMPONENT_DIRS doesn't exist:
  C:/esp/v6.0.1/esp-idf/tools/unit-test-app/components

The example project you're trying to build is just not up to date with recent versions of esp-idf, and here the error is with the unit testing feature, which they have changed.

I haven't used esp-idf enough to know how to enable or disable unit testing - if you can find an easy option to disable unit testing for this project, that would be the shortest path. Otherwise you'll have to create a new project using esp-idf for this example, or kindly ask waveshare to update the project for the latest esp-idf, and use some patience.

 

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 14805
  • Country: gb
    • Mike's Electric Stuff
Re: ESP32-IDF/vscode help needed...
« Reply #4 on: June 16, 2026, 03:54:59 pm »
I've installed an earlier version of ESP-IDF, and I'm now just getting some C errors which I can probably figure out how to deal with...

All I'm actually trying to do is initialise the MIPI display so I can throw images on it from serial or SD card - that will be the whole final project. Might actually be easier to just pull apart their demo & drill down into what the lower levels are doing - it's currently invoking 2000-odd source files of LVGL...

I utterly despise complex build systems like this - give me MPLABX or Mounriver Studio any day!
 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 30304
  • Country: nl
    • NCT Developments
Re: ESP32-IDF/vscode help needed...
« Reply #5 on: June 17, 2026, 03:01:30 pm »
ESP-IDF is build on cmake + custom tooling (idf.py) written in Python. The interaction with the IDE is actually pretty minimal. Cmake drives the build from the custom tools. So even without the IDE, you are left with a pretty complicated build configuration (which is also not very flexible). Unfortunately the learning curve using ESP-IDF is pretty steep. A developer at one of my customers has spend weeks on unravelling IDF's build system and create his own build flow. If VSCode is getting in the way, I think a good start is using the command line tools instead of the IDE integration. That at least takes away one variable.

If you need results quickly, using Claude code to sort out what is what is highly likely a good way forward. Recently I have used Claude code to untangle a messy build system (originally half of the objects ended up in the directory with the git repository, the rest in the build directory). This went quite well.
« Last Edit: June 17, 2026, 03:54:33 pm by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 14805
  • Country: gb
    • Mike's Electric Stuff
Re: ESP32-IDF/vscode help needed...
« Reply #6 on: June 17, 2026, 04:33:21 pm »
I've got it compiling & programming OK now, and have one LCD example working, but vscode's "go to definition" functionality isn't working, and that is essential for figuring out how it all works. There are numerous "fixes" for this , none working so far.

I'm now trying the Eclipse based Espressif-IDE, and getting a bit further, but not quite there yet.

I'm sure this is all fine for people using day-in, day-out , but it's a complete nightmare for occasional users like me trying to do what should be a simple job.....




 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 30304
  • Country: nl
    • NCT Developments
Re: ESP32-IDF/vscode help needed...
« Reply #7 on: June 17, 2026, 04:38:27 pm »
One of the problems is that IDF pulls in the source code for the libraries into the build directory and compiles that. But all of that stays out of the scope of the IDE's C indexer because it is in the build directory (not to be indexed). That is a real nuisance. The way around it is to import the IDF git repository (which has all the source code) as a seperate C project. In that project, the C code is visible to the indexer. But you are left with 2 projects. No, it is not fine for people using it day-in-day-out as well  |O
« Last Edit: June 17, 2026, 04:39:59 pm by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 14805
  • Country: gb
    • Mike's Electric Stuff
Re: ESP32-IDF/vscode help needed...
« Reply #8 on: June 17, 2026, 04:52:20 pm »
One of the problems is that IDF pulls in the source code for the libraries into the build directory and compiles that. But all of that stays out of the scope of the IDE's C indexer because it is in the build directory (not to be indexed). That is a real nuisance. The way around it is to import the IDF git repository (which has all the source code) as a seperate C project. In that project, the C code is visible to the indexer. But you are left with 2 projects. No, it is not fine for people using it day-in-day-out as well  |O

I think there may be a more fundamental issue with my VSCode setup - I don't even see "go to definition" in the context menu, and things like greying out sections omitted by #ifdefs in the preprocessor don't even work.  Good to know that fixing these may not solve the problem.
I initially thought that Espressif-IDE "goto definition" worked, but turns out it was only resolving symbols in the main project.

Seems utterly bizarre to me that such useful functionality doesn't work out-of-the-box. 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17813
  • Country: fr
Re: ESP32-IDF/vscode help needed...
« Reply #9 on: June 17, 2026, 04:56:06 pm »
Haven't used VSCode in "ages" but make sure the required language server(s) are installed, not sure they are by default. Otherwise, I don't think it'll handle analyzing definitions.

 

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 14805
  • Country: gb
    • Mike's Electric Stuff
Re: ESP32-IDF/vscode help needed...
« Reply #10 on: June 17, 2026, 05:22:35 pm »
Haven't used VSCode in "ages" but make sure the required language server(s) are installed, not sure they are by default. Otherwise, I don't think it'll handle analyzing definitions.
I had  "C/C++ Dev tools" installed, which I thought was what was needed ( a recommendation popped up), but I also noticed a "C/C++" extension when I searched "C++" -  installed that and that seems to have fixed it - thanks!
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 30304
  • Country: nl
    • NCT Developments
Re: ESP32-IDF/vscode help needed...
« Reply #11 on: June 17, 2026, 05:40:21 pm »
One of the downsides I perceive from vscode is that is does very little out of the box. You have to install a whole bunch of plugins and you need to know which ones before you get a functional IDE. Eclipse CDT (C Development Tools) OTOH just works out of the box for writing C code.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 14805
  • Country: gb
    • Mike's Electric Stuff
Re: ESP32-IDF/vscode help needed...
« Reply #12 on: June 17, 2026, 07:33:47 pm »
One of the downsides I perceive from vscode is that is does very little out of the box. You have to install a whole bunch of plugins and you need to know which ones before you get a functional IDE.
It's a pity that when you install ESP-IDF plugin, it doesn't at least tell you exactly what you need to install, if it doesn't  actually install it for you.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3914
  • Country: it
Re: ESP32-IDF/vscode help needed...
« Reply #13 on: June 17, 2026, 08:01:56 pm »
I haven't had issues with ESP-IDF so far. Besides, it works flawlessly with VSCodium! The Microsoft C++ plugin is not needed and probably causes trouble, as the extension uses clang.

I have waveshare boards, even some LCD ones, but haven't actually used waveshare examples. Luckily i found that all the code examples from IDF mapped almost 1:1 to the waveshare boards, at most i just had to change the GPIO numbers for the peripherals according to the schematic
* They recently released IDF 6, maybe templates and code examples still prefers 5.50 *

One of the downsides I perceive from vscode is that is does very little out of the box. You have to install a whole bunch of plugins and you need to know which ones before you get a functional IDE.
It's a pity that when you install ESP-IDF plugin, it doesn't at least tell you exactly what you need to install, if it doesn't  actually install it for you.

that was not my experience. I always start with a fresh profile with zero plugins on VSCodium, the system always suggested or asked to install the required plugins automatically
 

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 14805
  • Country: gb
    • Mike's Electric Stuff
Re: ESP32-IDF/vscode help needed...
« Reply #14 on: June 20, 2026, 04:07:45 pm »
This is still driving me nuts....
I have two examples, both compiling and running correctly, doing pretty much everything I need, seperately - SD-card demo and LCD demo.
I now want to combine them, but can't for the life of me figure out how it needs to be told where to look for include files and ESP-IDF library include & source files, and how to get it to find the needed libraries.

e.g. the LCD example needs the ESP-IDF Cache functions, so has #include "esp_cache.h" at the start, but if I add this to the SD card example, it can't find that file.
I can't see anything in any of the LCD example files that tells it where to find this file, yet it all compiles file

Similarly in the SD card example, it includes "driver/sdmmc_host.h" but I can't figure out how it knows where to get these from.
the latter appears to be in <idf path>/components/esp_driver_sdmmc/include/driver

I have literally looked at every single file in each project but can't figure it out.

How do I tell it where to find stuff.....?






Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline jc101

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: gb
Re: ESP32-IDF/vscode help needed...
« Reply #15 on: June 20, 2026, 04:27:22 pm »
Have you been into the SDK Configuration Editor (menuconfig), from the Espressif logo on the LHS?

I remember something similar where the project needs to have the appropriate functions enabled in the config, then it would include the code in the project. You may need to include cache functions, etc. in there.

The ESP32 stuff is good, but I really don't get on with vscode.
 

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 14805
  • Country: gb
    • Mike's Electric Stuff
Re: ESP32-IDF/vscode help needed...
« Reply #16 on: June 20, 2026, 04:41:21 pm »
Have you been into the SDK Configuration Editor (menuconfig), from the Espressif logo on the LHS?

I remember something similar where the project needs to have the appropriate functions enabled in the config, then it would include the code in the project. You may need to include cache functions, etc. in there.

The ESP32 stuff is good, but I really don't get on with vscode.
AFAICS This seems to be more about configuring modules than selecting modules to include

I think this is an ESP-IDF problem rather than a VScode one
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline jc101

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: gb
Re: ESP32-IDF/vscode help needed...
« Reply #17 on: June 20, 2026, 05:08:33 pm »
Some code doesn’t seem to be included if the function in the module isn’t enabled. I can never find the bit I want, but there is a search.

The menuconfig is part of ESP-IDF, just presented differently within vscode. If cache is missing, is there any config in the for cache for the ESP32 you’re using?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->