Skip to content

Support for Cortex-Debug serverArgs and JLink script files #435

Open
@Aurical

Description

@Aurical

Is your feature request related to a problem? Please describe.
I would like to ask is there is a way to pass in Arduino platform.txt relative directories into the Cortex-Debug launch.json serverArgs field. If not, consider this a request for the feature.

When trying to add in debugging support for a 3rd party board, I find that I need to give the JLink gdb server a JLinkscript file for debugging to work properly. This can be achieved by including
"serverArgs": ["-scriptfile", "{pathToFile}\\script.JLinkScript"] in the debug_custom.json file in the sketch directory, which will be included into the launch.json Cortex-Debug config file.
Ideally, the JLinkscript file would be included in the tools or variant directory of the Arduino package for the board, but I have been unable to find a way to pass in the relative file directory from platform.txt into the "serverArgs": [ ] field. Using debug.server.jlink.script={runtime.tools.path}/debug/script.JLinkScript just puts it in the "configFiles": [ ] field instead, which does not work with JLink gdb server.

Describe the solution you'd like
It would be best if debug.server.jlink.script={} can directly cause the IDE to add in "-scriptfile" "{pathToFile}/script.JLinkScript" when invoking JLinkGDBserverCL.exe, with the ability to use platform.txt file path variables for the script file.
An alternative would be a way to add in "serverArgs": [ ] through platform.txt.

Activity

ubidefeo

ubidefeo commented on Jul 7, 2021

@ubidefeo

@Aurical have you tried overriding the automatically generated properties?
We have yet to document this because we'll rework how platforms enable debugging, so it's still very experimental and we officially only enabled it for SAMD.
Essentially you can place a file debug_custom.json in your sketch and it will override any property and add the ones you decide to implement yourself.

As an example check this comment I posted in an old issue
#87 (comment)

Aurical

Aurical commented on Jul 8, 2021

@Aurical
Author

@ubidefeo Yes I have and it works as expected.
However, there is no easy way for the debug_custom.json file to get the Arduino15 folder path directly, thus requiring manual input from the user, and not all users are familiar with where downloaded board packages are located for their system.
It is good to hear that debugging will be reworked, and I hope that script file support for JLinks can be improved, since it is one of the more commonly used debug adaptor hardware.

added
topic: codeRelated to content of the project itself
topic: debuggerRelated to the integrated debugger
on Oct 25, 2021
self-assigned this
on Nov 25, 2022
removed their assignment
on Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftopic: debuggerRelated to the integrated debuggertype: enhancementProposed improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @kittaakos@ubidefeo@per1234@Aurical

        Issue actions

          Support for Cortex-Debug serverArgs and JLink script files · Issue #435 · arduino/arduino-ide