Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Allow 'idf.svdFilePath' to construct the path to an .svd file based on the current target (VSC-1550) #1386

Open
GillesZunino opened this issue Dec 27, 2024 · 1 comment · May be fixed by #1385
Labels
Feature / Enhancement Request Request for Feature/ Enhancement

Comments

@GillesZunino
Copy link
Contributor

GillesZunino commented Dec 27, 2024

Is your feature request related to a problem?

The "ESP-IDF Peripheral Viewer" window requires the setting idf.svdFilePath to be set to the full path of an SVD file matching the target being debugged (i.e. esp32s3 or esp32 ...). Before v1.9.0, idf.adapterTargetName could be used to construct idf.svdFilePath as follows:

"idf.svdFilePath": "${workspaceFolder}/svd/${config:idf.adapterTargetName}.svd"

This made configuring the svd file path automatic even when the target changed. There was never any need to manually adjust idf.svdFilePath.

Version v1.9.0, removed idf.adapterTargetName (a great change in my opinion). This makes it impossible to set idf.svdFilePath to automatically adapt to the target.

This feature proposes a few ways to bring back automatic configuration of idf.svdFilePath as the target changes without the problematic setting idf.adapterTargetName.

Describe the solution you'd like

Expose a read only configuration setting tentatively called idf.currentTargetName which is interpreted as the value returned by getIdfTargetFromSdkconfig(). This would allow the value of idf.svdFilePath to automatically adapt as the target changes with the following sample configuration in settings.json:

"idf.svdFilePath": "${workspaceFolder}/svd/${config:idf.currentTargetName}.svd"

Describe alternatives you've considered

  • Another approach would be to add a new setting tentatively called idf.svdFilesRoot pointing to a directory where the extension can locate the svd file, assuming it is called getIdfTargetFromSdkconfig() + '.svd'.

  • Another approach would be to add a command tentatively called idf.getCurrentTargetName which would return whatever getIdfTargetFromSdkconfig() returns at the time idf.svdFilePath is being used by the extension. The following sample configuration in settings.json would be valid:

    "idf.svdFilePath": "${workspaceFolder}/svd/${command:idf.getCurrentTargetName}.svd"
  • Another option would be to allow accessing SDK configuration values like IDF_TARGET from settings.json, with a syntax similar to ${sdkConfig:IDF_TARGET}. The following sample configuration in settings.json would be valid:

    "idf.svdFilePath": "${workspaceFolder}/svd/${sdkConfig:IDF_TARGET}.svd"

All approaches maintain the ability to set idf.svdFilePath to a fixed, non-target dependent path for users who prefer this option.

@GillesZunino GillesZunino added the Feature / Enhancement Request Request for Feature/ Enhancement label Dec 27, 2024
@github-actions github-actions bot changed the title [Feature Request]: Allow 'idf.svdFilePath' to construct the path to an .svd file based on the current target [Feature Request]: Allow 'idf.svdFilePath' to construct the path to an .svd file based on the current target (VSC-1550) Dec 27, 2024
@brianignacio5 brianignacio5 linked a pull request Dec 27, 2024 that will close this issue
5 tasks
@brianignacio5
Copy link
Collaborator

brianignacio5 commented Dec 27, 2024

Please try vsix installer to see if the issue is fixed.

You can test these changes by installing this VSIX by click menu View -> Command Palette..., type Install from VSIX and then select downloaded esp-idf-extension.vsix file to install the extension.

In this Pull Request, we are saving whatever Espressif target you select with ESP-IDF: Set Espressif Device Target in settings.json idf.customExtraVars which is a list of environment variables, adding IDF_TARGET variable to selected target. We also add a way to use it in settings: "idf.svdFilePath": "${workspaceFolder}/${env:IDF_TARGET}.svd". So now we resolve env variables also with idf.customExtraVars first then system environment variables or "" otherwise.

Please give it a try and see if it solves your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature / Enhancement Request Request for Feature/ Enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants