Debugging after NVIC_SystemReset

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Debugging after NVIC_SystemReset

3,972 次查看
stefano-quantic
Contributor III

When I perform a software reset using NVIC_SystemReset(), the debugger loses its connection to the MCU.

Even if I then try to start a new connection (with "attach only"), it fails.

So, I cannot debug the application across a reset (e.g. to restart to a custom bootloader).

 

How can I keep the debugger connection active?

As an alternative, how can I force the application to stop immediately after the reset, and reconnect to it, so that I can step-by-step it from the ResetHandler onward?

0 项奖励
回复
5 回复数

3,842 次查看
Miguel04
NXP TechSupport
NXP TechSupport

Hi @stefano-quantic 

It is a normal behaviour that the debugger gets disconnected to the target after a reset.

Please look into this post below, it can help you.

iMXRT1170 evk software reset

Best Regards, Miguel.

0 项奖励
回复

3,824 次查看
stefano-quantic
Contributor III

Hi Miguel,
thanks for the information.
However, I don't see anything in that post that could help me.
Are you suggesting that I should place the NVIC_SystemReset() call in RAM? I don't see how that could help, since the execution would once again start from flash, just as it does now.
Isn't there anything better than manually placing a __BKPT() at the top of the reset handler, and then manually reconnecting the debugger (as "attach-only")?

Should hardware breakpoints survive a reset, or is it correct that they get erased? If they survive, I could also place one at the reset handler, and then reattach manually after the reset; but from my tests this didn't seem to work.

0 项奖励
回复

3,787 次查看
Miguel04
NXP TechSupport
NXP TechSupport

Hi @stefano-quantic 

Sorry for the late reply, I've been looking for a solution for your inquiry.

As I sad before, you will lose the debug session after a reset, however, an alternative is to use a multicore project and debug the main core (for example using the Cortex M7 as target for debugger) and resetting the secondary core. This could help you assuming you don't lose the debug session and you are able to use the secondary core for what you are planning to do after reset.

Best Regards, Miguel.

0 项奖励
回复

3,942 次查看
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hello @stefano-quantic ,

I hope you are doing well.

I have a few queries, Please find them below.
->Which imx evk are you using?
->Please also share the connection of the debugger with it.
->Please share more details on the issue with the console logs.

Thanks & Regards,
Sanket Parekh

0 项奖励
回复

3,916 次查看
stefano-quantic
Contributor III

Hello, I'm using Embedded Artists' "iMX RT1176 Developer’s Kit":
https://www.embeddedartists.com/products/imx-rt1176-developers-kit/
which mounts their "iMX RT1176 uCOM board".

The programmer/debugger is their "MCU-Link Debug Probe":
https://www.nxp.com/design/software/development-software/mcuxpresso-software-and-tools-/mcu-link-deb...

Here are the board's schematics (see the "rev PB3" file in the .zip):
https://www.embeddedartists.com/products/ucom-carrier-board/
The schematics show a standard JTAG/SWD connection.
I'm only using SWD in my MCUXpresso debug configuration.

If I run my test program, I get the following output in the "Debugger Console"
***
Program stopped.
POC_PowerDownNow () at ../source/tests/poc_powerdown.c:239
239 __BKPT(0);

Temporary breakpoint 1, main () at ../source/main_cm7.cpp:192
192 EnableFaults();
Note: automatically using hardware breakpoints for read-only addresses.

Breakpoint 2, POC_Powerdown () at ../source/tests/poc_powerdown.c:490
490 NVIC_SystemReset();
***

I placed a breakpoint on the NVIC_SystemReset() call, and then single stepped through it.
When I single-step over the STR instruction that actually writes SCB->AIRCR, thus triggering the reset, the debugger doesn't stop after the instruction. It shows the MCU as "running", but if I try to pause it with the pause button, nothing happens, except for an error popup saying "Suspend operation timeout".
Then I clicked on "terminate all" (the stop button), and got another error:
***
19: Could not stop execution from running
19: Could not stop execution from running
Wire ACK Fault in DAP access
Debugging context: X5plus_cm4 LinkServer Debug
***

Note that I'm using a dual core project, and the error mentions the CM4 project.
If I just select the CM7 and the click "terminate" (single stop button), then nothing happens, not even an error popup is shown.
Then I manually delete the two debug sessions (in the "Debug" view, I select them and press DEL).

At this point, if I try reconnecting to CM7 using a different debug configuration (with the "Attach only" option selected), then I get 3 error popups:
***
02: Failed on connect
02: Failed on connect
Could not connect to core.
31: No connection to chip's debug port
Debugging context: X5plus_cm7 LinkServer Debug Attach
***
Error in final launch sequence:

Failed to execute MI command:
-target-select extended-remote localhost:10989
Error message from debugger back end:
Remote communication error. Target disconnected.: (undocumented errno 10061).
Failed to execute MI command:
-target-select extended-remote localhost:10989
Error message from debugger back end:
Remote communication error. Target disconnected.: (undocumented errno 10061).
***
30^error,msg="Remote communication error. Target disconnected.: (undocumented error 10061)

***

 

Please let me know if you need more logs, and where to find them exactly.

0 项奖励
回复