probe-rs / rtt-target

Target side implementation of the RTT (Real-Time Transfer) I/O protocol
MIT License
122 stars 30 forks source link

check for debugger and wait for output #23

Closed gauteh closed 2 years ago

gauteh commented 3 years ago

Using RTT with a program that sleeps a lot (wfi) seems to be very laggy and buggy. Maybe there could be a function that checks for debugger and wait for buffer to be flushed? Then I could manually call it before wfi to ensure output is sent.

Haven't checked if defmt-rtt already does this.

https://forum.segger.com/index.php/Thread/6898-SOLVED-RTT-Output-Delayed-by-Deep-Sleep/

mvirkkunen commented 2 years ago

What are you using to view the RTT output? At least probe-rs has had general debugging issues in the past with programs that use wfi. It has been fixed for some chips on the probe-rs side - it's not something that can be reasonably fixed in this library..

gauteh commented 2 years ago

I solve this by using compile flags and defmt flush. I use both probe-rs and defmt-print over jlinkgdbserver. Latter doesn't have issues.

Issue can be closed.

mvirkkunen commented 2 years ago

I don't know about defmt but this library at least does not have a buffer that needs to be flushed. J-Link software does the correct trickery to enable correct debugging with wfi on STM32 chips (assuming you're using that because that's the chip family with problems), so that's probably what fixed it.