Skip to content

Commit f42b1b2

Browse files
bors[bot]flip111
andcommitted
Merge #133 #135
133: Update no-std.md r=korken89 a=flip111 * There is no high level OS this means there are no primitives <-- this is wrong because there can be primitives without high level OS otherwise it wouldn't be a "primitive" * Using jargon "bare metal" without explaining it * By marking our code with `no_std` we indicate that our code is capable of running in such an environment. <-- this wording makes it so that using `no_std` is the only requirement of having runnable code. * Dynamic memory allocation can not be used --> not true, use crate (like described lower in the text) 135: Update install.md r=korken89 a=flip111 `For bandwidth and disk usage concerns the default installation only supports native compilation.` I like what the default installation is doing, not downloading toolchains i don't need. Let's do the same for the book. At the same time, because the reader is just getting into embedded for rust, it's cool to see which toolchains for which CPU cores are already available. This gives a good feeling of control (which toolchain i can choose) and possibilities (many to choose from) Co-authored-by: flip111 <flip101@gmail.com>
3 parents bca9927 + f5467ac + 21712a3 commit f42b1b2

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

src/intro/install.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,27 @@ rustc 1.31.1 (b6c32da9b 2018-12-18)
1616

1717
For bandwidth and disk usage concerns the default installation only supports
1818
native compilation. To add cross compilation support for the ARM Cortex-M
19-
architecture install the following compilation targets.
19+
architecture choose one of the following compilation targets. Use the last one
20+
for the STM32F3DISCOVERY board and follow along with the book.
2021

22+
Cortex M0 M0+
2123
``` console
22-
$ rustup target add thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabi thumbv7em-none-eabihf
24+
$ rustup target add thumbv6m-none-eabi
25+
```
26+
27+
Cortex M3
28+
``` console
29+
$ rustup target add thumbv7m-none-eabi
30+
```
31+
32+
Cortex M4 M7 without FPU
33+
``` console
34+
$ rustup target add thumbv7em-none-eabi
35+
```
36+
37+
Cortex M4 M7 with FPU <-- STM32F3DISCOVERY
38+
``` console
39+
$ rustup target add thumbv7em-none-eabihf
2340
```
2441

2542
### `cargo-binutils`

src/intro/no-std.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ You may also have some sort of sysroot and restrictions on RAM/ROM-usage, and pe
1818
special HW or I/Os. Overall it feels like coding on a special-purpose PC environment.
1919

2020
## Bare Metal Environments
21-
In a bare metal environment there will be no high-level OS running and hosting our code.
22-
This means there will be no primitives, which means there's also no standard library by default.
23-
By marking our code with `no_std` we indicate that our code is capable of running in such an environment.
24-
This means the rust [libstd](https://doc.rust-lang.org/std/) and dynamic memory allocation can't be used by such code.
25-
However, such code can use [libcore](https://doc.rust-lang.org/core/), which can easily be made available
26-
in any kind of environment by providing just a few symbols (for details see [libcore](https://doc.rust-lang.org/core/)).
21+
In a bare metal environment no code has been loaded before your program.
22+
Without the software provided by an OS we can not load the standard library.
23+
Instead the program, along with the crates it uses, can only use the hardware (bare metal) to run.
24+
To prevent rust from loading the standard library use `no_std`.
25+
The platform-agnostic parts of the standard library are available through [libcore](https://doc.rust-lang.org/core/).
26+
libcore also excludes things which are not always desirable in an embedded environment.
27+
One of these things is a memory allocator for dynamic memory allocation.
28+
If you require this or any other functionalities there are often crates which provide these.
2729

2830
### The libstd Runtime
2931
As mentioned before using [libstd](https://doc.rust-lang.org/std/) requires some sort of system integration, but this is not only because

0 commit comments

Comments
 (0)