Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 8 Replies) Need help to revert ESP32 IDF version (Read 917 times)
romeo
Junior Member
**
Offline


Posts: 27
Joined: Aug 3rd, 2024
Need help to revert ESP32 IDF version
Jul 17th, 2025 at 2:32pm
Print Post  
I recently needed to upgrade my ESP32 board package to cope with the S3 which I am using for a new project. Sadly, that broke one of my legacy ESP32 projects which are not compatible with V3 tools and V5 IDF. Using board manager, it's a simple matter to revert the board package to V2.0; this reverts the hardware path to V2.0 no problems, but does not revert the tools path to IDF V4. 
I have spent some time looking for an answer without luck. I am hoping that somewhere in the wisdom of this group there is an answer.
Any help would be gratefully received. 
Roman
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2759
Joined: Feb 13th, 2019
Re: Need help to revert ESP32 IDF version
Reply #1 - Jul 17th, 2025 at 2:38pm
Print Post  
Could you attach the complete build output as a text file with the below settings enabled:
  • vMicro > Compiler > Verbose
  • vMicro > Compiler > Show Build Properties


It sounds like the tools haven't been fully removed from the previous 3.x version, but the logs will help us to guide you through this.
  
Back to top
IP Logged
 
romeo
Junior Member
**
Offline


Posts: 27
Joined: Aug 3rd, 2024
Re: Need help to revert ESP32 IDF version
Reply #2 - Jul 18th, 2025 at 1:47am
Print Post  
Simon
Thanks for offering to help; I didn't think to try to build initially because failure was certain. 
I have attached the build log as requested; as expected, the failures are associated with a pcnt function which deprecated at IDF5 but worked fine with IDF4.
I had "promoted" several .h files to my project folder, and added explicit #includes, to remove many of the VS squiggly lines, but that doesn't help at build time; the functions simply don't exist in IDF5. (I am just a home hobbyist, not a software engineer, so I spend a lot of time guessing!)
Roman
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2759
Joined: Feb 13th, 2019
Re: Need help to revert ESP32 IDF version
Reply #3 - Jul 18th, 2025 at 9:33am
Print Post  
Thanks for the log and it doesn't appear there is any conflicting tools or core components in use there.

I assume the #include "driver/pcnt.h" is present in the INO file?

When you say you had "Promoted" multiple H files to the project folder, had you referenced them from the core directly, or had you cloned them into the project folder itself?

Did the project previously work with 2.0.17, or are you unsure which version it was before upgrading to 3.x?

  
Back to top
IP Logged
 
romeo
Junior Member
**
Offline


Posts: 27
Joined: Aug 3rd, 2024
Re: Need help to revert ESP32 IDF version
Reply #4 - Jul 18th, 2025 at 9:56am
Print Post  
To answer your questions in turn:
I did #include driver/pcnt.h into the .ino file.
By "promoted" I actually found them in the tool path ...\packages\esp32\tools\esp32-arduino-libs\idf-release-v5.1....
and copied them directly into the project folder. Interestingly, the compiler did not find them down that path.
I know that the project DID work with 2.0 and DID fail with 3.0 (because I had to revert a couple of years ago when I did a similar unthinking upgrade - and that reversion worked fine) but these versions reflect the ...\packages\esp32\hardware\...path. I didn't pay any attention to the ...\tools\... path which I believe contains the actual software libraries.  And I'm guessing that finding the "old" header files helps with names and definitions pre-compilation but doesn't actually help with the deprecated software.

So my original question is how do I access IDF 4? Expressif have a complete IDF4.4 zip file on their website which I downloaded but it doesn't look anything like the Arduino structure.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2759
Joined: Feb 13th, 2019
Re: Need help to revert ESP32 IDF version
Reply #5 - Jul 18th, 2025 at 10:36am
Print Post  
Thanks for the detail.

The ESP32 board package changes between its versions quite a lot even within 2.x, and the 3.x is a larger restructure of it all (along with shifting IDF versions beneath).

Cleanup
As you have copied files into the project which are from the 3.x package I would suggest removing those from the project via Solution Explorer to begin with as they will be adding to the confusion for both intellisense and compilation.  Once they are removed and the board package is the same version as before then this should work.

