Skip to content

Not possible to override debug configuration keys that are remapped from Arduino CLI #48

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

Closed
per1234 opened this issue Mar 3, 2024 · 0 comments · Fixed by #49
Closed
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Mar 3, 2024

Describe the problem

This extension automatically generates a launch.json file to configure the Cortex-Debug VS Code extension for use with the selected board and "programmer" (debug probe).

The base configuration data comes from the arduino-cli debug --info output. Some of that data does not match exactly with the launch.json format so the extension remaps it.

In some cases (example), the user might need/want to make some adjustments to the generated configuration. This is done by adding the custom configuration data to a file named debug_custom.json in the sketch root folder. The configuration from that file is merged into the base data when generating launch.json, overriding the base data where there is overlap.

🐛 Overrides no longer work for the configuration keys that are remapped from the Arduino CLI data:

  • armToolchainPath
  • configFiles
  • serverpath
  • servertype

To reproduce


Hardware is not required to perform this demo.


  1. If you don't already have it installed, use the Arduino IDE Boards Manager to install the "Arduino SAMD Boards (32-bits ARM Cortex-M0+)" platform.
    This platform was selected arbitrarily as one that has debugger support. The fault is not platform-specific.
  2. Select File > New from the Arduino IDE menus.
  3. Select Tools > Board > Arduino SAMD Boards (32-bits ARM Cortex-M0+) > Arduino Zero (Programming Port) from the Arduino IDE menus.
  4. Select Tools > Programmer > Atmel EDBG from the Arduino IDE menus.
  5. Click the ●●● icon on the right side of the editor toolbar.
    A menu will open.
  6. Select "New Tab" from the menu.
    The "Name for new file" dialog will open.
  7. Type debug_custom.json in the field in the dialog.
  8. Click the "OK" button.
    The dialog will close and a "debug_custom.json" tab will be added to the editor view.
  9. Use the editor to add the following content to the "debug_custom.json" tab:
    [
      {
        "configId": "arduino:samd:arduino_zero_edbg:programmer=edbg",
        "toolchainPrefix": "custom-toolchain-prefix",
        "armToolchainPath": "/path/to/custom-arm-toolchain",
        "configFiles": ["/path/to/custom-custom-config-file"],
        "serverpath": "/path/to/custom-server",
        "servertype": "jlink"
      }
    ]
  10. Select Sketch > Verify/Compile from the Arduino IDE menus.
  11. Wait for the compilation to finish successfully.
  12. Click the "Start Debugging" button on the Arduino IDE toolbar.
  13. Wait for the process to fail.
    The failure is expected unless you happen to have the necessary hardware connected to your computer. It is not relevant to the demo.
  14. Click the "Toggle Debug View" icon on the activity bar.
    The debug view will open in the left side panel.
  15. Click the gear icon ('Open "launch.json"') on the debugger toolbar.
    A "launch.json" tab will open in the editor.

🙂 The configurations[0].toolchainPrefix value was set according to debug_custom.json as expected:

"toolchainPrefix": "custom-toolchain-prefix"

🐛 The configurations[0].armToolchainPath, configurations[0].configFiles, configurations[0].serverpath, and configurations[0].servertype values were not set according to debug_custom.json:

"armToolchainPath": "C:\\Users\\per\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/",
"configFiles": [
  "C:\\Users\\per\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.14/variants/arduino_zero/openocd_scripts/arduino_zero.cfg"
],
"serverpath": "C:\\Users\\per\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\openocd\\0.10.0-arduino7/bin/openocd",
"servertype": "openocd"

Expected behavior

Any debug configuration key can be overridden via debug_custom.json.

vscode-arduino-tools version

0.1.3

Additional context

The regression was introduced at 9508d0a / #41

Additional Reports

Workaround

Use the pre-remapping key names in debug_custom.json:

  • armToolchainPath -> toolchainPath
  • configFiles -> serverConfiguration.scripts
  • serverpath -> serverPath
  • servertype -> server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant