Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
e7020e_2021
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Josef Utbult
e7020e_2021
Commits
a3bf617f
Commit
a3bf617f
authored
4 years ago
by
Josef Utbult
Browse files
Options
Downloads
Patches
Plain Diff
bare4_3
parent
3979185e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/rtic_bare4.rs
+5
-3
5 additions, 3 deletions
examples/rtic_bare4.rs
with
5 additions
and
3 deletions
examples/rtic_bare4.rs
+
5
−
3
View file @
a3bf617f
...
@@ -108,7 +108,7 @@ const APP: () = {
...
@@ -108,7 +108,7 @@ const APP: () = {
// Digging a bit deeper, why do you think `read_volatile` is declared `unsafe`.
// Digging a bit deeper, why do you think `read_volatile` is declared `unsafe`.
// (https://doc.rust-lang.org/core/ptr/fn.read_volatile.html, for some food for thought )
// (https://doc.rust-lang.org/core/ptr/fn.read_volatile.html, for some food for thought )
//
//
// Because you can get undefined behaviour
// Because you can get undefined behaviour
.
//
//
// Commit your answers (bare4_2)
// Commit your answers (bare4_2)
//
//
...
@@ -121,7 +121,7 @@ const APP: () = {
...
@@ -121,7 +121,7 @@ const APP: () = {
//
//
// Why is it important that ordering of volatile operations are ensured by the compiler?
// Why is it important that ordering of volatile operations are ensured by the compiler?
//
//
//
** your answer here **
//
Because you can get race conditions when you have multiple read and writes to the same registers
//
//
// Give an example in the above code, where reordering might make things go horribly wrong
// Give an example in the above code, where reordering might make things go horribly wrong
// (hint, accessing a peripheral not being powered...)
// (hint, accessing a peripheral not being powered...)
...
@@ -131,6 +131,8 @@ const APP: () = {
...
@@ -131,6 +131,8 @@ const APP: () = {
// Without the non-reordering property of `write_volatile/read_volatile` could that happen in theory
// Without the non-reordering property of `write_volatile/read_volatile` could that happen in theory
// (argue from the point of data dependencies).
// (argue from the point of data dependencies).
//
//
// ** your answer here **
// When you have read and write operations to the same register, as in line 62-63 and
// 66-67, there would be a problem if the compiler swapped the operations around, as
// there wouldn't be any data to write if it hasn't been read yet.
//
//
// Commit your answers (bare4_3)
// Commit your answers (bare4_3)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment