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)
|
- [Welcome](bare-metal.md)
|
||||||
|
- [Setup](bare-metal/setup.md)
|
||||||
- [`no_std`](bare-metal/no_std.md)
|
- [`no_std`](bare-metal/no_std.md)
|
||||||
- [A Minimal Example](bare-metal/minimal.md)
|
- [A Minimal Example](bare-metal/minimal.md)
|
||||||
- [`alloc`](bare-metal/alloc.md)
|
- [`alloc`](bare-metal/alloc.md)
|
||||||
@ -356,6 +357,7 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- [Welcome](concurrency/welcome.md)
|
- [Welcome](concurrency/welcome.md)
|
||||||
|
- [Fearless Concurrency](concurrency/fearless.md)
|
||||||
- [Threads](concurrency/threads.md)
|
- [Threads](concurrency/threads.md)
|
||||||
- [Plain Threads](concurrency/threads/plain.md)
|
- [Plain Threads](concurrency/threads/plain.md)
|
||||||
- [Scoped Threads](concurrency/threads/scoped.md)
|
- [Scoped Threads](concurrency/threads/scoped.md)
|
||||||
|
@ -5,9 +5,14 @@ session: Android
|
|||||||
|
|
||||||
# Welcome to Rust in Android
|
# Welcome to Rust in Android
|
||||||
|
|
||||||
Rust is supported for system software on Android. This means that you can write
|
This is a one-day course about Rust in Android: you can write new Android
|
||||||
new services, libraries, drivers or even firmware in Rust (or improve existing
|
platform services, libraries, drivers or even firmware in Rust.
|
||||||
code as needed).
|
|
||||||
|
## 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
|
> 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
|
> 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
|
# Welcome to Bare Metal Rust
|
||||||
|
|
||||||
This is a standalone one-day course about bare-metal Rust, aimed at people who
|
This is a one-day course about bare-metal Rust: running Rust code without an OS
|
||||||
are familiar with the basics of Rust (perhaps from completing the Comprehensive
|
underneath us.
|
||||||
Rust course), and ideally also have some experience with bare-metal programming
|
|
||||||
in some other language such as C.
|
|
||||||
|
|
||||||
Today we will talk about 'bare-metal' Rust: running Rust code without an OS
|
The class is divided into several parts:
|
||||||
underneath us. This will be divided into several parts:
|
|
||||||
|
|
||||||
- What is `no_std` Rust?
|
- What is `no_std` Rust?
|
||||||
- Writing firmware for microcontrollers.
|
- Writing firmware for microcontrollers.
|
||||||
- Writing bootloader / kernel code for application processors.
|
- Writing bootloader / kernel code for application processors.
|
||||||
- Some useful crates for bare-metal Rust development.
|
- Some useful crates for bare-metal Rust development.
|
||||||
|
|
||||||
For the microcontroller part of the course we will use the
|
## Target Audience
|
||||||
[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. On gLinux or Debian:
|
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
|
||||||
<!-- mdbook-xgettext: skip -->
|
experience with bare-metal programming in some other language such as C.
|
||||||
|
|
||||||
```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
|
|
||||||
```
|
|
||||||
|
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
|
> 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
|
> free to follow this recipe in your part of the codebase instead of the exact
|
||||||
> part we talk about.
|
> 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
|
# Welcome to Concurrency in Rust
|
||||||
|
|
||||||
Rust has full support for concurrency using OS threads with mutexes and
|
This is one-day course about concurrency in Rust: structuring your program so it
|
||||||
channels.
|
does multiple things concurrently or in parallel.
|
||||||
|
|
||||||
The Rust type system plays an important role in making many concurrency bugs
|
We will cover two major parts of Rust today:
|
||||||
compile time bugs. This is often referred to as _fearless concurrency_ since you
|
|
||||||
can rely on the compiler to ensure correctness at runtime.
|
- Multi-threaded programming using threads and mutexes.
|
||||||
|
- Concurrent programming using the `async` keyword.
|
||||||
|
|
||||||
## Schedule
|
## Schedule
|
||||||
|
|
||||||
{{%session outline}}
|
{{%session outline}}
|
||||||
|
|
||||||
<details>
|
## Target Audience
|
||||||
|
|
||||||
- Rust lets us access OS concurrency toolkit: threads, sync. primitives, etc.
|
This course builds on [Rust Fundamentals](../welcome-day-1.md). To get the most
|
||||||
- The type system gives us safety for concurrency without any special features.
|
out of the class, we expect that you are familiar with the basics of Rust, as
|
||||||
- The same tools that help with "concurrent" access in a single thread (e.g., a
|
well as concepts such as:
|
||||||
called function that might mutate an argument or save references to it to read
|
|
||||||
later) save us from multi-threading issues.
|
|
||||||
|
|
||||||
</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