Hi,
I am trying to attach my debugger (SEGGER J-Link) to a running target to debug it. However, when starting the gdb server, the target seems to reset.
Steps to reproduce this issue:
1. Start SEGGER J-Link Remote Server
2. Start gdb server (in WSL2) using the following command: `JLinkGDBServerCLExe -device S32K144W -endian little -if SWD -speed auto -noir -noLocalhostOnly -nologtofile -TelnetPort 19020 -select IP=192.168.x.y -noreset -nohalt`
Observer behaviour:
When the command is run, the RESET pin is pulled down for 160ms. The running program is stopped (observed by the blinking led that stops). After ~4 seconds, the gdbserver is attached (> `Connected to target`) and the application starts again (led blinking). However, the application was reset, which is not as desired.
Any idea to why this would be or what I could do to find the cause? The reset reason seems to be SW reset.
The used MCU is a S32K144W on a custom board. Debugging etc works without a problem, the issue I am having is just that I cannot attach to a running target.
Hi @danielmartynek ,
Using the script when starting the gdb server solved the problem.
`JLinkGDBServerCLExe -device S32K144W -endian little -if SWD -speed auto -noir -noLocalhostOnly -nologtofile -TelnetPort 19020 -select IP=192.168.x.y -JLinkScriptFile NXP_Kinetis_S32_Attach.JLinkScript -nohalt`
Thank you very much and have a nice day!
HI @peacefulcarrot,
It is necessary that the MCU is in the unlocked state.
A special JLink script is needed, which can be found here:
https://wiki.segger.com/S32Kxxx#Attach_to_debug_session
JLink commander has to be called in following way:
C:\Programme\SEGGER\JLink\JLink.exe -JLinkScriptFile NXP_Kinetis_S32_Attach.JLinkScript
Then, the MCU is not reset, and access to all memory and registers is possible.
Please contact SEGGER support if you have any questions,
Regards,
Daniel