Be Warned, New VS Code Ext. along side other ESP-IDF versions

mikemoy
Posts: 417
Joined: Fri Jan 12, 2018 9:10 pm

Be Warned, New VS Code Ext. along side other ESP-IDF versions

Postby mikemoy » Sat Jan 11, 2020 11:39 am

Well guys, This issue bit me in the rear end hard. The short version.... Don't (at least at the time of this writing) install the VS Code extension if you are using other IDE's with other ESP-IDF versions. Things will still compile but it will NOT operate as before.

The Long version... (or you can just jump to "---- Final Conclusion ----" at the end)

I use 3 IDE's because I am still torn between features from all of them, and as they evolve I want to stick with what I think is the best for me. I use Visual GDB, Platform IO, and VS Code (with my own setup, much like the new VSCode extension except mine works).

Visual GDB is awesome, but you have to pay for it, and it is a tab bit slower to compile even when using CMake. I am not fond of Visual Studio its just to dam bloated and IMHO VS Code just is way cleaner, and reacts faster for me.

PlatformIO is also great, but (at the time of this writing) cannot use menuconfig which is a HUGE loss.

VS Code is good as well. The only downside is that updates for the ESP-IDF are manual (not a deal breaker), But what i don't really care for is that I have not discovered any way for code completion, or for it to tell show me things like "variable such and such is unused" you have to watch the log output when compiling, and other code hints.

OK, now you know why i bounce between these 3.

Here is the real trouble that I ran into today. I designed a 12 port battery charger tester for a client. It sits on a 12" x 12" PCB with an OLED display, 12 RGB leds for each port, 2 heat sinks with fans, each with its own temp sensor, 12 individual channels each with their own IC's and circuitry to test 12 chargers off the production floor at one time. There are several devices using I2C and SPI.

Basically, the user plugs in the 12 chargers, and when they press the start button it measures and tests many things like under / over voltage. Ramps up and down the load current and other things to give a go/no go test for each charger.

This was working flawlessly for months on the bench as i developed the code for it. These last few days I was just making small tweaks here and there to the code like adjusting time's things were on the OLED, properly centering text on the OLED, code comments and others. Nothing major. Each day I would zip my project and save it as a backup.

Over the weekend I decided to give the "Official Visual Studio Code Extension for ESP-IDF Projects" a try.
I created a new folder, and installed a portable version of VS Code to check it out. Went though its install process selecting the master branch, and selected "blink" as the project. It was unable to do a few things like menuconfig, and know about the #includes. So its quite not there yet.

Now here comes monday. I forgot to put a reverse protection diode on the board for the 12 ports. So I soldered them on the backside of the 12 input jacks. Before powering it on, I just didn't remember if I uploaded the last changes on friday. I opened Visual GDB and did a quick make clean and re-compiled. Powered on the board and clicked flash. It booted up just fine, and when I pressed start everything (but the OLED and RGB leds) started working crazy.

It was unable to take proper voltage measurements and adjust the current. I was pissed because we are supposed to deliver the project to the customer in a week. Sooooo... I thought it must be some code change i did. Going to the backups from the day before and trying that gave same results. Then went to each daily backup from the last 2 weeks trying each all with same results. I then switched to my version of VS Code trying it as well with all its backups, all with the same results. OK... i though then the only thing left is that it got static zapped when soldering the diodes on. I changed the ESP32 module, still same problem, So I ordered new IC's for each of the 12 ports. The next day put all them on and it still acted the same. $89 bucks gone. The only things left were the 12 large FETS that act as a load. Ordered them, put them on. Same problems. $57 bucks gone.

---- Final Conclusion ----
Starring at this problem wondering what the hell could be the issue, I decided the only other thing i did from Friday to today was install "Official Visual Studio Code Extension for ESP-IDF Projects" So i restored my computer from an image of last month. After the new re-boot of the PC I copied back the latest version of the code from Friday. Compiled it, and uploaded it to the board. It worked perfect!!!

I was both PISSED and RELIEVED. Pissed that some other install did something to mess with my other IDE's install, and the loss of my money and time. Relieved that its all working now. Soooo be warned that (at the time of this writing) if you are trying out the new "Official Visual Studio Code Extension for ESP-IDF Projects" with other installed IDE's it WILL interfere with them as well.
Last edited by mikemoy on Sun Jan 19, 2020 4:13 am, edited 2 times in total.

chegewara
Posts: 913
Joined: Wed Jun 14, 2017 9:00 pm

Re: Be Warned, New VS Code Ext. along side other ESP-IDF versions

Postby chegewara » Sat Jan 11, 2020 5:20 pm

Hi,
i am using only VS code and i did 1 quick run with esp plugin, but i have few thoughts.
1) its not waste of money, its a more or less expensive lesson
2) to me menuconfig works from esp-idf plugin, it looks differently, like list of configs, but works
3) i think the problem you had was because during plugin configuration you downloaded and altered esp-idf and/or xtensa toolchain, but configuring vs code plugin you can choose folder to install esp-idf and toolchain and to have few versions (IIRC it will write to PATH, so you have to be careful about that)

mikemoy
Posts: 417
Joined: Fri Jan 12, 2018 9:10 pm

Re: Be Warned, New VS Code Ext. along side other ESP-IDF versions

Postby mikemoy » Sun Jan 12, 2020 1:04 am

3) i think the problem you had was because during plugin configuration you downloaded and altered esp-idf and/or xtensa toolchain, but configuring vs code plugin you can choose folder to install esp-idf and toolchain and to have few versions (IIRC it will write to PATH, so you have to be careful about that)
I could see how anyone might think that.
But that is the main reason why I posted this. When I created the new folder to try this i was very careful to install everything to that folder only. This is why I never considered it being the cause of the problem.

