diff --git a/src/SUMMARY.md b/src/SUMMARY.md index f563654c..b181c87b 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -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) diff --git a/src/android.md b/src/android.md index 82bc767a..505eb9e8 100644 --- a/src/android.md +++ b/src/android.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 diff --git a/src/bare-metal.md b/src/bare-metal.md index a2e45527..7636d6e5 100644 --- a/src/bare-metal.md +++ b/src/bare-metal.md @@ -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: - - - -```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: - - - -```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: - - - -```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. diff --git a/src/bare-metal/setup.md b/src/bare-metal/setup.md new file mode 100644 index 00000000..04298029 --- /dev/null +++ b/src/bare-metal/setup.md @@ -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: + + + +```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: + + + +```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: + + + +```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 +``` diff --git a/src/chromium.md b/src/chromium.md index 442db003..4da37cc5 100644 --- a/src/chromium.md +++ b/src/chromium.md @@ -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. diff --git a/src/concurrency/fearless.md b/src/concurrency/fearless.md new file mode 100644 index 00000000..90919021 --- /dev/null +++ b/src/concurrency/fearless.md @@ -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. + +
+ +- 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. + +
diff --git a/src/concurrency/welcome.md b/src/concurrency/welcome.md index 0a35006d..60d5bb32 100644 --- a/src/concurrency/welcome.md +++ b/src/concurrency/welcome.md @@ -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}} -
+## 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: -
+- [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.