Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

add hprint macros #27

Merged
merged 1 commit into from Nov 4, 2018
Merged

add hprint macros #27

merged 1 commit into from Nov 4, 2018

Conversation

japaric
Copy link
Member

@japaric japaric commented Nov 4, 2018

which are useful when using QEMU

the implementation uses unsafe static mut variables instead of safe static +
interrupt::Mutex to continue supporting Rust 1.30. Mutex's const
constructor requires 1.31; moving to it would be a breaking change.

this PR also prepares a new release

@japaric japaric requested a review from a team as a code owner November 4, 2018 01:06
@thejpster
Copy link

It's unfortunate that the write has to be performed with interrupts disabled. This is OK for now, but I'd be interested in a version that did most of the work outside of the critical section and perhaps stored a raw pointer in at AtomicUsize instead.

@japaric
Copy link
Member Author

japaric commented Nov 4, 2018

bors r+

It's unfortunate that the write has to be performed with interrupts disabled.

What's the motivation for moving the formatting outside the critical section? Each write syscall will halt the microcontroller for tens, if not for a hundred plus, milliseconds. While the microcontroller is halted no interrupt will be processed, the cycle counter will not move forward and some timers will not advance (depending on the contents of the DBG registers). On its own the write syscall is worse than disabling interrupts. I don't see a good reason to make the implementation more complex since any potential benefit is negligible when compared to the cost of the write syscall.

bors bot added a commit that referenced this pull request Nov 4, 2018
27: add hprint macros r=japaric a=japaric

which are useful when using QEMU

the implementation uses unsafe `static mut` variables instead of safe `static` +
`interrupt::Mutex` to continue supporting Rust 1.30. `Mutex`'s const
constructor requires 1.31; moving to it would be a breaking change.

this PR also prepares a new release

Co-authored-by: Jorge Aparicio <jorge@japaric.io>
@bors
Copy link
Contributor

bors bot commented Nov 4, 2018

Build succeeded

@bors bors bot merged commit 7e554f9 into master Nov 4, 2018
@bors bors bot deleted the hprint branch November 4, 2018 18:22
@thejpster
Copy link

thejpster commented Nov 4, 2018

It's unfortunate that the write has to be performed with interrupts disabled.

Each write syscall will halt the microcontroller for tens, if not for a hundred plus, milliseconds.

Ouch. Ok, given that I agree my suggestion makes no sense. I had no idea it was so slow!

@therealprof
Copy link
Contributor

@thejpster It is, the real slowdown depends on the the debugger speed, too. It's somewhere between "barely acceptable" with expensive debuggers down to horror-show with a standard ST-Link. Some even say semihosting is the worst possible form of communicating with the host...

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

Successfully merging this pull request may close these issues.

None yet

3 participants