cortex-m icon indicating copy to clipboard operation
cortex-m copied to clipboard

Fixed VectActive::from() returning incorrect value

Open skibon02 opened this issue 1 year ago • 10 comments

Fixes #499

Fixed VectActive::from(u8) now returns correct value for Interrupt variant Refactored SCB::vect_active() to use VectActive::from(u8) and get rid of code duplication

skibon02 avatar Dec 14 '23 12:12 skibon02

Can you rebase this? The CI failure is from an old MSRV

newAM avatar Dec 14 '23 17:12 newAM

@newAM, Could you please explain a little more? I forked the repo and made this commit from the v0.7.x branch.

skibon02 avatar Dec 14 '23 20:12 skibon02

Oh, sorry, I didn't see that this was targeting v0.7.x! That makes more sense then. The problem is that serde_json isn't pinned, and the latest version requires edition 2021. I think specifying >=1.00,<=1.0.100 for serde_json should fix the build failure.

newAM avatar Dec 14 '23 20:12 newAM

Oh, unwrap_unchecked seems to not be available on rustc version 1.38.0. It forces me to write a reaction to the case, when icsr register returns unexpected value. Is panic appropriate in this case? Or maybe we should execute udf instruction?

Assuming correct implementation for VectActive::from for all cortex-m processors, this problem can only appear when incorrect target was selected by user, and it is impossible to check this in compile time.

skibon02 avatar Dec 15 '23 11:12 skibon02

Adding these ugly lines in Cargo.toml to fix deps versions did help compiling on 1.38

Or should we better just bump MSRV to 1.60?

skibon02 avatar Jan 18 '24 22:01 skibon02

cortex-m-rt says:

This crate is guaranteed to compile on stable Rust 1.59.0 and up

jonathanpallant avatar Jan 19 '24 09:01 jonathanpallant

But this is cortex-m, not cortex-m-rt latest update 0.7.7 was published 1 year ago

From v0.7.x branch Readme: https://github.com/rust-embedded/cortex-m/blob/bb4a78208323260a161e68b2498438867f971bc5/README.md?plain=1#L14

skibon02 avatar Jan 19 '24 09:01 skibon02

But how many people use cortex-m without using cortex-m-rt?

jonathanpallant avatar Jan 19 '24 09:01 jonathanpallant

cortex-m has twice as many downloads compared to cortex-m-rt It seems that there isn't much sense in supporting these old versions of the Rust compiler. Moreover, a significant portion of people even uses Nightly.

Should I bump the MSRV to 1.60 and remove fixed dependency versions?

skibon02 avatar Jan 19 '24 12:01 skibon02

1.59 makes sense, so they are the same.

unwrap_unchecked first appeared in 1.58 so that's fine.

jonathanpallant avatar Jan 19 '24 14:01 jonathanpallant