-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
Clean up defmt-semihosting. #945
Conversation
* Removed the static mut * Switched to the semihosting crate, for Cortex-R support
Deploying knurling-defmt-book with
|
Latest commit: |
9f6aae5
|
Status: | ✅ Deploy successful! |
Preview URL: | https://aa23ca1f.knurling-defmt-book.pages.dev |
Branch Preview URL: | https://semihosting-updates.knurling-defmt-book.pages.dev |
cc @driveraid |
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.
lgtm, just two questions
// safety: Must be paired with corresponding call to release(), see below | ||
let restore = unsafe { critical_section::acquire() }; | ||
|
||
if TAKEN.load(Ordering::Relaxed) { | ||
// NB: You can re-enter critical sections but we need to make sure |
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.
What does NB
stand for? non-blocking?
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.
|
||
// safety: accessing the `static mut` is OK because we have acquired a critical section. | ||
unsafe { CS_RESTORE = restore }; | ||
unsafe impl Sync for SemihostingEncoder {} |
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.
Why does SemihostingEncoder
need to be marked as Sync
?
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.
Because it's used in a static
variable.
Closes: #942