-
Notifications
You must be signed in to change notification settings - Fork 1
Hangs when OpenOCD isn't connected #1
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
Comments
Yeah, only when a debugger is connected will it not hang. You can luckily check that: https://docs.rs/cortex-m/0.6.2/cortex_m/peripheral/struct.DCB.html#method.is_debugger_attached What you could do is check it just before you want to log to the ITM. If it's false, then don't log. |
I'm not sure this is actually possible in a reliable way across multiple cortex-m devices. See rust-embedded/cortex-m#82 (comment) and the few comments back and forth after it. I'd love to be proved wrong but in my experiments on the bluepill hardware is_debugger_attached and the other registers mentioned in the above issue couldn't reliably determine if it was safe to log or not. |
Haven't used it on the blue pill. But I've worked on the ATSAML4 (SWD with JLink), STM32F4 and the STM32F7 (both SWD with STLink) and it worked reliably there. I'll soon be able to check it for the STM32H7 with JTAG. What can be done is to make a feature gate for it. You can then turn the check on if you know that it works for your setup and leave it off if you know that it doesn't. |
I'll redo my testing around it because based off re-reading the thread it appears if you check debugen and the itm enable registers that should work for all except the m0 which would be a good subset to support the checks on. I had most of the checks implemented in this crate at one point so I don't know why I didn't add the debugen check and be done with it at that time. |
There are some checks to make sure ITM is enabled before attempting to wait on the FIFOs but these aren't sufficient, this still causes the device to hang if OpenOCD hasn't done whatever it does when you first connect it.
The text was updated successfully, but these errors were encountered: