Skip to content

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

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

Open
Aurical opened this issue Jul 5, 2021 · 2 comments
Open

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

Aurical opened this issue Jul 5, 2021 · 2 comments
Labels
topic: code Related to content of the project itself topic: debugger Related to the integrated debugger type: enhancement Proposed improvement

Comments

@Aurical
Copy link

Aurical commented Jul 5, 2021

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.

@Aurical Aurical added the type: enhancement Proposed improvement label Jul 5, 2021
@ubidefeo
Copy link

ubidefeo commented Jul 7, 2021

@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
Copy link
Author

Aurical commented Jul 8, 2021

@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.

@per1234 per1234 added topic: code Related to content of the project itself topic: debugger Related to the integrated debugger labels Oct 25, 2021
@kittaakos kittaakos self-assigned this Nov 25, 2022
@kittaakos kittaakos removed their assignment Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself topic: debugger Related to the integrated debugger type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

4 participants