Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upEmbedded development on stable #42
Comments
japaric
added
the
upstream
label
Feb 21, 2018
This comment has been minimized.
This comment has been minimized.
|
Does anyone have experience with Unicorn, which has what looks to be a fairly solid Rust binding in unicorn-rs? It wouldn't be able to test peripheral-dependent crates without someone mocking the peripherals themselves, but could it be useful for testing Rust codegen and linking for other no-std libs? |
This comment has been minimized.
This comment has been minimized.
|
As I was writing the embedonomicon (cf. #59) I explored the possibility of making embedded no-std The conclusion of my exploration was that there are only three unstable features that prevent us
(*) There's a stable workaround for the unstable The question is whether we want to push for having this form -- take a close look to the linked Making this stable will not only mean dealing with these 3 unstable features but also with making Thoughts? cc @hannobraun @jamesmunns @jcsoo @thejpster |
This comment has been minimized.
This comment has been minimized.
|
Just wanted to say, I read through this and it's excellent. Great work! Can't wait to apply some of these changes to stellaris-launchpad. |
This comment has been minimized.
This comment has been minimized.
pftbest
commented
Mar 24, 2018
|
I have ported this repository for MSP430. (link) There are a couple of things that I learned in the process:
|
This comment has been minimized.
This comment has been minimized.
|
@pftbest Yeah, |
This comment has been minimized.
This comment has been minimized.
pftbest
commented
Mar 24, 2018
This comment has been minimized.
This comment has been minimized.
|
@pftbest Yeah, that's using |
japaric
added this to the 2018 edition milestone
Apr 3, 2018
This comment has been minimized.
This comment has been minimized.
|
Some updates after Rust All Hands:
We'll be producing rust-std components for ARM Cortex-M and MSP430, and eventually for AVR and RISCV once they are more mature. Once those components are in place you'll be able to use Cargo, instead of Xargo, for embedded development by first doing Tracking issue: rust-lang/rust#49382 PR for building rust-std for ARM Cortex-M: rust-lang/rust#49563
We'll open a RFC to stabilize some assembly operations as "Rust intrinsics" that live in core. See #63 for details.
Has been proposed for stabilization in rust-lang/rust#24111 (comment)
We discussed the binary size problem (see #41). We decided that we'll go ahead and land the accepted RFC (2070), and that we'll fix the binary size problem in the future using pure MIR rlibs (not yet implemented).
We discussed merging the A PR implementing this has been submitted: rust-lang/rust#49503
I have submitted an RFC proposing the stabilization of this experimental feature: rust-lang/rfcs#2386 |
This comment has been minimized.
This comment has been minimized.
This is done. See PSA: You no longer need Xargo to do ARM Cortex-M development.
This is done. Thanks @oli-obk! See PSA: [breaking-change] |
This comment has been minimized.
This comment has been minimized.
|
I had totally forgotten about unstable compiler flags. The most used unstable flag is
I think the way forward here is to ask for I thought it might be possible to get away with not having to stabilize that flag and still be able Is there any other unstable compiler flag that comes often in embedded development? |
This comment has been minimized.
This comment has been minimized.
Actually that seems to be the default. I tried changing it to ld.lld initially but that failed, simply removing |
This comment has been minimized.
This comment has been minimized.
$ rustc -Z unstable-options --target thumbv7m-none-eabi --print target-spec-json | grep link
"linker": "arm-none-eabi-gcc",
"linker-flavor": "gcc",You need both |
This comment has been minimized.
This comment has been minimized.
|
@japaric Interesting. At least that explains why I was seeing a difference between no
I wrongly assumed it would be using |
This comment has been minimized.
This comment has been minimized.
|
Update: We now have a preview of embedded Rust on stable at rust-embedded/cortex-m-quickstart#29. The preview only requires a single unstable feature: Quite a few pieces need to land before you can try out this using crates.io releases but we would greatly appreciate if you could try the quickstart PR now and let us know what you think (please comment in the quickstart PR). In particular we would love your input on these unresolved questions. |
This comment has been minimized.
This comment has been minimized.
|
I have open a PR to stabilize |
Emilgardis
referenced this issue
May 7, 2018
Merged
Emit unions for overlapping/overloaded registers #192
This comment has been minimized.
This comment has been minimized.
This landed 2 weeks ago.
Check out the announcement! You may experience some (planned) breakage. Once that feature is stabilized |
This comment has been minimized.
This comment has been minimized.
|
Update: |
japaric
added
the
Blocks Rust 2018
label
Jul 16, 2018
japaric
modified the milestones:
2018 edition,
Preview 2
Jul 17, 2018
japaric
modified the milestones:
Preview 2,
RC1
Aug 2, 2018
This comment has been minimized.
This comment has been minimized.
|
As the only thing left to do here is rust-lang/rust#44489 I'm going to close this in favor of that upstream issue, which I have assigned to the RC1 milestone. |
japaric commentedFeb 21, 2018
•
edited
Triage(2018-07-15): This is only waiting on #[panic_implementation] being stabilized. Proposal for FCP.
Development of
no_stdapplications is relegated to the nightly channel because it requires optinginto several unstable features. This makes Rust hard to sell to C developers; they'd rather stick to
their stable vendor provided toolchains instead of having to deal with constant breakage /
regressions.
It may not be possible to stabilize all the features needed for application development this year,
but the following unstable features are widely used in library development and it might be possible
to stabilize them this year:
Xargo.rust-std components for embedded targets.Once those are in place you'll be able to use Cargo as you normally would by first doing
rustup target add thumbv7m-none-eabi.Tracking issue rust-lang/rust#49382
Xargo requires the nightly channel to build the core crate / std facade. Having that functionalityin stable Cargo would make Xargo unnecessary.
The Cargo team said they'll work on this this year.I wrote how to land the functionality in Cargo.We'll RFC "Stable assembly operations" instead of stabilizingasm!asm!. See #63 for detailsA pre-rfc on this topic is being discussed.Upstream tracking issue rust-lang/rust#29722const fnHas been proposed for stabilization in rust-lang/rust#24111 (comment)The old const evaluator is going to be replaced with miri (cf. rust-lang/rust#46882). This fixes a
bunch of bugs and removes several restrictions the old const eval had. It's more likely this feature
will be stabilized once miri is in place.
Upstream tracking issue rust-lang/rust#24111
panic_fmt#[panic_implementation]If we want to support the use case of linking a Rust library into a C program then setting a
no_stdpanic handler must be possible on stable.An RFC on this topic has been accepted (tracking issue rust-lang/rust#44489) and part of the
implementation has landed in rust-lang/rust#47687
If we want to be able to build pure Rust no-std applications then a lot of other unstable features
are needed. It's unclear whether we can stabilize any of them this year.
compiler_builtins_lib#![no_std]expansion will include a stableextern crate compiler_builtinsso you won't require opting into thecompiler_builtins_libfeature gateA PR implementing this has been submitted: rust-lang/rust#49503
Ideally these builtins should be shipped with core and it shouldn't be necessary to explicitly linkto the
compiler-builtinscrate.Can be worked around using unmangled symbols at the cost of not supporting the standardstartandterminationlang itemsmaininterface. See stable-embedded-rust for an example.These are required to support the standardmainfunction interface.Can be worked around by usinglinkage(weak)PROVIDEin a linker script. See stable-embedded-rust for an example.Used to define a weak interrupt table with a default catch all handler while still allowing the user
to override any handler in the table.
Weak aliases can be implemented usingglobal_asm!PROVIDEin a linker script. See stable-embedded-rust for an example.Used to implement weak aliases; a feature which is not supported in the language.
#[used]Used to force the compiler to preserve some "unused" symbols that are required at link time (like
the interrupt table).
Tracking issue: rust-lang/rust#40289
RFC for stabilization: rust-lang/rfcs#2386
There's other aspect to stability here and that's the lack of CI testing for no-std targets in
rust-lang/rust. The consequence of this is that changes unrelated to unstable features can break
these targets. This happened twice last year: changes in the
corecrate related to atomics brokethe
thumbv6m-none-eabitarget.This issue can be addressed by having no-std targets being tested as part of CI testing. As we don't
want to block rust-lang/rust development on codegen / LLVM bugs it should be possible to easily
disable testing on these no-std targets; a mechanism for this is already in place for tooling like
clippy and miri. Here we should define how much testing we want to do: just building core (simpler),
or also testing that linking no-std applications works (more involved as it requires several
unstable features).
#52 tracks testing embedded targets in rust-lang/rust CI.
cc @pftbest