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

Clean up defmt-semihosting. #945

Merged
merged 2 commits into from
Mar 7, 2025
Merged

Clean up defmt-semihosting. #945

merged 2 commits into from
Mar 7, 2025

Conversation

jonathanpallant
Copy link
Contributor

  • Removed the static mut
  • Switched to the semihosting crate, for Cortex-R support

Closes: #942

* Removed the static mut
* Switched to the semihosting crate, for Cortex-R support
Copy link

cloudflare-workers-and-pages bot commented Mar 5, 2025

Deploying knurling-defmt-book with  Cloudflare Pages  Cloudflare Pages

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

View logs

@jonathanpallant
Copy link
Contributor Author

cc @driveraid

@jonathanpallant jonathanpallant added the breaking change fix / feature / improvement involves a breaking change and needs to wait until next minor version label Mar 5, 2025
Copy link
Member

@Urhengulas Urhengulas left a 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
Copy link
Member

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?

Copy link
Contributor Author

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 {}
Copy link
Member

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?

Copy link
Contributor Author

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.

@jonathanpallant jonathanpallant added this pull request to the merge queue Mar 7, 2025
Merged via the queue into main with commit 2e40ad4 Mar 7, 2025
25 of 26 checks passed
@jonathanpallant jonathanpallant deleted the semihosting-updates branch March 7, 2025 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change fix / feature / improvement involves a breaking change and needs to wait until next minor version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update defmt-semihosting
2 participants