(solved) VS Code finding wrong toolchain

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

(solved) VS Code finding wrong toolchain

Postby mzimmers » Fri Sep 10, 2021 12:59 am

Hi -

I'm new to VS Code, and I'm sure I'm doing something wrong, but...in one of my project files, I include stdint.h. When I hover on it and hit F12, it opens a file from an ARM toolchain that I have installed, not the one I want. I realize this is some configuration error, but I can't find it. Can someone please advise?

Thanks...
Last edited by mzimmers on Mon Sep 13, 2021 5:23 pm, edited 1 time in total.

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

Re: VS Code finding wrong toolchain

Postby ESP_bignacio » Fri Sep 10, 2021 6:20 am

Based on your feedback maybe is a misconfiguration of the C/C++ extension.

Try checking https://github.com/espressif/vscode-esp ... URATION.md for examples how to configure.

If you are not using the Espressif extension, just {config:idf.*} for the real path or use the compile_commands.json if you are able to successfully build the project.

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: VS Code finding wrong toolchain

Postby mzimmers » Fri Sep 10, 2021 4:11 pm

Thank you, bignacio. I created that file, and it seemed to solve the problem...temporarily. Then, I tried to build (got a bunch of errors that I expected) and now, it's finding the incorrect paths again. Any idea what's going on here?

Thanks...

EDIT: could the problem arise from the fact that I don't have an environment variable for IDF_TOOLS_PATH? I see the default for it (which is the correct path), but does the extension need this explicitly defined?
Attachments
esp.PNG
esp.PNG (32.72 KiB) Viewed 4814 times

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: VS Code finding wrong toolchain

Postby mzimmers » Fri Sep 10, 2021 6:49 pm

I found the problem: the default c_cpp_properties.json file that was generated didn't include this:

Code: Select all

            "name": "ESP-IDF",
            "compilerPath": "/home/mzimmers/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/
I discovered this omission by comparing with the blink project. The intellisense, and the builds, seem to find the correct toolchain now.

Shouldn't this code be included in the default file that is generated within the extension?

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

Re: VS Code finding wrong toolchain

Postby ESP_bignacio » Mon Sep 13, 2021 4:44 am

While the compiler path is not part of the template file within c_cpp_properties.json but it is set when you add the vscode configuration files using the extension when running:

1) Add vscode configuration folder command

2) New Project command

3) Show Examples Projects command

4) Create project from extension template command.

In the c_cpp_properties documentation we should add it though, thanks.

Who is online

Users browsing this forum: No registered users and 39 guests