Also disable the Serial Debugger in vMicro, just in case this is causing any confusion (it shouldn't, but to be safe...).

If it seems like some components aren't being uninstalled correctly, close VS, and delete the %LOCALAPPDATA%\Arduino15\packages\esp32 folder entirely, then open VS and reinstall the board package.

Intellisense
The fact the compiler did not find the files is an issue of its own, and should be resolvable without the need to clone core files into the project (allowing simpler upgrades when needed).

IDF Versions
The 2.0.17 board package is built upon IDF v4.6, and each board package version contains the IDF components it was built with. It cannot be used like a library or component, it is what the board package is built with so it all fits together as one unit.
Arduino Core Version ESP-IDF Base Version Notes
v2.0.0 ESP-IDF v4.4 First stable 2.x release
v2.0.1 – v2.0.6 ESP-IDF v4.4 Bugfix and incremental updates
v2.0.7 – v2.0.10 ESP-IDF v4.4.2 Stability improvements
v2.0.11 – v2.0.14 ESP-IDF v4.4.3 Widely used in production
v2.0.15 – v2.0.16 ESP-IDF v4.4.5 Late-stage bugfixes
v2.0.17 ESP-IDF v4.4.6 Final 2.x release; most mature v4.4.x base


Arduino Core Version ESP-IDF Base Version Notes
v3.0.0 ESP-IDF v5.0 Major changes: drivers, components, APIs
v3.0.1 – v3.0.7 ESP-IDF v5.0.x Gradual bugfixes and compatibility work
v3.1.0 ESP-IDF v5.1 Major feature update
v3.2.0 ESP-IDF v5.1.2 Most stable 5.1-based release
v3.3.0 (upcoming) ESP-IDF v5.2.x (likely) More IDF 5.2 support (Matter, BLE Mesh, etc.)


Future Final Solution
This is the ideal scenario (once working again) to recreate the project and its' board package as a Portable Solution, so the Solution, Project, Board Package and all libraries live in an isolated folder, separated from your normal board package and library installs:
Documentation: https://www.visualmicro.com/page/New-Arduino-Portable-Solution.aspx
Video Guide: https://www.youtube.com/watch?v=PEkaumrbFAc

This can be done in-place without the wizard by closing the solution and creating a few folders as shown here, then re-installing the boards/libraries needed:
Documentation: https://www.visualmicro.com/page/How-to-Encapsulate-a-Board-Package-with-a-Solut...
« Last Edit: Jul 18th, 2025 at 10:38am by Simon@Visual Micro »  
Back to top
IP Logged
 
romeo
Junior Member
**
Offline


Posts: 27
Joined: Aug 3rd, 2024
Re: Need help to revert ESP32 IDF version
Reply #6 - Jul 18th, 2025 at 1:46pm
Print Post  
Sorry, Simon, my last response was a simple email reply which didn't appear here - laziness on my part. Your response to that was very complete - thanks.
Back to my problem...
I tried clearing out the entire \esp32 chain and reloading 2.0.17 from Board Manager in VS. Download took ages, and then the unpacking failed (more on this later).
I tried doing the same thing in Arduino IDE 2.3.6 - it installed almost instantly, but my program still threw the same errors (yes, I did delete all the header files I had been shuffling).
The VS error message I got in the first instance said something about \staging\ directory, and when I looked there, there were .zip files of every version of esp32 I had played with. (I guess that's why Arduino IDE installed so quickly).
So again I deleted the entire esp32 path and cleared out all the staging packages, and tried to reload V2.0.0. Both VS and Arduino IDE failed. I have attached the error dumps from these attempts.
I am at a loss as to know what to do.
Again, I appreciate that this probably is not a VM issue, so I doubly appreciate your support!
Roman
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2759
Joined: Feb 13th, 2019
Re: Need help to revert ESP32 IDF version
Reply #7 - Jul 18th, 2025 at 2:00pm
Print Post  
Thanks for the update, and the fact that both IDEs fail to install suggests either a networking issue or a corrupted ZIP.

Can you delete the %LOCALAPPDATA%\ Arduino15\ staging\ staging \packages \riscv32-esp-elf-gcc8_4_0_esp-2021r1-win32.zip, and then try installing again from either IDE?

« Last Edit: Jul 18th, 2025 at 2:01pm by Simon@Visual Micro »  
Back to top
IP Logged
 
romeo
Junior Member
**
Offline


Posts: 27
Joined: Aug 3rd, 2024
Re: Need help to revert ESP32 IDF version
Reply #8 - Jul 18th, 2025 at 2:16pm
Print Post  
I deleted the entire staging directory, and V2.0.0 then installed OK (using VS Board Manager) but VS still shows me lots of squiggly red lines (consistently 26 in one package, 2 in another). I can get rid of the 26 by fiddling all the header files as before (I have currently deleted all of that) but the last 2 remain - and of course it throws up all those build errors.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2759
Joined: Feb 13th, 2019
Re: Need help to revert ESP32 IDF version
Reply #9 - Jul 18th, 2025 at 2:23pm
Print Post  
Is 2.0.17 definitely the right package, or could it have been an older 2.0.11 version for example?

Would it be possible to share the full project in a ZIP file, or email it to us to review (exclude the ".vs" folder so save space)?

  
Back to top
IP Logged
 
romeo
Junior Member
**
Offline


Posts: 27
Joined: Aug 3rd, 2024
Re: Need help to revert ESP32 IDF version
Reply #10 - Jul 18th, 2025 at 2:43pm
Print Post  
Although I did try reverting to 2.0.17 initially, I know that it DEFINITELY worked at 2.0.0. about 9 months ago, and that is what I have been focussing on with all my latest attempts . I have made some (minor) code changes since then, which compiled OK, and I don't recall making any updates to my IDE until a few weeks ago when I started playing with ESP32-S3; that took me to V3, which is when all this trouble with my legacy project surfaced.

I emailed you a zip file even before I saw this! It is only the 5 source files; did you need more?
  
Back to top
 
IP Logged
 
romeo
Junior Member
**
Offline


Posts: 27
Joined: Aug 3rd, 2024
Re: Need help to revert ESP32 IDF version
Reply #11 - Jul 18th, 2025 at 2:44pm
Print Post  
It's midnight here; I'm drawing stumps but play with this more tomorrow.
Roman
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2759
Joined: Feb 13th, 2019
Re: Need help to revert ESP32 IDF version
Reply #12 - Jul 18th, 2025 at 3:00pm
Print Post  
Thanks for the email.

One element I had missed earlier which will be part of your Intellisense issue is your project is in the old format.  If you convert it as shown on the below page you should have no Intellisense errors in the INO:
https://www.visualmicro.com/page/Upgraded-Intellisense-System-in-Visual-Micro.as...

To my understanding the PCINT register has been changed since v2.0.0 of the board package and rolling back to that would be the safest option. 

I added the #include <driver/pcnt.h> to the top of the ESP32_Quad_Encoder.h file (above MAX_ENCODERS), and compiled on v2.0.0 with no issues.

Then if desired you can amend the code for the newer register access approach (if you want to actively upgrade to newer board packages).
  
Back to top
IP Logged
 
romeo
Junior Member
**
Offline


Posts: 27
Joined: Aug 3rd, 2024
Re: Need help to revert ESP32 IDF version
Reply #13 - Jul 19th, 2025 at 12:51am
Print Post  
Thanks, Simon.
I did all that and it built just fine, at last. Seems like, had I left in that one header (driver/pcnt.h) it probably would have worked, although I missed the bit about the Intellisense upgrade.
My current interest in this file was, in fact, spawned by a desire to upgrade it to the newer register approach. But first I am going to try to "freeze" what I have in a portable version.
It appears to me that, rather than modifying the structures of the existing solution (notwithstanding that your instructions seem quite clear), I will first try to create a brand new portable project using the wizard, copy across the original source files, and hit "go". Might be simpler...

Yet again, thanks heaps for your help.
Roman
  
Back to top
 
IP Logged
 
romeo
Junior Member
**
Offline


Posts: 27
Joined: Aug 3rd, 2024
Re: Need help to revert ESP32 IDF version
Reply #14 - Jul 19th, 2025 at 5:26am
Print Post  
As per my previous post, I want to retain a "known good" version of my project, so I did not immediately follow your suggestion of modifying the structure of my working version to make it "portable". What I did was:

-start a new portable project using the wizard and toolkit V2.0.0, without initial sketch, then closed VS
-deleted info.ino and copied my 5 source files out of my working version into that same sketchbook folder in ...\arduino-portable\TouchDRO_Interface\TouchDRO_Interface\
-re-opened the portable project in VS and opened each of the source files in their arduino-portable location

At this stage it all looked good, "No issues found".
But the build failed.
cstdlib:41: fatal error  bits/c++config.h  No such file or directory
   #include <bits/c++config.h>

I have attached the build log.

Saga continues in the next post.


  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
romeo
Junior Member
**
Offline


Posts: 27
Joined: Aug 3rd, 2024
Re: Need help to revert ESP32 IDF version
Reply #15 - Jul 19th, 2025 at 5:36am
Print Post  
So then I thought to try your method of modifying the structure of a working version and tried to make a copy of same, using a similar process but starting with a "normal" new VMicro project, copy in the source files to the solution folder, open them in VS, etc. So now I thought I had two identical environments, the only difference being a "_V2" suffix to the project name. Again, "No issues found" but refuses to build with completely different errors reminiscent of my earlier problems. I have attached that log.

To confirm - All this time my original solution, thanks to your help, sits in its folder and continues to build reliably. I don't want to mess with this in any way until I have a handle on a satisfactory cloning process. But I eventually want to upgrade my toolchains, etc, so I can move forward.

I realise that I can "clone" these solutions by using a git "branch" thing, but that still won't let me put a "known good" and complete portable package aside while carrying on.

There's GOT to be a way!
Roman
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
romeo
Junior Member
**
Offline


Posts: 27
Joined: Aug 3rd, 2024
Re: Need help to revert ESP32 IDF version
Reply #16 - Jul 19th, 2025 at 6:44am
Print Post  
Interestingly, I tried to repeat that cloning process as per the last post, for another ESP8266 project - the original compiles fine but the "copy" failed due to a  "undefined reference" error despite the fact  that "peek definition" finds it OK. And yet importing example code from all sorts of places in exactly this way is what I do all the time; I just did a whole bunch of FreeRTOS tutorials by copying and opening files in just this way.
 
Oh well.....

Roman
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2759
Joined: Feb 13th, 2019
Re: Need help to revert ESP32 IDF version
Reply #17 - Jul 19th, 2025 at 11:44am
Print Post  
Thanks for the detail and glad there is some progress with the initial project at least.

In the "Dump2" log it seems not all files are registered in the project itself as it doesnt show it building the ESP32_Quad_Encoder.cpp or ESP32_Touch_Tacho.cpp.  If you click vMicro > Ensure All Files In Project, this should ensure they are visible in Solution Explorer and built as well.

I'll test the same setup for the portable solution on monday, however one element which can occur is the internal compiler paths get longer than windows allows by default.

If you enable "Long Paths" in Windows this often resolves the issue, though without testing I can't confirm this is the case currently for this setup:
https://www.visualmicro.com/page/Enabling-Long-Paths.aspx
  
Back to top
IP Logged
 
romeo
Junior Member
**
Offline


Posts: 27
Joined: Aug 3rd, 2024
Re: Need help to revert ESP32 IDF version
Reply #18 - Jul 20th, 2025 at 1:21am
Print Post  
I set the longer path length (I didn't count exactly but some were getting close to 250) but this didn't help. 
Same error, (can't find bin\c++config.h) even though there are indeed any number of instances in ...\arduino-portable\... of that file (see attachment).

One curious thing I noticed...when I hit "Clean Solution" it tells me it has deleted ...\Temp\VMBuilds\TouchDRO_Interface\... and not  ...\Temp\VMBuilds\TouchDRO_Interface_Portable\... 
In fact, it doesn't seem to create a ...._portable folder in Temp\VMBuilds even if I open the original non-portable solution concurrently. (Both instances each tell me they deleted ...\Temp\VMBuilds\TouchDRO_Interface\...).  Don't know if this is relevant. 

Another interesting thing...when I just reopened ...portable solution just now, in addition to the original 5 source files, it opened with a focus on cstdlib where there is a clear 
#include <bits/c++config.h> 
statement right up front.  This suddenly decided to happen after dozens of openings. Again, relevant??
Roman
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
romeo
Junior Member
**
Offline


Posts: 27
Joined: Aug 3rd, 2024
Re: Need help to revert ESP32 IDF version
Reply #19 - Jul 20th, 2025 at 1:54am
Print Post  
I also had another go and building my non-portable clone copy. I noticed that debug was "ON" in both cases, so I disabled it and tried again - same result. I scanned the resulting output and indeed it does look like the two .cpp files simply failed to build. I can confirm that "Include all files" has indeed been ON the whole time.
I can also confirm that I CLEAN and RESCAN prior to every build.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint