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

Extend RTT protocol to report buffer overflows #25

Open
ianrrees opened this issue Feb 21, 2022 · 2 comments
Open

Extend RTT protocol to report buffer overflows #25

ianrrees opened this issue Feb 21, 2022 · 2 comments

Comments

@ianrrees
Copy link

By default, when an "up" RTT buffer in the target is full, writes to that buffer will be skipped (docs). At the debug terminal, this looks just like a gap in output; it's a silent failure which seems a bit bothersome and not very Rusty.

So, I wonder if we could use a bit in RttChannel::flags to indicate that the buffer overflowed? Once that was in place, RTT software on the host would be able to indicate that the target tried to send output but was unable to.

@ianrrees
Copy link
Author

ianrrees commented Feb 25, 2022

probe-rs masks off the two bits of flags that are used for channel mode, for instance here.

I did a quick test with a J-Link and Segger's RTT viewer (so, I presume using the on-probe RTT facilities) and firmware that sets bit 0x4 in flags of an up channel - it didn't seem to cause any issue.

One issue with shoehorning this functionality in to the flags field: the host clearing the overflow flag isn't atomic (or, could it be?), so the host could miss some overflow indications. Maybe that's not a big problem, since at least the first overflow will be reported. Other approaches could be to change the protocol, or add a data structure outside the normal RTT one.

@Yatekii
Copy link
Member

Yatekii commented Feb 25, 2022

Hmm I have thought about extending the protocol even more in the past. Maybe discarding RTT compatibility. We could do so many cool things :) I think RTT, ultimately is very C oriented and thus very limited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants