-
Notifications
You must be signed in to change notification settings - Fork 319
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
Disable the DM when OpenOCD exits. #256
Conversation
Is this a specific command that one calls when wanting to quit OpenOCD quits, or does this get called any time OpenOCD quits? Is there a way to quit OpenOCD without doing this? Like, if I want to leave a hart halted and quit and restart OpenOCD, is that impossible? |
I believe this always happens when OpenOCD exits (short of eg. |
Also, it's not correct that "this is all we need to do to restore the hart to the state it was in
|
"Do you need this behavior to be controlled by a config option?" Not sure, need to think about it... it has provided some utility in the past that one session of OpenOCD can halt a hart and a later session can notice it being halted. This is a little bit tied up with #211, since OpenOCD can crash in that case but it might be nice to leave the hart halted, or something. |
This is all getting a lot more complicated than I'd initially assumed. I'm tempted to punt on this until it causes problems for somebody, or there's nothing important to be done. |
Might a better solution be to just provide a way to clear dmactive from cfg script? I guess that's not that general.
|
That would be awkward to make work, since OpenOCD continuously tries to poll the target status, which is no longer possible when dmactive is cleared. A config option that controls what happens when OpenOCD shuts down makes more sense to me. |
That makes sense to me too. The default could be to clear dmactive when OpenOCD quits, but we could turn it to "don't clear dmactive when OpenOCD quits" in the cfg script. I think that would cover my use cases. Questionable whether you would also want to resume harts, restore registers with some level of control, it seems like that should be more the user's responsibility. That sort of thing is more likely to fail if the system is in a bad place when OpenOCD quits anyway. |
Is there any plan for this change to be merged and if not why not? |
There's no clear plan. This was original prompted by #200, which simply asks a question and doesn't describe desired behavior, or give a rationale. This change is just kind of lingering right now. |
Thanks. |
It's not obvious to me. What undesirable consequence is there to leaving dmactive high when the debugger disconnects? I can't think of a real problem either way. |
We have a case where a customer wants the ability to enter/leave debug halt "out of band" using a gpio rather than the debug module. But this out of band mechanism also needs to know when the debug module is active (e.g. OpenOCD is connected). At the moment it can't know this as OpenOCD asserts dmactive on first connect and it stays asserted until reset even though once OpenOCD has disconnected the debug module is NOT active. |
In the discussion above I think we agreed on a config option (default is to deassert dmactive when you quit)? Makes sense to me, but I don't think it's the top of my priority list. |
@mwachs5 I believe that harts will stay halted even if dmactive goes low. Is that not true? If it is true, does this need to be an option? |
Right, Harts would stay halted when dmactive goes low. Do you mean does THAT also need to be an option, or clearing dmactive at all? |
The point is, dmactive could be used to gate a lot of things, like perhaps debugged Harts only THINK they get powered down, and so on. So I agree with Tommy this is what OpenOCD should do probably by default, but maybe we want an option to not do it for some reason |
On reflection maybe deasserting dmactive in deinit_target() is not always the right thing to do? |
gdb/OpenOCD already remove all the breakpoints when exiting, so I think this is all we need to do to restore the hart to the state it was in before connecting. Issue #200. Change-Id: Ibcde7a3b68d221dd2718b8b51dfc7946350a8fcb
Inactive |
gdb/OpenOCD already remove all the breakpoints when exiting, so I think
this is all we need to do to restore the hart to the state it was in
before connecting.
Issue #200.
Change-Id: Ibcde7a3b68d221dd2718b8b51dfc7946350a8fcb