S32K1 attach gdbserver without reset

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K1 attach gdbserver without reset

Jump to solution
2,945 Views
peacefulcarrot
Contributor II

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.

0 Kudos
Reply
1 Solution
2,924 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

View solution in original post

2 Replies
2,925 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

2,920 Views
peacefulcarrot
Contributor II

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!

%3CLINGO-SUB%20id%3D%22lingo-sub-1888731%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K1%20attach%20gdbserver%20without%20reset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1888731%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20attach%20my%20debugger%20(SEGGER%20J-Link)%20to%20a%20running%20target%20to%20debug%20it.%20However%2C%20when%20starting%20the%20gdb%20server%2C%20the%20target%20seems%20to%20reset.%3C%2FP%3E%3CP%3ESteps%20to%20reproduce%20this%20issue%3A%3C%2FP%3E%3CP%3E1.%20Start%20SEGGER%20J-Link%20Remote%20Server%3C%2FP%3E%3CP%3E2.%20Start%20gdb%20server%20(in%20WSL2)%20using%20the%20following%20command%3A%20%60JLinkGDBServerCLExe%20-device%20S32K144W%20-endian%20little%20-if%20SWD%20-speed%20auto%20-noir%20-noLocalhostOnly%20-nologtofile%20-TelnetPort%2019020%20-select%20IP%3D192.168.x.y%20-noreset%20-nohalt%60%3C%2FP%3E%3CP%3EObserver%20behaviour%3A%3C%2FP%3E%3CP%3EWhen%20the%20command%20is%20run%2C%20the%20RESET%20pin%20is%20pulled%20down%20for%20160ms.%20The%20running%20program%20is%20stopped%20(observed%20by%20the%20blinking%20led%20that%20stops).%20After%20~4%20seconds%2C%20the%20gdbserver%20is%20attached%20(%26gt%3B%20%60Connected%20to%20target%60)%20and%20the%20application%20starts%20again%20(led%20blinking).%20However%2C%20the%20application%20was%20reset%2C%20which%20is%20not%20as%20desired.%3C%2FP%3E%3CP%3EAny%20idea%20to%20why%20this%20would%20be%20or%20what%20I%20could%20do%20to%20find%20the%20cause%3F%20The%20reset%20reason%20seems%20to%20be%20SW%20reset.%3C%2FP%3E%3CP%3EThe%20used%20MCU%20is%20a%20S32K144W%20on%20a%20custom%20board.%20Debugging%20etc%20works%20without%20a%20problem%2C%20the%20issue%20I%20am%20having%20is%20just%20that%20I%20cannot%20attach%20to%20a%20running%20target.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1889232%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20S32K1%20attach%20gdbserver%20without%20reset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1889232%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F160001%22%20target%3D%22_blank%22%3E%40danielmartynek%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%3CP%3EUsing%20the%20script%20when%20starting%20the%20gdb%20server%20solved%20the%20problem.%3C%2FP%3E%3CP%3E%60JLinkGDBServerCLExe%20-device%20S32K144W%20-endian%20little%20-if%20SWD%20-speed%20auto%20-noir%20-noLocalhostOnly%20-nologtofile%20-TelnetPort%2019020%20-select%20IP%3D192.168.x.y%20-JLinkScriptFile%20NXP_Kinetis_S32_Attach.JLinkScript%20-nohalt%60%3C%2FP%3E%3CP%3EThank%20you%20very%20much%20and%20have%20a%20nice%20day!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1889185%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20S32K1%20attach%20gdbserver%20without%20reset%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1889185%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHI%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F234079%22%20target%3D%22_blank%22%3E%40peacefulcarrot%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EIt%20is%20necessary%20that%20the%20MCU%20is%20in%20the%20unlocked%20state.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EA%20special%20JLink%20script%20is%20needed%2C%20which%20can%20be%20found%20here%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwiki.segger.com%2FS32Kxxx%23Attach_to_debug_session%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fwiki.segger.com%2FS32Kxxx%23Attach_to_debug_session%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EJLink%20commander%20has%20to%20be%20called%20in%20following%20way%3A%3C%2FP%3E%0A%3CP%3EC%3A%5CProgramme%5CSEGGER%5CJLink%5CJLink.exe%20-JLinkScriptFile%20NXP_Kinetis_S32_Attach.JLinkScript%3C%2FP%3E%0A%3CP%3EThen%2C%20the%20MCU%20is%20not%20reset%2C%20and%20access%20to%20all%20memory%20and%20registers%20is%20possible.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EPlease%20contact%20SEGGER%20support%20if%20you%20have%20any%20questions%2C%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3EDaniel%3C%2FP%3E%3C%2FLINGO-BODY%3E