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::vect_active() should be 9 bits #332

Closed
Dirbaio opened this issue Feb 14, 2021 · 2 comments · Fixed by #373
Closed

SCB::vect_active() should be 9 bits #332

Dirbaio opened this issue Feb 14, 2021 · 2 comments · Fixed by #373

Comments

@Dirbaio
Copy link
Member

Dirbaio commented Feb 14, 2021

Currently vect_active() returns the irq number as a u8, but the SCB.ICSR.VECTACTIVE field is 9 (or more?) bits. This means that the interrupt numbers will wrap on chips with a lot of interrupts.

@adamgreig
Copy link
Member

Yep, 9 bits. On cortex-m4 and -m7 the maximum number of interrupts is 240, which I expect is where this bug originally came from, but on -m33 it's allowed to be up to 480, which would definitely cause issues. This is basically what motivated removing bare_metal::Nr in favour of traits per architecture platform, and cortex_m::InterruptNumber being a u16... unfortunately this got missed, and since it's a breaking change it will have to wait for 0.8 I guess.

@Dirbaio Dirbaio changed the title SCB::vect_active() should be 9? bits SCB::vect_active() should be 9 bits Feb 25, 2021
@jamesmunns
Copy link
Member

Could we add a new method that takes a U16 without removing the u8 one? That way we can support new targets, and just switch over the U16 one to be an alias for the future 8->16 upgraded method?

TDHolmes added a commit to TDHolmes/cortex-m that referenced this issue Dec 17, 2021
TDHolmes added a commit to TDHolmes/cortex-m that referenced this issue Dec 19, 2021
bors bot added a commit that referenced this issue Dec 31, 2021
373: `SCB.ICSR.VECTACTIVE` is 9 bits, not 8 r=adamgreig a=TDHolmes

Closes #332

Co-authored-by: Tyler Holmes <tyler@holmesengineering.com>
@bors bors bot closed this as completed in a2d8f6d Dec 31, 2021
adamgreig pushed a commit that referenced this issue Jan 12, 2022
332: Fix links in CHANGELOG.md r=adamgreig a=mattico



Co-authored-by: Matt Ickstadt <mattico8@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants