Skip to content

thumbv8m.base +inline-asm = "error: invalid operand for instruction" #155

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

Closed
japaric opened this issue Jul 11, 2019 · 2 comments
Closed

Comments

@japaric
Copy link
Member

japaric commented Jul 11, 2019

STR

Grab the cortex-m-quickstart template (a version that uses cortex-m v0.6.0) and compile this program:

#[entry]
fn main() -> ! {
    let x = basepri::read();

    loop {}
}

for the thumbv8m.base-none-eabi target but make sure that the "inline-asm" feature of cortex-m has been enabled; you get:

error: <inline asm>:1:10: error: invalid operand for instruction
        mrs r0, BASEPRI
                ^

The BASEPRI register doesn't exist on ARMv8-M devices that don't have the main extension. The register::{basepri,basepri_max,faultmask} APIs should not be exposed for the thumbv8m.base-none-eabi target.

As removing an API is a breaking-change (it breaks libraries; the above error only occurs in applications) I would suggest marking the API as deprecated on the thumbv8m.base-none-eabi target and removing it in the next minor version.

This API should not be removed from the thumbv8m.main-none-eabi* targets (note: main, not base) as it is supported on those devices.

Metadata

$ rustc -V
rustc 1.38.0-nightly (cd2cd4c96 2019-07-10)

I also noted that the thumbv8m.base-none-eabi target is not being tested on Travis and that it doesn't have special handing (cargo:rustc-cfg) in the build.rs so there are may be more errors similar to this one in the crate.

JJJollyjim added a commit to JJJollyjim/cortex-m that referenced this issue Sep 20, 2019
JJJollyjim added a commit to JJJollyjim/cortex-m that referenced this issue Sep 20, 2019
@JJJollyjim
Copy link
Contributor

so there are may be more errors similar to this one in the crate

The crate certainly compiles once I configure out the basepri stuff.

As removing an API is a breaking-change (it breaks libraries...

I can certainly vouch that it breaks rtfm :)

bors bot added a commit that referenced this issue Oct 29, 2019
167: Deprecate basepri/basepri_max on thumbv8m.base r=korken89 a=JJJollyjim

First step in resolving #155

Co-authored-by: Jamie McClymont <[email protected]>
bors bot added a commit that referenced this issue Oct 29, 2019
168: Test thumbv8m.base on Travis CI r=korken89 a=JJJollyjim

This will fail until #155 is resolved

Co-authored-by: Jamie McClymont <[email protected]>
@korken89
Copy link
Contributor

I think this can be closed now, reopen if the issue persists

adamgreig pushed a commit that referenced this issue Jan 12, 2022
155: ci: test on stable r=therealprof a=japaric

now that 1.31 is out

Co-authored-by: Jorge Aparicio <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants