Skip to content

cortex-m v0.7.8 breaks crates that re-export basepri and basepri_max if those crates are compiled for non-ARM targets #680

Description

@datdenkikniet

In RTIC, we run (effectively) the following test:

cargo test -p rtic --features thumbv7-backend --target host-tuple

in this setup, rtic uses basepri and basepri_max from cortex-m, i.e. it contains (effectively)

#[cfg(feature = "thumbv7-backend")]
use cortex_m::register::{basepri, basepri_max};

somewhere in the compiled code.

However, in the latest release, those two modules have (correctly) been feature gated to only exist for armv7m and armv8m_main. Adam Greig mentioned that compiling for non-cortex-m platforms was actually a goal, so I figured I'd open an issue to indicate that this doesn't really work directly.

The fix (as far as I can tell) is to change the #[cfg(any(armv7m, armv8m_main))] on those modules (and perhaps others?) to #[cfg(any(armv7m, armv8m_main, native))]. The actually-platform-dependent items within those modules are already feature gated the same way.

We can, of course, work around this with similar cfgs in RTIC, but I wanted to post this here in case cortex-m would be up for fixing it. I can absolutely create a PR, this issue is mostly for discussing whether we actually want this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions