cancel
Showing results for 
Search instead for 
Did you mean: 

Attach to running STM32 over JTAG with VSCode Extension

Visques
Associate II

How can I attach to a running STM32 target while using its specific JTAG address?

I want to debug on an already-running STM32 without altering its memory state (no reset, no download of new firmware). I currently do this on STM32CubeIDE by setting my debug configuration to "No reset" in the "Debugger" tab and setting "Download" to "false" in the "Startup" tab.

The target STM32 is in a JTAG chain with other devices.

On the VSCode extension: If I select "attach" in "request" the "serverJtagCfg" option becomes invalid. Not entirely sure where to look for this. Any help is appreciated.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Florent V
ST Employee

Hi @Visques,

 

There is a difference between "hot attach" and "request attach.":

Hot attach: The GDB server is launched by the adapter (i.e., at the start of the debug session) with no reset and no download. You need to load the symbols at least to debug, using the attribute "imagesAndSymbols" -> "symbolFileName".
This is the use case you described.

 

Request attach: The GDB server is already running, and you connect to it either remotely or locally.
That’s why only a few server attributes are available in the debug configuration, because the adapter does not manage the server launch.

 

So, for your use case, it is the hot attach. You can set the serverJtagCfg attribute using the request launch:

        {
            "type": "jlinkgdbtarget",
            "request": "launch",
            "name": "STM32Cube: STM32 Launch JLink GDB Server",
            "origin": "snippet",
            "cwd": "${workspaceFolder}",
            "preBuild": "${command:st-stm32-ide-debug-launch.build}",
            "runEntry": "main",
            "serverReset": "None",
            "serverInterface": "JTAG",
            "serverJtagCfg": "9,2",
            "imagesAndSymbols": [
                {
                    "symbolFileName": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}"
                }
            ]
        }

 

NoteI just saw that you already asked this question in our previous thread, my bad, I missed the notification. 

KR,
Flo

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

4 REPLIES 4
Florent V
ST Employee

Hi @Visques,

 

There is a difference between "hot attach" and "request attach.":

Hot attach: The GDB server is launched by the adapter (i.e., at the start of the debug session) with no reset and no download. You need to load the symbols at least to debug, using the attribute "imagesAndSymbols" -> "symbolFileName".
This is the use case you described.

 

Request attach: The GDB server is already running, and you connect to it either remotely or locally.
That’s why only a few server attributes are available in the debug configuration, because the adapter does not manage the server launch.

 

So, for your use case, it is the hot attach. You can set the serverJtagCfg attribute using the request launch:

        {
            "type": "jlinkgdbtarget",
            "request": "launch",
            "name": "STM32Cube: STM32 Launch JLink GDB Server",
            "origin": "snippet",
            "cwd": "${workspaceFolder}",
            "preBuild": "${command:st-stm32-ide-debug-launch.build}",
            "runEntry": "main",
            "serverReset": "None",
            "serverInterface": "JTAG",
            "serverJtagCfg": "9,2",
            "imagesAndSymbols": [
                {
                    "symbolFileName": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}"
                }
            ]
        }

 

NoteI just saw that you already asked this question in our previous thread, my bad, I missed the notification. 

KR,
Flo

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thanks for the quick and detailed response @Florent V . Just to confirm: it is this line the one that prevents reset and download?

"serverReset": "None",

 

This line prevents only the reset.

"serverReset": "None",


Concerning the download it is :

"imagesAndSymbols": [
    {
        "symbolFileName": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}"
    }
]

ImagesAndSymbols is an array of object.
Each object corresponds to a binary. In each object, you can:

  • download the binary thanks to imageFileName (optionally with an offset using imageOffset)
  • load the symbols thanks to symbolsFileName (optionally with an offset using symbolOffset)


Note
:
When using ST-Link or J-Link adapters, you can define only imageFileName; it will automatically load the symbols as well, minimizing redundancy in the debug configuration for users. However, if you set only symbolsFileName, the download will not be performed.

Regards,
Flo

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Excellent, thanks so much @Florent V