Skip to content
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

How to reset target chip? #10

Open
maxgerhardt opened this issue Mar 16, 2021 · 5 comments
Open

How to reset target chip? #10

maxgerhardt opened this issue Mar 16, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@maxgerhardt
Copy link

From OpenOCD commands like monitor init and monitor reset halt are available to reset (and halt after reset) the chip. (docs).

When I connect to the GDB server opened by this script with avr-gdb (7.3.0) and try that, I however get

> monitor init
Target does not support this command.
>monitor reset
Target does not support this command.

with script output

INFO:root:Reading from address 0x00280A
bytearray(b'\x0c\x06')
0c06
<- $0c06#f9
INFO:root:No event
-> +$m80280a,2#2e
<- +
INFO:root:AVR running state False
80280a
2
80
INFO:root:Reading from address 0x00280A
bytearray(b'\x0c\x06')
0c06
<- $0c06#f9
INFO:root:No event
-> +
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
INFO:root:No event
-> $qRcmd,7265736574#37
<- +
INFO:root:AVR running state False
Rcmd,7265736574
<- $#00
INFO:root:No event
-> +
INFO:root:No event
-> $m80280a,2#2e
<- +
INFO:root:AVR running state False
80280a
2
80

How do I reset the target chip with this GDB server?

@maxgerhardt maxgerhardt changed the title How to reset target chip How to reset target chip? Mar 16, 2021
@stemnic
Copy link
Owner

stemnic commented Mar 17, 2021

This is again something that is just not implemented yet in the rsp server so as #11. Though thanks for sending the command flow, now I know what it needs to handle when I implement it :)

@stemnic stemnic added the bug Something isn't working label Mar 17, 2021
@stemnic
Copy link
Owner

stemnic commented Mar 21, 2021

After having a deeper look it seems like gdb target remote does not expect the target to reset itself while there is a connection in place. As you mentioned monitor reset looks like the overall accepted way of resetting a gdb server connected to a embedded device though that requires the gdb session to be initiated with target remote-extended. It should be easy enough to just implement handling for monitor reset then though I am not sure what more is expected from the rsp server when it is in a remote extended session compared to a normal one

@maxgerhardt
Copy link
Author

maxgerhardt commented Mar 21, 2021

I am not sure what more is expected from the rsp server when it is in a remote extended session compared to a normal one

In fact PlatformIO already uses target remote-extended with this script and debugging works there, normally, see bottom of #11 and here as for what PlatformIO does with GDB.

But I'm in no way a GDB server expert so I can't say for sure if it has more implications. 😅

@stemnic
Copy link
Owner

stemnic commented Mar 21, 2021

I am not sure what more is expected from the rsp server when it is in a remote extended session compared to a normal one

In fact PlatformIO already uses target remote-extended with this script and debugging works there, normally, see bottom of #11 and here as for what PlatformIO does with GDB.

Interesting, then it would not hurt to try :) The debugger interface with pyedbglib should at least have no problem resetting the device as long as the server understands what the gdb client wants. Could be that it works just fine since it is ignoring the commands it does not have a handle for it.

But I'm in no way a GDB server expert so I can't say for sure if it has more implications. 😅

Hehe, would not claim that either 😅 documentation for it is sometimes so lacking that I end up just connecting up gdb and see what commands the sessions sends.

@stemnic
Copy link
Owner

stemnic commented Mar 21, 2021

Note to self:
Docs extended mode and packets
Docs regarding restarting target in remote mode

  • Confirm ! packet works as expected
  • Implement R XX to preform target reset
  • Figure out qRcmd packet parsing and make it able to handle monitor reset and monitor reset halt
  • Investigate if extended mode expects the TCP connection to be reset or kept alive when target resets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants