mirror of
https://github.com/nkbai/book.git
synced 2026-08-19 09:33:29 +08:00
Grammar and capitalization modifications in intro
Reviewed and modified some sentence structures in the introductory material of the book to improve clarity. Modified title capitalization of some sections to conform to accepted English capitalization norms - as specified by the APA, Chicago, AP, and MLA writing styles. Capitalization checked from the following site, using the default capitalization rules: https://capitalizemytitle.com/
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
**Contact**: [Resources team][team]
|
||||
|
||||
* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.
|
||||
* We are committed to providing a friendly, safe, and welcoming environment for all, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristics.
|
||||
* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all.
|
||||
* Please be kind and courteous. There's no need to be mean or rude.
|
||||
* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Meet your hardware
|
||||
# Meet Your Hardware
|
||||
|
||||
Let's get familiar with the hardware we'll be working with.
|
||||
|
||||
@@ -13,7 +13,7 @@ We'll refer to this board as "F3" throughout this book.
|
||||
What does this board contain?
|
||||
|
||||
- A STM32F303VCT6 microcontroller. This microcontroller has
|
||||
- A single core ARM Cortex-M4F processor with hardware support for single precision floating point
|
||||
- A single-core ARM Cortex-M4F processor with hardware support for single-precision floating point
|
||||
operations and a maximum clock frequency of 72 MHz.
|
||||
|
||||
- 256 KiB of "Flash" memory. (1 KiB = 10**24** bytes)
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
|
||||
> **⚠️: This section was last checked on 2018-09-13**
|
||||
|
||||
# Setting up a development environment
|
||||
# Setting up a Development Environment
|
||||
|
||||
Dealing with microcontrollers involves several tools as we'll be dealing with an architecture
|
||||
different than your laptop's and we'll have to run and debug programs on a *remote* device.
|
||||
Dealing with microcontrollers involves using several different tools as we'll be
|
||||
dealing with an architecture different than your laptop's and we'll have to run
|
||||
and debug programs on a *remote* device.
|
||||
|
||||
<!-- NOTE(japaric) I'm not sure we are going to need the user to download *all* -->
|
||||
<!-- these docs so I'm going to comment out this section. If it turns out we do -->
|
||||
@@ -37,7 +38,7 @@ different than your laptop's and we'll have to run and debug programs on a *remo
|
||||
|
||||
## Tools
|
||||
|
||||
We'll use all the tools listed below. Where a minimum version is not specified, any recent version should work but we have listed the version we have tested.
|
||||
We'll use all the tools listed below. Any recent version should work when a minimum version is not specified, but we have listed the versions we have tested.
|
||||
|
||||
- Rust 1.30, 1.30-beta, nightly-2018-09-13, or a newer toolchain PLUS ARM
|
||||
Cortex-M compilation support.
|
||||
@@ -52,7 +53,7 @@ We'll use all the tools listed below. Where a minimum version is not specified,
|
||||
|
||||
Next, follow OS-agnostic installation instructions for a few of the tools:
|
||||
|
||||
### Rust toolchain
|
||||
### Rust Toolchain
|
||||
|
||||
Install rustup by following the instructions at [https://rustup.rs](https://rustup.rs).
|
||||
|
||||
@@ -71,7 +72,7 @@ $ rustc -V
|
||||
rustc 1.30.0-beta (????????? 2018-09-1?)
|
||||
```
|
||||
|
||||
For bandwidth and disk usage reasons the default installation only supports
|
||||
For bandwidth and disk usage concerns the default installation only supports
|
||||
native compilation. To add cross compilation support for the ARM Cortex-M
|
||||
architecture install the following compilation targets.
|
||||
|
||||
@@ -87,7 +88,7 @@ $ cargo install cargo-binutils
|
||||
$ rustup component add llvm-tools-preview
|
||||
```
|
||||
|
||||
### OS specific instructions
|
||||
### OS-Specific Instructions
|
||||
|
||||
Now follow the instructions specific to the OS you are using:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Introduction
|
||||
|
||||
Welcome to "The Embedded Rust Book", an introductory book about using the Rust
|
||||
Welcome to The Embedded Rust Book: An introductory book about using the Rust
|
||||
Programming Language on "Bare Metal" embedded systems, such as Microcontrollers.
|
||||
|
||||
## Scope
|
||||
@@ -39,22 +39,22 @@ This book assumes the following:
|
||||
* Cross Compilation
|
||||
* Memory Mapped Peripherals
|
||||
* Interrupts
|
||||
* Common interfaces such as I2C, SPI, Serial, and others
|
||||
* Common interfaces such as I2C, SPI, Serial, etc.
|
||||
|
||||
If you are not yet comfortable with Rust, we highly suggest completing the [Rust
|
||||
Book] before attempting to learn with this book.
|
||||
Book] before reading this book.
|
||||
|
||||
[Rust Book]: https://doc.rust-lang.org/book/second-edition
|
||||
|
||||
If you are not yet comfortable with Embedded Systems, we highly suggest checking
|
||||
our [other resources] before attempting to learn with this book.
|
||||
If you are not yet comfortable with embedded systems, we highly suggest checking
|
||||
out our [other resources] before attempting to read this book.
|
||||
|
||||
[other resources]: https://rust-embedded.github.io/bookshelf/
|
||||
|
||||
## How to Use This Book
|
||||
|
||||
This book generally assumes that you’re reading it front-to-back, that is, later
|
||||
chapters build on top of concepts in earlier chapters, and earlier chapters may
|
||||
This book generally assumes that you’re reading it front-to-back. Later
|
||||
chapters build on concepts in earlier chapters, and earlier chapters may
|
||||
not dig into details on a topic, revisiting the topic in a later chapter.
|
||||
|
||||
This book will be using the [STMF3DISCOVERY] development board from
|
||||
@@ -66,14 +66,14 @@ vendors, and often even different between Microcontroller families from the same
|
||||
vendor.
|
||||
|
||||
For this reason, we suggest purchasing the [STMF3DISCOVERY] development board
|
||||
for the purpose of following this book.
|
||||
for the purpose of following the exmaples in this book.
|
||||
|
||||
[STMF3DISCOVERY]: http://www.st.com/en/evaluation-tools/stm32f3discovery.html
|
||||
|
||||
> **HEADS UP** Until the official release of this book, which is planned to
|
||||
> coincide with the 2018 edition release of the Rust Programming Language,
|
||||
> expect the sections of this book to shift quite a bit. We recommend
|
||||
> bookmarking the root of this book instead of any specific section.
|
||||
> expect the sections of this book to change quite a bit. We recommend
|
||||
> bookmarking the root of this book instead of any specific version.
|
||||
|
||||
## Contributing to This Book
|
||||
|
||||
@@ -84,8 +84,8 @@ developed by the [resources team].
|
||||
[resources team]: https://github.com/rust-embedded/wg
|
||||
|
||||
If you have trouble following the instructions in this book or find that some
|
||||
section of the book is not clear enough or hard to follow that's a bug and it
|
||||
should be reported in [the issue tracker] of this book.
|
||||
section of the book is not clear enough or hard to follow then that's a bug and
|
||||
it should be reported in [the issue tracker] of this book.
|
||||
|
||||
[the issue tracker]: https://github.com/rust-lang-nursery/embedded-wg/book/issues
|
||||
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
# A `no_std` Rust Environment
|
||||
|
||||
The term Embedded Programming is used for a wide range of different classes of programming.
|
||||
Ranging from programming 8 Bit MCUs (like [ST72325xx](https://www.st.com/resource/en/datasheet/st72325j6.pdf)) with just a few KB of RAM and ROM, up to systems like
|
||||
the Raspberry Pi ([Model B 3+](https://en.wikipedia.org/wiki/Raspberry_Pi#Specifications)) which has a 32/64-bit 4-core Cortex-A53 @ 1.4 GHz and 1GB of RAM.
|
||||
Different restrictions/limitations will apply when writing code depending on what kind of target and use case you have.
|
||||
Ranging from programming 8-Bit MCUs (like the [ST72325xx](https://www.st.com/resource/en/datasheet/st72325j6.pdf))
|
||||
with just a few KB of RAM and ROM, up to systems like the Raspberry Pi
|
||||
([Model B 3+](https://en.wikipedia.org/wiki/Raspberry_Pi#Specifications)) which has a 32/64-bit
|
||||
4-core Cortex-A53 @ 1.4 GHz and 1GB of RAM. Different restrictions/limitations will apply when writing code
|
||||
depending on what kind of target and use case you have.
|
||||
|
||||
There are two general Embedded Programming classifications:
|
||||
|
||||
## Hosted Environments
|
||||
These kinds of environments feel pretty close to a normal PC environment.
|
||||
These kinds of environments are close to a normal PC environment.
|
||||
What this means is you are provided with a System Interface [E.G. POSIX](https://en.wikipedia.org/wiki/POSIX)
|
||||
that provides you with primitives to interact with various systems, such as file systems, networking, memory management, threads, etc.
|
||||
Standard libraries in turn usually depend on these primitives to implement their functionality.
|
||||
You may also have some sort of sysroot and restrictions on RAM/ROM-usage, and perhaps some
|
||||
special HW or I/Os. Overall it feels like coding in a special-purpose PC environment.
|
||||
special HW or I/Os. Overall it feels like coding on a special-purpose PC environment.
|
||||
|
||||
## Bare Metal Environments
|
||||
In a bare metal environment there will be no high level OS running and hosting our code.
|
||||
In a bare metal environment there will be no high-level OS running and hosting our code.
|
||||
This means there will be no primitives, which means there's also no standard library by default.
|
||||
By marking our code with `no_std` we indicate that our code is capable of running in such an environment.
|
||||
This means the rust [libstd](https://doc.rust-lang.org/std/) and dynamic memory allocation can't be used by such code.
|
||||
@@ -31,10 +33,12 @@ and spawning the main thread before a program's main function is invoked. This r
|
||||
|
||||
## Summary
|
||||
`#![no_std]` is a crate-level attribute that indicates that the crate will link to the core-crate instead of the std-crate.
|
||||
The [libcore](https://doc.rust-lang.org/core/) crate in turn is a platform-agnostic subset of the std crate, that makes no assumptions about the system the program will run on.
|
||||
The [libcore](https://doc.rust-lang.org/core/) crate in turn is a platform-agnostic subset of the std crate
|
||||
which makes no assumptions about the system the program will run on.
|
||||
As such, it provides APIs for language primitives like floats, strings and slices, as well as APIs that expose processor features
|
||||
like atomic operations and SIMD instructions. However it lacks APIs for anything that involves platform integration.
|
||||
Because of these properties no\_std and [libcore](https://doc.rust-lang.org/core/) code can be used for any kind of bootstrapping (stage 0) code like bootloaders, firmware or kernels.
|
||||
Because of these properties no\_std and [libcore](https://doc.rust-lang.org/core/) code can be used for any kind of
|
||||
bootstrapping (stage 0) code like bootloaders, firmware or kernels.
|
||||
|
||||
### Overview
|
||||
|
||||
@@ -47,6 +51,6 @@ Because of these properties no\_std and [libcore](https://doc.rust-lang.org/core
|
||||
| libcore available | ✓ | ✓ |
|
||||
| writing firmware, kernel, or bootloader code | ✓ | ✘ |
|
||||
|
||||
## See also
|
||||
## See Also
|
||||
* [FAQ](https://www.rust-lang.org/en-US/faq.html#does-rust-work-without-the-standard-library)
|
||||
* [RFC-1184](https://github.com/rust-lang/rfcs/blob/master/text/1184-stabilize-no_std.md)
|
||||
|
||||
@@ -7,13 +7,13 @@ This section contains details about the tools we'll be using.
|
||||
Bare metal programs are non-standard (`no_std`) Rust programs that require some
|
||||
fiddling with the linking process to get the memory layout of the program
|
||||
right. All this requires unusual files (like linker scripts) and unusual
|
||||
settings (like linker flags). We have packaged all that for you in a template
|
||||
so that you only need to fill in the blanks like the project name and the
|
||||
settings (like linker flags). We have packaged all that for you in a template
|
||||
so that you only need to fill in the blanks such as the project name and the
|
||||
characteristics of your target hardware.
|
||||
|
||||
Our template is compatible with `cargo-generate`, a Cargo subcommand for
|
||||
creating new Cargo projects from templates, but you can also download the
|
||||
template using `git`, `curl`, `wget` or your web browser
|
||||
Our template is compatible with `cargo-generate`: a Cargo subcommand for
|
||||
creating new Cargo projects from templates. You can also download the
|
||||
template using `git`, `curl`, `wget`, or your web browser.
|
||||
|
||||
## `cargo-binutils`
|
||||
|
||||
@@ -46,4 +46,4 @@ have LEDs to blink on your hardware!
|
||||
|
||||
In general, LLDB works as well as GDB when it comes to debugging but we haven't
|
||||
found an LLDB counterpart to GDB's `load` command, which uploads the program to
|
||||
the target hardware, so today we recommend that you use GDB.
|
||||
the target hardware, so currently we recommend that you use GDB.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Getting started
|
||||
# Getting Started
|
||||
|
||||
> ❌: This section is work in progress. Please refer to
|
||||
> [rust-embedded/book#4](https://github.com/rust-embedded/book/issues/4)
|
||||
|
||||
Reference in New Issue
Block a user