ESP_bignacio
Posts: 5
Joined: Wed May 02, 2018 12:12 pm

Re: Be Warned, New VS Code Ext. along side other ESP-IDF versions

Postby ESP_bignacio » Mon Jan 13, 2020 4:47 am

Hi @mikemoy

First thanks for the feedback.

I'm not sure how the vscode extension could affect other IDEs since we try our best to don't override any of your system settings and environment variables by saving everything in Vscode in our extension variables such as `idf.espIdfPath`, `idf.customExtraPaths`, etc. which are explained in the README.md. (If any of you think this might need clarification please let us now or make a contribution :D )

The one thing I could think of is that you use many IDEs and constantly change between (as far as I understand). Consider that vscode extension configure a set of ESP-IDF tools such as the xtensa compile with specific versions. If you have different version in other environment, build result might change.

Please let us know how we can make this experience more interesting for you and how we can improve the extension for better.

mikemoy
Posts: 417
Joined: Fri Jan 12, 2018 9:10 pm

Re: Be Warned, New VS Code Ext. along side other ESP-IDF versions

Postby mikemoy » Mon Jan 13, 2020 12:20 pm

If you have different version in other environment, build result might change.
That is all I was trying to say. Just to be careful if you are using different ESp-IDF versions on the same PC.

I think the problem came in from using the install tool. "esp-idf-tools-setup-2.2.exe". Not that there is anything wrong with the tool. But rather to make this work in a VS Code environment you need to put things in the PATH. Such as:

Code: Select all

C:\Users\Mike\ESP32\.espressif\tools\xtensa-esp32-elf\1.22.0-80-g6c4433a5-5.2.0\xtensa-esp32-elf\bin
C:\Users\Mike\ESP32\.espressif\tools\esp32ulp-elf\2.28.51.20170517\esp32ulp-elf-binutils\bin
C:\Users\Mike\ESP32\.espressif\tools\cmake\3.13.4\bin
C:\Users\Mike\ESP32\.espressif\tools\openocd-esp32\v0.10.0-esp32-20190313\openocd-esp32\bin
C:\Users\Mike\ESP32\.espressif\tools\mconf\v4.6.0.0-idf-20190628\
C:\Users\Mike\ESP32\.espressif\tools\ninja\1.9.0\
C:\Users\Mike\ESP32\.espressif\tools\idf-exe\1.0\
C:\Users\Mike\ESP32\.espressif\tools\ccache\3.7\
C:\Users\Mike\ESP32\.espressif\python_env\idf3.3_py3.7_env\Scripts
C:\Users\Mike\ESP32\esp-idf\tools
Later when I tried the new VS Code extension it also put things in the PATH, and that is probably where things got goofy.

I think the new VS Code extension is a great thing from espressif, i just wanted others to be aware of version conflicts.

chegewara
Posts: 913
Joined: Wed Jun 14, 2017 9:00 pm

Re: Be Warned, New VS Code Ext. along side other ESP-IDF versions

Postby chegewara » Mon Jan 13, 2020 5:39 pm

I think the problem came in from using the install tool. "esp-idf-tools-setup-2.2.exe". Not that there is anything wrong with the tool. But rather to make this work in a VS Code environment you need to put things in the PATH
This is what ive been trying to tell in point 3 in my previous post. I am using linux and i saw that VS code plugin is adding PATH to .bashrc, i am assuming it is doing the same with windows system PATH. With linux its easier, because for example i am not using global IDF_PATH in .bashrc or .profile, rather i am exporting esp-idf path in currently active terminal. This way global IDF_PATH is not messing with AWSFreeRTOS, vs code plugin and i can have few folders with esp-idf version. Windows users are in worse situation i think.

mikemoy
Posts: 417
Joined: Fri Jan 12, 2018 9:10 pm

Re: Be Warned, New VS Code Ext. along side other ESP-IDF versions

Postby mikemoy » Mon Jan 13, 2020 6:00 pm

@chegewara
This is what ive been trying to tell in point 3 in my previous post.
Yup, you hit the nail on the head. This makes me wonder when using a PC how are we going to compile for different versions.
Visual GDB allows you to make projects with all the different versions without interference from one to another which is nice.
But the VSCode method seems to prohibit that, there needs to be a way to have it specifically use a specific version per project.

chegewara
Posts: 913
Joined: Wed Jun 14, 2017 9:00 pm

Re: Be Warned, New VS Code Ext. along side other ESP-IDF versions

Postby chegewara » Mon Jan 13, 2020 7:05 pm

mikemoy wrote: This makes me wonder when using a PC how are we going to compile for different versions.
It is possible, but its not very convenient, in other hand i dont see other option (im not sure it will work with vs code).
Lets look at esp-adf project for example. Esp-idf is used as submodule with particular commit:
https://github.com/espressif/esp-adf

I believe you can build any project you want the same way and instead of having global esp-idf, you can have esp-idf per project.

mikemoy
Posts: 417
Joined: Fri Jan 12, 2018 9:10 pm

Re: Be Warned, New VS Code Ext. along side other ESP-IDF versions

Postby mikemoy » Mon Jan 13, 2020 9:44 pm

Thats a great idea!

chegewara
Posts: 913
Joined: Wed Jun 14, 2017 9:00 pm

Re: Be Warned, New VS Code Ext. along side other ESP-IDF versions

Postby chegewara » Sat Jan 18, 2020 9:35 am

Another bonus, i am using AWSFreeRTOS and i can use espressif plugin to flash and monitor app by using icons at bottom, assuming project is build from CLI.

Who is online

Users browsing this forum: No registered users and 1 guest