Skip to content
Snippets Groups Projects
Commit 6573a9cb authored by Per's avatar Per
Browse files

formatting

parent eafc2c1d
Branches
No related tags found
No related merge requests found
...@@ -66,218 +66,218 @@ We encourage all sorts of collaborations in between the students. Rust is not th ...@@ -66,218 +66,218 @@ We encourage all sorts of collaborations in between the students. Rust is not th
Seminars Seminars
1. Welcome. 1. Welcome.
* Preparation * Preparation
Please bring your laptop, and we will install the Rust tools required in order to compile and run your first application. Please bring your laptop, and we will install the Rust tools required in order to compile and run your first application.
* Topic * Topic
About the course. Scheduling further seminars. Introduction to the Rust [ecosystem](doc/Ecosystem.md), and basics of Rust programming. 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.html) sections
* [1 - Introduction](https://doc.rust-lang.org/book/second-edition/ch01-00-introduction.html),
* [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
* [2 - Guessing Game Tutorial](https://doc.rust-lang.org/book/second-edition/ch02-00-guessing-game-tutorial.html), and * [3 - Common Programming Concepts](https://doc.rust-lang.org/book/second-edition/ch03-00-common-programming-concepts.html).
* [3 - Common Programming Concepts](https://doc.rust-lang.org/book/second-edition/ch03-00-common-programming-concepts.html).
* Assignment 1 * Assignment 1
Extend the guessing game application such to give an error message on ill formated input,(use the Restult::Err type). Add a counter to the number of tries and write the number of tries for each iteration and on "winning". Extend the guessing game application such to give an error message on ill formated input,(use the Restult::Err type). Add a counter to the number of tries and write the number of tries for each iteration and on "winning".
Make a github account (if you don't have it). Make a github project whith your code, along with a README.md for usage instructions. Make a github account (if you don't have it). Make a github project whith your code, along with a README.md for usage instructions.
Prepare to present your development for the next seminar. Prepare to present your development for the next seminar.
2. Basic Programming 2. Basic Programming
* Preparetion * Preparetion
Solve and be prepared to present Assignment 1. Solve and be prepared to present Assignment 1.
* Topic * Topic
Using the Rust ownership model. 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. 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.html) sections
* [4 - Understanding Ownership](https://doc.rust-lang.org/book/second-edition/ch04-00-understanding-ownership.html), * [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), * [5 - Using Structs to Structure Related Data](https://doc.rust-lang.org/book/second-edition/ch05-00-structs.html),
* [6 - Enums and Pattern Matchings](https://doc.rust-lang.org/book/second-edition/ch06-00-enums.html), * [6 - Enums and Pattern Matchings](https://doc.rust-lang.org/book/second-edition/ch06-00-enums.html),
* [7 - Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html), * [7 - Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html),
* [8 - Common Collections](https://doc.rust-lang.org/book/second-edition/ch08-00-common-collections.html), and * [8 - Common Collections](https://doc.rust-lang.org/book/second-edition/ch08-00-common-collections.html), and
* [9 - Error Handling](https://doc.rust-lang.org/book/second-edition/ch09-00-error-handling.html). * [9 - Error Handling](https://doc.rust-lang.org/book/second-edition/ch09-00-error-handling.html).
* Assignment 2 * Assignment 2
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. 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. 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.) 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. 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, "`. 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. Optional, find a way to print the `HashMap` in a sorted way. d. Optional, find a way to print the `HashMap` in a sorted way.
Make three new branches (`2a, 2b, 2c`) whith your code, along with a README.md for usage instructions, and expected behavior. Make three new branches (`2a, 2b, 2c`) whith your code, 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.)* *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.)*
Prepare to present your development for the next seminar. Prepare to present your development for the next seminar.
3. The Rust Memory Model Revisited 3. The Rust Memory Model Revisited
* Preparation * Preparation
Finish Assignment 2. Finish Assignment 2.
* Topic * Topic
In deapth discussion of underlying theory, linear types (relation to functional programming). The *Affine* type system of Rust, requirements on the programmer, and guarantees offered by the compiler. Lifetimes, of stack allocated and global variables. Relation to C++ `unique pointers`. In deapth discussion of underlying theory, linear types (relation to functional programming). The *Affine* type system of Rust, requirements on the programmer, and guarantees offered by the compiler. Lifetimes, of stack allocated and global variables. Relation to C++ `unique pointers`.
* Assignment * Assignment
a. Recall the D0013E course lab2/4, where you decrypted an message in assembler (lab2) and C (lab 4). Now, let's re-implement the lab in Rust (base your development on group number [1's](www.sm.luth.se/csee/courses/smd/D0013E/labs/lab1underlag/grupp_01.lab1_underlag.s ) lab assignment). a. Recall the D0013E course lab2/4, where you decrypted an message in assembler (lab2) and C (lab 4). Now, let's re-implement the lab in Rust (base your development on group number [1's](www.sm.luth.se/csee/courses/smd/D0013E/labs/lab1underlag/grupp_01.lab1_underlag.s ) lab assignment).
You have to be careful about the signed/unsigned operations and use `wrapping` arithmetics to avoid panics due to unsigned *carry* and signed *overflow*. You have to be careful about the signed/unsigned operations and use `wrapping` arithmetics to avoid panics due to unsigned *carry* and signed *overflow*.
Use borrowed array slices as arguments to `decode`. Use borrowed array slices as arguments to `decode`.
The `seed`, `abc`,`coded` and `plain` should be stack allocated. The decoded string should be printed when decryption is finished. The `seed`, `abc`,`coded` and `plain` should be stack allocated. The decoded string should be printed when decryption is finished.
b. Make the `seed`, `abc`,`coded` and `plain` heap allocated. Accessing those will require some `unsafe` code. (Keep the unsafe blocks as local as possible.) b. Make the `seed`, `abc`,`coded` and `plain` heap allocated. Accessing those will require some `unsafe` code. (Keep the unsafe blocks as local as possible.)
c. Safety analysis. Provoke the implementation, by omitting the `'\0'` (null termintation). Observe the result and motivate the behavior in terms of your understanding of the Rust memory model. Under which circumpstances do you consider 3a and 3b to have same/different memory safety. c. Safety analysis. Provoke the implementation, by omitting the `'\0'` (null termintation). Observe the result and motivate the behavior in terms of your understanding of the Rust memory model. Under which circumpstances do you consider 3a and 3b to have same/different memory safety.
Update your git with two new branches (`3a, 3b`), and update docmentation to cover usage and analysis (`3c`). Update your git with two new branches (`3a, 3b`), and update docmentation to cover usage and analysis (`3c`).
4. Cortex-M, are we embedded yet 4. Cortex-M, are we embedded yet
* Prepration * Prepration
Finish assignment 3. Bring a USB mini cable. Finish assignment 3. Bring a USB mini cable.
* Topic * Topic
Embedded programming in Rust. Embedded programming in Rust.
* xargo for building non-`std` (bare metal) systems * xargo for building non-`std` (bare metal) systems
* [cortex-m-quickstart] * [cortex-m-quickstart]
* [cortex-m] * [cortex-m]
* ([bluepill/nucleo] crates) * ([bluepill/nucleo] crates)
* Building and debugging your first application. * Building and debugging your first application.
* Assignment * Assignment
a. Backport assignment `3b` to your choosen target. Use semihosting in order to `write` the resulting string to the host. You may need to use `--release` for decoding the long (`coded`) message, as being deeply recursive unoptimized code may run out of stack memory. a. Backport assignment `3b` to your choosen target. Use semihosting in order to `write` the resulting string to the host. You may need to use `--release` for decoding the long (`coded`) message, as being deeply recursive unoptimized code may run out of stack memory.
b. Discuss from a memory safety perspective the outcome. 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 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 with flash memory wait states). c. Compare for the short message (`abc`), the number of cycles required for `decode` in `--dev` 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 with 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. Make a new git for your embedded development. Make three branches (`3a, 3b, 3c`) with updated documentation according to the above.
5. Advanced Rust Concepts 5. Advanced Rust Concepts
* Prepration * Prepration
Bring a USB mini cable and your dev board. Be prepared to present the progress on assignment 3. Bring a USB mini cable and your dev board. Be prepared to present the progress on assignment 3.
* Topic * Topic
Advanced Rust features, trait system and closures. Advanced Rust features, trait system and closures.
* [10 - Generic Types, Traits, and Lifetimes](https://doc.rust-lang.org/book/second-edition/ch10-00-generics.html), and * [10 - Generic Types, Traits, and Lifetimes](https://doc.rust-lang.org/book/second-edition/ch10-00-generics.html), and
* [13 - Functional Language Features in Rust](https://doc.rust-lang.org/book/second-edition/ch13-00-functional-features.html). * [13 - Functional Language Features in Rust](https://doc.rust-lang.org/book/second-edition/ch13-00-functional-features.html).
* Assignment * Assignment
Continue working on assignment 3. Continue working on assignment 3.
6. Memory Safe Concrreny 6. Memory Safe Concrreny
* Preparation * Preparation
* Finish lab 3 and be prepared to show your solution. * Finish lab 3 and be prepared to show your solution.
* Topic * Topic
* UnsafeCell, and synchronization in the RTFM model. * UnsafeCell, and synchronization in the RTFM model.
* Requirements for Stack Resource Policy (SRP) based single-core scheduling. * Requirements for Stack Resource Policy (SRP) based single-core scheduling.
* [cortex-m-rtfm](https://github.com/japaric/cortex-m-rtfm) The RTFM-core (task and resource model) in Rust for the Cortex-M family * [cortex-m-rtfm](https://github.com/japaric/cortex-m-rtfm) The RTFM-core (task and resource model) in Rust for the Cortex-M family
* [svd2rust](https://github.com/japaric/svd2rust) Generating * [svd2rust](https://github.com/japaric/svd2rust) Generating
* Assignment * Assignment
Implement a simple system with two tasks Implement a simple system with two tasks
* a perodic task executing each 10ms, that blinks the onboard LED, and * a perodic task executing each 10ms, that blinks the onboard LED, and
* usart task receiving commands (pause, start, period) * usart task receiving commands (pause, start, period)
* a shared resource (data structure) protecting the command and period * a shared resource (data structure) protecting the command and period
Make a new git with the development and documentation. Make a new git with the development and documentation.
7. Macros 7. Macros
* Preparation * Preparation
Be prepared to present the progress on assignment 4. Be prepared to present the progress on assignment 4.
* Topic * Topic
We will cover implementation of the RTFM-core crate. We will cover implementation of the RTFM-core crate.
Special focus to `macro_rules` and `procedural macros`. Special focus to `macro_rules` and `procedural macros`.
8. Concurrent Reactive Objects 8. Concurrent Reactive Objects
* Preparation * Preparation
Be prepared to present assignment 4. Be prepared to present assignment 4.
* Topic * Topic
A component model for reactive real-time programming. A component model for reactive real-time programming.
We will cover the programming model and the implementation, including the `build.rs`, parsing of model files and generation of Rust code. We will cover the programming model and the implementation, including the `build.rs`, parsing of model files and generation of Rust code.
* Assignment * Assignment
* port the assignment 4 to the RTFM-CRC model. * port the assignment 4 to the RTFM-CRC model.
Make a new git for the development and documentation. Make a new git for the development and documentation.
9. Presentation of project ideas 9. Presentation of project ideas
* Preparation * Preparation
Be prepared to present progress of assignmont 5. Be prepared to present progress of assignmont 5.
* Topic * Topic
Discussion of projects Discussion of projects
* Assignment * Assignment
Write a project specicification including individual grading assessment critera. Write a project specicification including individual grading assessment critera.
10. Wrapup 10. Wrapup
* Preparation * Preparation
* Be prepared to present assignment 5. * Be prepared to present assignment 5.
* Be prepared to present your project. * Be prepared to present your project.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment