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

[RFC] [breaking-change] don't depend on GCC by default #107

Closed
japaric opened this issue Aug 20, 2018 · 3 comments
Closed

[RFC] [breaking-change] don't depend on GCC by default #107

japaric opened this issue Aug 20, 2018 · 3 comments

Comments

@japaric
Copy link
Member

japaric commented Aug 20, 2018

It's very likely that the thumb targets will soon switch to rust-lld as their default linker (see
rust-embedded/wg#160). If we want to achieve the goal of not depending on GCC, by default, to
build Cortex-M applications then we also have to make core crates like this one not depend on GCC by
default. This RFC is exactly about that.

I propose that in the next minor (breaking) release, v0.6.0, we tweak the meaning of the existing
"asm" Cargo feature and that we add a new Cargo feature named "inline-asm". The relationship between
these two features would be as follows:

  • If "asm" is disabled the cortex_m::asm module will not be present. The crate will not depend
    on GCC and will compile on stable / beta in this case. The state of the "inline-asm" feature will
    be ignored in this scenario.

  • If "asm" is enabled and "inline-asm" is disabled then the cortex_m::asm module will be
    present and it will be implemented using external assembly files. The crate will depend on GCC
    and will compile on stable / beta in this scenario.

  • If "asm" is enabled and "inline-asm" is also enabled then the cortex_m::asm module will be
    present and it will be implemented using inline assembly (i.e. asm!). In this scenario, the
    crate will depend on GCC and will require a nightly compiler to build.

Extensions

When the Cortex-M API in core::arch::arm becomes stabilized we'll expose a subset of the
cortex_m::asm module (see #101) in the scenario where the "asm" feature is disabled. Remember
that when this feature is disabled the crate will not depend on GCC or on a nightly compiler.

Alternatives

  • We could emit a compiler error (see compile_error!) when both "asm" and "inline-asm" are enabled.

Unresolved questions

  • Should the "inline-asm" feature, instead, be named "nightly"?

cc @rust-embedded/cortex-m @hannobraun @crawford

@japaric japaric added this to the RC1 milestone Aug 20, 2018
@hannobraun
Copy link
Member

Sounds like a great plan!

I'm fine with this as it stands, but I have a suggestion that might make this a bit clearer:

  • Call the features asm-gcc and asm-nightly to make it clear what they provide and how they provide it.
  • Allow either asm-gcc or asm-nightly or none of them. Emit a compiler error, if both are activated, as suggested under Alternatives.

@japaric
Copy link
Member Author

japaric commented Aug 21, 2018

One thing I forgot to include in my original text is that this also affects the cortex_m::register module as those functions also use assembly right now.

bors bot added a commit to rust-embedded/cortex-m-rt that referenced this issue Aug 26, 2018
95: [RFC] remove build dependency on arm-none-eabi-gcc (binary blob alternative) r=japaric a=japaric

Before this commit we used gcc to assemble external assembly files into object
files that we linked into our Rust program.

This commit drops the dependency on gcc by shipping the already assembled object
files with this crate source code.

---

This is an alternative to RFC #91 that doesn't require a breaking change or
adding a new Cargo feature and can be implemented right now.

See #91 for the rationale of dropping the dependency on gcc.

This approach can be applied to other Cortex-M crates like cortex-m-semihosting
and cortex-m (would subsume RFC rust-embedded/cortex-m#107).

This seems like an overall better approach to me, but before I go opening more
PRs I want to hear your thoughts, @rust-embedded/cortex-m

closes #91

Co-authored-by: Jorge Aparicio <jorge@japaric.io>
@japaric
Copy link
Member Author

japaric commented Aug 27, 2018

PR #108 made this RFC irrelevant. Closing.

@japaric japaric closed this as completed Aug 27, 2018
adamgreig pushed a commit that referenced this issue Jan 12, 2022
95: [RFC] remove build dependency on arm-none-eabi-gcc (binary blob alternative) r=japaric a=japaric

Before this commit we used gcc to assemble external assembly files into object
files that we linked into our Rust program.

This commit drops the dependency on gcc by shipping the already assembled object
files with this crate source code.

---

This is an alternative to RFC #91 that doesn't require a breaking change or
adding a new Cargo feature and can be implemented right now.

See #91 for the rationale of dropping the dependency on gcc.

This approach can be applied to other Cortex-M crates like cortex-m-semihosting
and cortex-m (would subsume RFC #107).

This seems like an overall better approach to me, but before I go opening more
PRs I want to hear your thoughts, @rust-embedded/cortex-m

closes #91

Co-authored-by: Jorge Aparicio <jorge@japaric.io>
adamgreig pushed a commit that referenced this issue Jan 12, 2022
107: Disable default-features on rand dependency to avoid std version r=japaric a=therealprof

Due to the single dependency tree, the attempted use of a std version
flips all depending crates to the std version as well which will not
compile on no_std systems.

Fixes #105

Signed-off-by: Daniel Egger <daniel@eggers-club.de>

Co-authored-by: Daniel Egger <daniel@eggers-club.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants