Skip to content
Snippets Groups Projects
Commit 7aa9f040 authored by Henrik Tjäder's avatar Henrik Tjäder
Browse files

Merge branch 'master' into 'master'

# Conflicts:
#   README.md
parents 4a5c9c7a 77a2d150
Branches
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ Disclaimer: This document is in beta state!!!!! Just to give a hint how the cour
The course will be given as a self study course with a set of introductional seminars and accompanying mandatory assignments, followed by a larger assignment (project). The project can be carried out individually or in groups depending on size. Grading will be individual, based on agreed requirements between the student and the teacher, showing understanding and abilities regarding:
1. The Rust ecosystem.
1. The Rust ecosystem. [ecosystem](doc/Ecosystem.md)
Rustup (stable vs nightly), crates and toml files, cargo, rustc, llvm, gdb/lldb (and additional tooling rls, rustfmt, racer, xargo etc.) The Rust core and standard library. Building, debugging/testing, documenting and publishing Rust applications and libraries.
......@@ -75,7 +75,7 @@ Seminars
About the course. Scheduling further seminars. Introduction to the Rust [ecosystem](doc/Ecosystem.md), and basics of Rust programming.
We will cover the Rust book [Rustbook Second Edition](https://doc.rust-lang.org/book/second-edition.html) sections
We will cover the Rust book [Rustbook Second Edition](https://doc.rust-lang.org/book/second-edition/) sections
* [1 - Introduction](https://doc.rust-lang.org/book/second-edition/ch01-00-introduction.html),
* [2 - Guessing Game Tutorial](https://doc.rust-lang.org/book/second-edition/ch02-00-guessing-game-tutorial.html), and
......@@ -102,7 +102,7 @@ Seminars
Using the Rust ownership model.
Data structures, structs, enums, String (relation to slices) etc. Containers, Vec, and HashSets/Maps. Iterators. Using the Rust module system. Handling errors.
We will cover the Rust book [Rustbook Second Edition](https://doc.rust-lang.org/book/second-edition.html) sections
We will cover the Rust book [Rustbook Second Edition](https://doc.rust-lang.org/book/second-edition/) sections
* [4 - Understanding Ownership](https://doc.rust-lang.org/book/second-edition/ch04-00-understanding-ownership.html),
* [5 - Using Structs to Structure Related Data](https://doc.rust-lang.org/book/second-edition/ch05-00-structs.html),
......@@ -114,16 +114,19 @@ Seminars
* [9 - Error Handling](https://doc.rust-lang.org/book/second-edition/ch09-00-error-handling.html).
* Assignment 2
a. Break out the line input into a function returning a `Result<Ok<u32>>, Err<String>>`. In case of a parsing error prepend the `Err<String>` with the text `"in parsing u32, "`.
a. Extend the guessing game with a tuple holding `(u32, String)`, store each input `(counter, guess)` in a vector. Iterate (`for`) to print the history at exiting.
b. Extend the guessing game with a tuple holding `(u32, String)`, store each input `(counter, guess)` in a vector. Iterate (`for`) to print the history at exiting. You may solve this in many ways (perhaps your first attempt would be a C like approach), however make use of `Iterator`s in Rust (they will do the indexing for you).
b. Instead of vector use a 'HashMap', with a key `u32` and a value `String`. Again iterate (`for`) to print the history at exiting. (Explain the result.)
c. Change the program so that it prints the history twice.
c. Break out the line input into a function returning a `Result<Ok<u32>>, Err<String>>`. In case of a parsing error prepend the `Err<String>` with the text `"in parsing u32, "`.
d. Change the program so that it prints only the last 3 entries in backwards order (the last entry first). If winning with less than 3 entries, print all (still in backwards order). Use iterators (not C-like indexing).
d. Optional, find a way to print the `HashMap` in a sorted way.
e. Instead of vector use a 'HashMap', with a key `u32` and a value `String`. Again iterate (`for`) to print all entries at exiting. (Explain the result.)
Make three new branches (`2a, 2b, 2c`) with your code, along with a README.md for usage instructions, and expected behavior.
f. Optional, find a way to print the last 3 entries of the `HashMap` (output similar to d).
Make new branches (`2a, 2b, ..., 2f`) with your solutions, along with a README.md for usage instructions, and expected behavior.
*During development you may want to limit the number of tries so you can test without having to bother with answering correctly (the game gets boring after a while.)*
......@@ -163,7 +166,7 @@ Seminars
* xargo for building non-`std` (bare metal) systems
* [cortex-m-quickstart]
* [cortex-m]
* ([bluepill/nucleo] crates)
* [bluepill/nucleo] crates
* Building and debugging your first application.
* Assignment
......@@ -172,7 +175,8 @@ Seminars
b. Discuss from a memory safety perspective the outcome.
c. Compare for the short message (`abc`), the number of cycles required for `decode` in `--dev` vs. `--release`. As a comparison, my straightforward C implementation took 2200 cycles in best optimized mode using `gcc` (-o3), while my (translation) to Rust code took 1780 cycles. (Both executed on a bluepill board at 8MHz with flash memory wait states).
c. Compare for the short message (`abc`), the number of cycles required for `decode` in debug (standard) vs. `--release`. As a comparison my straightforword C implementation took 2200 cycles in best optimized mode using `gcc` (-o3), while my (transation) to Rust code took 1780 cycles. (Both executed on a bluepill board at 8MHz without (flash) memory wait states).
Make a new git for your embedded development. Make three branches (`3a, 3b, 3c`) with updated documentation according to the above.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment