How to set linux as target in Vscode?

User avatar
kozmotronik
Posts: 23
Joined: Wed Jan 29, 2025 8:28 am

How to set linux as target in Vscode?

Postby kozmotronik » Wed Jul 09, 2025 6:58 am

Hello everyone,

I am trying to write host tests for a custom component. I need set target as linux in order to execute the tests on the host machine. However I could not manage to set target to linux. In my environment, esp32c3 was already set as a target. When I try to select the target from the bottom bar, I select linux and then I'm asked for an openocd configuration path.
vscode-esp-idf-target-linux.png
vscode-esp-idf-target-linux.png (8.43 KiB) Viewed 9132 times
If I don't specify, I can't finish the selection process target as linux. I also tried setting via CLI but I get the following message and could not set the target:

Code: Select all

$ idf.py --preview set-target linux
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Build directory '/disk/Projeler/ESP-Components/relay_chn/test_apps/build' not found. Nothing to clean.
Executing action: set-target
Set Target to: linux, new sdkconfig will be created.
Target 'linux' specified on command line is not consistent with target 'esp32c3' in the environment.
What should I do to set the target as linux? Thank you.

User avatar
kozmotronik
Posts: 23
Joined: Wed Jan 29, 2025 8:28 am

Re: How to set linux as target in Vscode?

Postby kozmotronik » Wed Jul 09, 2025 7:28 am

It looks like I managed to set it by pressing the enter key when I'm asked for openocd config file. This sets the target as linux however the popup: "ESP-IDF: Setting device target..." never goes away as if the process hasn't terminated.
vscode-esp-idf-target-linux-popup.png
vscode-esp-idf-target-linux-popup.png (11.68 KiB) Viewed 9130 times

User avatar
kozmotronik
Posts: 23
Joined: Wed Jan 29, 2025 8:28 am

Re: How to set linux as target in Vscode?

Postby kozmotronik » Thu Jul 10, 2025 12:21 pm

I think there is a bug in the VSCode ESP-IDF Extension. When I set target as linux from the UI and then build the code, it somehow builds the code but fails to generate/link the executable .elf file with the following message:
error: cannot parse "Memory Configuration" section in "/disk/Projeler/ESP-Components/relay_chn/host_test/build/relay_chn_host_test.map" map file
However when I try those steps in the CLI, it succeeds:
  • Full clean
  • idf.py --preview set-target linux
  • idf.py build
Can it be confirmed please? If not, let me know the proper way to select target as linux and build it successfully.

Repent4
Posts: 3
Joined: Fri Jan 12, 2024 5:05 pm

Re: How to set linux as target in Vscode?

Postby Repent4 » Tue Sep 16, 2025 9:15 am

I'm experiencing the same issues. My configuration is:

OS linux x64 6.6.87.2-microsoft-standard-WSL2
Visual Studio Code version 1.104.0
Visual Studio Code language en
Visual Studio Code shell /bin/bash
ESP-IDF Extension version 1.10.2
Git version 2.34.1
ESP-IDF version 5.5.0
Python version 3.10.12
Python's pip version 25.2

bignacio
Espressif staff
Espressif staff
Posts: 255
Joined: Wed May 02, 2018 12:12 pm

Re: How to set linux as target in Vscode?

Postby bignacio » Wed Sep 17, 2025 4:41 am

This should be fixed with https://github.com/espressif/vscode-esp ... /pull/1652

Could you guys try the latest master vsix installer You can use this VSIX to test the current github master of the extension by pressing F1 or click menu View -> Command Palette..., type Install from VSIX and then select the previously downloaded .vsix file to install the extension.

Repent4
Posts: 3
Joined: Fri Jan 12, 2024 5:05 pm

Re: How to set linux as target in Vscode?

Postby Repent4 » Wed Sep 17, 2025 7:02 am

Hi.
When downloading the VSIX I realized that I still had to update my installation to version 2.0.0 of the extension (by the way, the changelog is up to ver. 1.10.1).
After setting everything to the last version, I tried to switch target but it didn't work anymore.
I got the error "Could not get OpenOCD scripts path".
Did I break something?

bignacio
Espressif staff
Espressif staff
Posts: 255
Joined: Wed May 02, 2018 12:12 pm

Re: How to set linux as target in Vscode?

Postby bignacio » Fri Sep 19, 2025 2:49 am

You don't have to update to v2.0.0 (it is a pre-release in vscode marketplace but vscode UI for pre-release vs release still need to be improved in my opinion).

Please try the vsix installer I've shared, the v2.0.0 has some breaking changes regarding esp-idf setup and how we store the settings.

Check with the ESP-IDF Doctor command if the setup is correct. Please share it here or in a GitHub issue so we can fix your setup asap.

Who is online

Users browsing this forum: No registered users and 1 guest