-
-
Notifications
You must be signed in to change notification settings - Fork 771
Segger RTT Receive #4130
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
Segger RTT Receive #4130
Conversation
004b34f
to
0734b05
Compare
5670dd9
to
048a54b
Compare
config.down_buffer[read_position.get() as usize].get(); | ||
self.rx_cursor.set(self.rx_cursor.get() + 1); | ||
read_position.set((read_position.get() + 1) % config.down_buffer.length); | ||
fence(Ordering::SeqCst); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just trying to reason about why this fence
is required in addition to the one below: I'm assuming that it's to protect against compiler reorderings where the read_position
is updated before the buffer contents were actually read?
In this case, I think the fence
should be moved in between the down_buffer
read, and updating of the cursor / read position.
Then the last fence
after this loop takes care of flushing the final write.
Also, I think this should have a fence
before the initial write_position.get()
in the while-loop conditional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Done
Looks good to me other than the comment on |
Implements the receive path for Segger RTT. Unfortunately, RTT has no mechanism of notifying (e.g. via an interrupt) for the availability of RX data so, instead, when the waiting for outstanding data, the implementation just polls the RTT buffer every 100 milliseconds---fast enough to be unnoticable to a human but infrequent enough to interrupt most computations.
@alevy I think this looks good and I'm happy to merge imminently, but feel free to remove last-call if this is still something you want to address. |
Pull Request Overview
This pull request implements the receive path for Segger RTT. Unfortunately, RTT has no
mechanism of notifying (e.g. via an interrupt) for the availability of
RX data so, instead, when the waiting for outstanding data, the
implementation just polls the RTT buffer every 100 milliseconds---fast
enough to be unnoticeable to a human but infrequent enough to interrupt
most computations.
Testing Strategy
Testing by typing into the the RTT console for the sma_q3 and seeing stuff happen as expected. This is not good comprehensive testing yet.
TODO or Help Wanted
N/A
Documentation Updated
/docs
, or no updates are required.Formatting
make prepush
.