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

SCB.ICSR.VECTACTIVE is 9 bits, not 8 #373

Merged
merged 3 commits into from
Dec 31, 2021
Merged

Conversation

TDHolmes
Copy link
Contributor

Closes #332

@TDHolmes TDHolmes requested a review from a team as a code owner December 17, 2021 06:17
@rust-highfive
Copy link

r? @therealprof

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-cortex-m labels Dec 17, 2021
@@ -300,7 +301,7 @@ impl VectActive {
12 => VectActive::Exception(Exception::DebugMonitor),
14 => VectActive::Exception(Exception::PendSV),
15 => VectActive::Exception(Exception::SysTick),
irqn if irqn >= 16 => VectActive::Interrupt { irqn },
irqn if irqn >= 16 && irqn < 512 => VectActive::Interrupt { irqn: irqn - 16 },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the - 16 was added to be consistent with how vect_active does it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that a breaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I think the rest of this PR is too

@@ -170,9 +170,10 @@ impl SCB {
/// Returns the active exception number
#[inline]
pub fn vect_active() -> VectActive {
let icsr = unsafe { ptr::read(&(*SCB::ptr()).icsr as *const _ as *const u32) };
let icsr =
unsafe { ptr::read_volatile(&(*SCB::ptr()).icsr as *const _ as *const u32) } & 0x1FF;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to read_volatile like cortex-m-rt did to prevent optimizations here

@TDHolmes
Copy link
Contributor Author

rebased on top of the asm PR to fix CI

@adamgreig
Copy link
Member

Thanks! I think we can merge this now that master is explicitly for 0.8 development, but could you add a changelog entry, especially highlighting the - 16 change to irq number?

@TDHolmes
Copy link
Contributor Author

whoops, sure! I also added an entry for my change in #367 since I forgot that too.

Copy link
Member

@adamgreig adamgreig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

bors merge

@bors
Copy link
Contributor

bors bot commented Dec 31, 2021

Build succeeded!

And happy new year! 🎉

@bors bors bot merged commit bef6ed1 into rust-embedded:master Dec 31, 2021
@TDHolmes TDHolmes deleted the scb-9-bits branch December 31, 2021 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-cortex-m
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SCB::vect_active() should be 9 bits
5 participants