Skip to content

Conversation

@radurentea
Copy link
Collaborator

Description

Moved the declaration of customExtraVars to a single location and added logic to clear OPENOCD_USB_ADAPTER_LOCATION when no board location is available or when switching to a non-connected target.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Steps to test this pull request

  1. In a project, set target to a connected device and check that OPENOCD_USB_ADAPTER_LOCATION has been set in idf.customExtraVars.
  2. Set the target again to a board that is not connected

The "OPENOCD_USB_ADAPTER_LOCATIO" property should be cleared from idf.customExtraVars and setting again the target to a connected board or using JTAG flashing should work.

How has this been tested?

Same as described above

Test Configuration:

  • ESP-IDF Version: 5.5.1
  • OS (Windows,Linux and macOS): Windows

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

…ed the declaration of customExtraVars to a single location and added logic to clear OPENOCD_USB_ADAPTER_LOCATION when no board location is available or when switching to a non-connected target.
@radurentea radurentea self-assigned this Nov 20, 2025
@github-actions
Copy link

github-actions bot commented Nov 20, 2025

Download the artifacts for this pull request:
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.

Clear the OPENOCD_USB_ADAPTER_LOCATION setting when switching to a target
that doesn't have a USB location, preventing OpenOCD from using stale device
addresses from previous targets.

Create a plain object copy of customExtraVars to avoid proxy issues when
deleting properties, and remove unnecessary configuration re-read.
@brianignacio5
Copy link
Collaborator

The thing about this logic is only applies when user run the setTarget command.

I'm wondering for the case: 1) User has connected board, 2) Run set target, 3) value is set in customExtraVars 4) Time passes user disconnect board 5) User tries to use OpenOCD Server directly and it doesn't work ? USB_ADAPTER_LOCATION is changed ?

Remove OPENOCD_USB_ADAPTER_LOCATION from environment during device detection
so the script can scan all available devices, not just the one at the
configured location.
- Added extra bool parameter for running openOCDManager.version() with default value false, for not silencing the output from it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants