Skip to content

Conversation

@bradjc
Copy link
Contributor

@bradjc bradjc commented Jan 18, 2024

Pull Request Overview

Blocked on #3798

Part of #1654.

We use

#[cfg(all(
    target_arch = "arm",
    target_feature = "v7",
    target_feature = "thumb-mode",
    target_os = "none"
))]

in the cortex-m crate so we can include v7m-specific code in a crate that is also used by v6 arch crates. Using cfgs like this is normally not something we would do, but, since the cfgs are set by the toolchain and not manually by us in tock repo files, it was ok.

The issue is is that target_feature = "v7" is only set on nightly and not stable. So doing this actually added another nightly only feature although we were not either aware of this or we did not write it down.

This removes using target_feature = "v7" by create a new crate for v7m that only v7m platforms will include.

Testing Strategy

travis

TODO or Help Wanted

n/a

This incorporates the changes from #3798 assuming that will be merged as is. Moving code between files is a pain.

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

@bradjc bradjc changed the title Remove target feature Remove nightly-only target_feature Jan 18, 2024
@bradjc bradjc added the blocked Waiting on something, like a different PR or a dependency. label Jan 18, 2024
@bradjc bradjc force-pushed the remove-target_feature branch from 85840b6 to de40abb Compare January 26, 2024 21:32
The _v7m functions were cfg gated with `target_feature="v7"`, which only
works on nightly. To move to stable we need to remove these. Instead we
move them to their own crate where they can be included only on v7m
platforms.
Since v7m cannot compile with target=v6, we need to move the v7m asm to
its own crate.
@bradjc bradjc force-pushed the remove-target_feature branch from de40abb to 434a80e Compare January 30, 2024 03:24
@bradjc bradjc removed the blocked Waiting on something, like a different PR or a dependency. label Jan 30, 2024
@bradjc
Copy link
Contributor Author

bradjc commented Jan 30, 2024

This is rebased and ready to go.

I only copied the functions from one file to another without any changes.

Comment on lines +1 to +2
Cortex-M v7m Architecture
=========================
Copy link
Member

Choose a reason for hiding this comment

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

Thoughts on adding the cortex-v7m crate (copied over from Slack):

Upsides:

  • It removes a nightly feature
  • It's consequential, given that we have a common cortex-m crate and a cortex-m0 crate, which contains v6m assembly already
  • (I'm biased, but) I think the cortexm::CortexMVariant encapsulates these arch differences very nicely across crates, without involving guesswork as to what the linker's gonna stick together

Downsides:

  • Yet another crate
  • Increases compilation time slightly

I'm in favor, esp. given we want to compile on stable.

Copy link
Member

@lschuermann lschuermann left a comment

Choose a reason for hiding this comment

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

I trust that the assembly has been copied over verbatim and doesn't warrant another review. 😄

Copy link
Member

@ppannuto ppannuto left a comment

Choose a reason for hiding this comment

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

This is a good change.

Really, we should get rid of all of the arch/cortex-*; they are not ARM arch's.. v6m, v7m, v7me, etc are. I strongly suspect blame for this falls to me however, for not really understanding things that well in 2015 :/.

@ppannuto ppannuto added this pull request to the merge queue Feb 2, 2024
Merged via the queue into master with commit 78de276 Feb 2, 2024
@ppannuto ppannuto deleted the remove-target_feature branch February 2, 2024 17:27
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

Successfully merging this pull request may close these issues.

4 participants