Skip to content

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

Closed
@per1234

Description

@per1234

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions