mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-23 19:00:13 +02:00
Create setup pages for the one-day classes
This commit is contained in:
parent
a4d80d3ba0
commit
bd270fb110
@ -305,6 +305,7 @@
|
||||
---
|
||||
|
||||
- [Welcome](bare-metal.md)
|
||||
- [Setup](bare-metal/setup.md)
|
||||
- [`no_std`](bare-metal/no_std.md)
|
||||
- [A Minimal Example](bare-metal/minimal.md)
|
||||
- [`alloc`](bare-metal/alloc.md)
|
||||
@ -356,6 +357,7 @@
|
||||
---
|
||||
|
||||
- [Welcome](concurrency/welcome.md)
|
||||
- [Fearless Concurrency](concurrency/fearless.md)
|
||||
- [Threads](concurrency/threads.md)
|
||||
- [Plain Threads](concurrency/threads/plain.md)
|
||||
- [Scoped Threads](concurrency/threads/scoped.md)
|
||||
|
@ -5,9 +5,14 @@ session: Android
|
||||
|
||||
# Welcome to Rust in Android
|
||||
|
||||
Rust is supported for system software on Android. This means that you can write
|
||||
new services, libraries, drivers or even firmware in Rust (or improve existing
|
||||
code as needed).
|
||||
This is a one-day course about Rust in Android: you can write new Android
|
||||
platform services, libraries, drivers or even firmware in Rust.
|
||||
|
||||
## Target Audience
|
||||
|
||||
This course builds on [Rust Fundamentals](welcome-day-1.md) and we expect you
|
||||
are familiar with the basics of Rust. You should also be familiar with
|
||||
development on the Android Platform (AOSP).
|
||||
|
||||
> We will attempt to call Rust from one of your own projects today. So try to
|
||||
> find a little corner of your code base where we can move some lines of code to
|
||||
|
@ -5,57 +5,18 @@ session: Morning
|
||||
|
||||
# Welcome to Bare Metal Rust
|
||||
|
||||
This is a standalone one-day course about bare-metal Rust, aimed at people who
|
||||
are familiar with the basics of Rust (perhaps from completing the Comprehensive
|
||||
Rust course), and ideally also have some experience with bare-metal programming
|
||||
in some other language such as C.
|
||||
This is a one-day course about bare-metal Rust: running Rust code without an OS
|
||||
underneath us.
|
||||
|
||||
Today we will talk about 'bare-metal' Rust: running Rust code without an OS
|
||||
underneath us. This will be divided into several parts:
|
||||
The class is divided into several parts:
|
||||
|
||||
- What is `no_std` Rust?
|
||||
- Writing firmware for microcontrollers.
|
||||
- Writing bootloader / kernel code for application processors.
|
||||
- Some useful crates for bare-metal Rust development.
|
||||
|
||||
For the microcontroller part of the course we will use the
|
||||
[BBC micro:bit](https://microbit.org/) v2 as an example. It's a
|
||||
[development board](https://tech.microbit.org/hardware/) based on the Nordic
|
||||
nRF52833 microcontroller with some LEDs and buttons, an I2C-connected
|
||||
accelerometer and compass, and an on-board SWD debugger.
|
||||
## Target Audience
|
||||
|
||||
To get started, install some tools we'll need later. On gLinux or Debian:
|
||||
|
||||
<!-- mdbook-xgettext: skip -->
|
||||
|
||||
```bash
|
||||
sudo apt install gcc-aarch64-linux-gnu gdb-multiarch libudev-dev picocom pkg-config qemu-system-arm
|
||||
rustup update
|
||||
rustup target add aarch64-unknown-none thumbv7em-none-eabihf
|
||||
rustup component add llvm-tools-preview
|
||||
cargo install cargo-binutils cargo-embed
|
||||
```
|
||||
|
||||
And give users in the `plugdev` group access to the micro:bit programmer:
|
||||
|
||||
<!-- mdbook-xgettext: skip -->
|
||||
|
||||
```bash
|
||||
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="0d28", MODE="0664", GROUP="plugdev"' |\
|
||||
sudo tee /etc/udev/rules.d/50-microbit.rules
|
||||
sudo udevadm control --reload-rules
|
||||
```
|
||||
|
||||
On MacOS:
|
||||
|
||||
<!-- mdbook-xgettext: skip -->
|
||||
|
||||
```bash
|
||||
xcode-select --install
|
||||
brew install gdb picocom qemu
|
||||
brew install --cask gcc-aarch64-embedded
|
||||
rustup update
|
||||
rustup target add aarch64-unknown-none thumbv7em-none-eabihf
|
||||
rustup component add llvm-tools-preview
|
||||
cargo install cargo-binutils cargo-embed
|
||||
```
|
||||
This course builds on [Rust Fundamentals](welcome-day-1.md) and we expect you
|
||||
are familiar with the basics of Rust. You should ideally also have some
|
||||
experience with bare-metal programming in some other language such as C.
|
||||
|
49
src/bare-metal/setup.md
Normal file
49
src/bare-metal/setup.md
Normal file
@ -0,0 +1,49 @@
|
||||
# Setup
|
||||
|
||||
For the microcontroller part of the course we will use the
|
||||
[BBC micro:bit](https://microbit.org/) v2 as an example. It's a
|
||||
[development board](https://tech.microbit.org/hardware/) based on the Nordic
|
||||
nRF52833 microcontroller with some LEDs and buttons, an I2C-connected
|
||||
accelerometer and compass, and an on-board SWD debugger.
|
||||
|
||||
To get started, install some tools we'll need later.
|
||||
|
||||
## Linux
|
||||
|
||||
Please run the following on gLinux or Debian:
|
||||
|
||||
<!-- mdbook-xgettext: skip -->
|
||||
|
||||
```bash
|
||||
sudo apt install gcc-aarch64-linux-gnu gdb-multiarch libudev-dev picocom pkg-config qemu-system-arm
|
||||
rustup update
|
||||
rustup target add aarch64-unknown-none thumbv7em-none-eabihf
|
||||
rustup component add llvm-tools-preview
|
||||
cargo install cargo-binutils cargo-embed
|
||||
```
|
||||
|
||||
And give users in the `plugdev` group access to the micro:bit programmer:
|
||||
|
||||
<!-- mdbook-xgettext: skip -->
|
||||
|
||||
```bash
|
||||
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="0d28", MODE="0664", GROUP="plugdev"' |\
|
||||
sudo tee /etc/udev/rules.d/50-microbit.rules
|
||||
sudo udevadm control --reload-rules
|
||||
```
|
||||
|
||||
## MacOS
|
||||
|
||||
Please run the following on MacOS:
|
||||
|
||||
<!-- mdbook-xgettext: skip -->
|
||||
|
||||
```bash
|
||||
xcode-select --install
|
||||
brew install gdb picocom qemu
|
||||
brew install --cask gcc-aarch64-embedded
|
||||
rustup update
|
||||
rustup target add aarch64-unknown-none thumbv7em-none-eabihf
|
||||
rustup component add llvm-tools-preview
|
||||
cargo install cargo-binutils cargo-embed
|
||||
```
|
@ -12,3 +12,9 @@ code to connect between Rust and existing Chromium C++ code.
|
||||
> a corner of the code where you're displaying a UTF8 string to the user, feel
|
||||
> free to follow this recipe in your part of the codebase instead of the exact
|
||||
> part we talk about.
|
||||
|
||||
## Target Audience
|
||||
|
||||
This course builds on [Rust Fundamentals](welcome-day-1.md) and we expect you
|
||||
are familiar with the basics of Rust. You should also be familiar with Chromium
|
||||
development.
|
||||
|
14
src/concurrency/fearless.md
Normal file
14
src/concurrency/fearless.md
Normal file
@ -0,0 +1,14 @@
|
||||
# Fearless Concurrency
|
||||
|
||||
Rust has great support for concurrency and its powerful type system is able to
|
||||
prevent many concurrency bugs at compile time. This is often referred to as
|
||||
_fearless concurrency_ since you can rely on the compiler to ensure correctness
|
||||
at runtime.
|
||||
|
||||
<details>
|
||||
|
||||
- Rust lets us access OS concurrency primitives such as threads and mutexes.
|
||||
- We will see how the type system gives prevents certain kinds of concurrency
|
||||
bugs when using multiple threads.
|
||||
|
||||
</details>
|
@ -6,23 +6,29 @@ target_minutes: 180
|
||||
|
||||
# Welcome to Concurrency in Rust
|
||||
|
||||
Rust has full support for concurrency using OS threads with mutexes and
|
||||
channels.
|
||||
This is one-day course about concurrency in Rust: structuring your program so it
|
||||
does multiple things concurrently or in parallel.
|
||||
|
||||
The Rust type system plays an important role in making many concurrency bugs
|
||||
compile time bugs. This is often referred to as _fearless concurrency_ since you
|
||||
can rely on the compiler to ensure correctness at runtime.
|
||||
We will cover two major parts of Rust today:
|
||||
|
||||
- Multi-threaded programming using threads and mutexes.
|
||||
- Concurrent programming using the `async` keyword.
|
||||
|
||||
## Schedule
|
||||
|
||||
{{%session outline}}
|
||||
|
||||
<details>
|
||||
## Target Audience
|
||||
|
||||
- Rust lets us access OS concurrency toolkit: threads, sync. primitives, etc.
|
||||
- The type system gives us safety for concurrency without any special features.
|
||||
- The same tools that help with "concurrent" access in a single thread (e.g., a
|
||||
called function that might mutate an argument or save references to it to read
|
||||
later) save us from multi-threading issues.
|
||||
This course builds on [Rust Fundamentals](../welcome-day-1.md). To get the most
|
||||
out of the class, we expect that you are familiar with the basics of Rust, as
|
||||
well as concepts such as:
|
||||
|
||||
</details>
|
||||
- [Borrowing](../borrowing.md): you should understand the difference between
|
||||
shared borrows (`&T`) and exclusive borrows (`&mut T`),
|
||||
- [Generics](../generics.md): we will use a lot of
|
||||
[trait bounds](../generics/trait-bounds.md).
|
||||
- [Closures](../std-traits/closures.md): make sure you understand how closures
|
||||
capture values from their environment.
|
||||
- [`Rc`](../smart-pointers/rc.md): we will use a similar type for shared
|
||||
ownership.
|
||||
|
Loading…
x
Reference in New Issue
Block a user