Skip to content

Commit

Permalink
Add support for rust-toolchain file.
Browse files Browse the repository at this point in the history
  • Loading branch information
cr1901 committed Aug 28, 2022
1 parent d7bfddc commit b3957f6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
30 changes: 23 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,25 @@ This project is developed and maintained by the [MSP430 team][team].
- Rust nightly-2022-01-24 or a newer toolchain. _Only nightly compilers work
for now._

You can set up a nightly compiler as the default compiler using
`rustup default nightly`. Alternatively, you can set up overrides on a
project basis using `rustup override set --path /path/to/crate nightly-YYYY-MM-DD`
The [`rust-toolchain.toml`](./rust-toolchain.toml) file makes sure this step
is done for you. This file tells [`rustup`](https://rustup.rs/) to download
and use nightly compiler for this crate, as well as download the compiler
source to build `libcore`.

You can manually set up a nightly compiler as the default for all MSP430
projects by running:

``` console
$ rustup default nightly
$ rustup component add rust-src
```

Alternatively, you can manually set up overrides on a project basis using:

```console
$ rustup override set --path /path/to/crate nightly-YYYY-MM-DD`.
$ rustup component add --toolchain nightly-YYYY-MM-DD rust-src
```

- The `cargo generate` subcommand ([Installation instructions](https://github.com/ashleygwilliams/cargo-generate#installation)).

Expand Down Expand Up @@ -126,12 +142,12 @@ The following dependencies are required in order to generate a peripheral access
$ cargo build --examples
```

Note that due to [`.cargo/config`](.cargo/config), the above is shorthand
for:
Note that due to [`.cargo/config`](.cargo/config) and [`rust-toolchain.toml`](./rust-toolchain.toml),
the above is shorthand for:

``` console
$ cargo build --target=msp430-none-elf -Zbuild-std=core
$ cargo build --target=msp430-none-elf -Zbuild-std=core --examples
$ cargo +nightly build --target=msp430-none-elf -Zbuild-std=core
$ cargo +nightly build --target=msp430-none-elf -Zbuild-std=core --examples
```

You may wish to experiment with other commented options in `.cargo/config`.
Expand Down
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "nightly"
components = [ "rust-src" ]

0 comments on commit b3957f6

Please sign in to comment.