Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
e7020e_2020
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
Model registry
Operate
Environments
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
Tom Hammarkvist
e7020e_2020
Commits
161fbc39
Commit
161fbc39
authored
5 years ago
by
Hammarkvast
Browse files
Options
Downloads
Patches
Plain Diff
bare4_3
parent
6013c372
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/bare4.rs
+10
-1
10 additions, 1 deletion
examples/bare4.rs
with
10 additions
and
1 deletion
examples/bare4.rs
+
10
−
1
View file @
161fbc39
...
...
@@ -112,7 +112,7 @@ fn main() -> ! {
//
// ** your answer here **
//
// read_volatile is inherently unsafe because reading a volatile variable is
,
indeed volatile
// read_volatile is inherently unsafe because reading a volatile variable is indeed volatile
.
// A volatile variable is volatile because it moves the value out of the address without
// preventing further usage of that specific address.
//
...
...
@@ -129,14 +129,23 @@ fn main() -> ! {
//
// ** your answer here **
//
// If you did some weird ordering of some important operations, you will more than likely get
// some unexpected behaviour (ex: a LED does not turn on when it should)
//
// Give an example in the above code, where reordering might make things go horribly wrong
// (hint, accessing a peripheral not being powered...)
//
// ** your answer here **
//
// if you swap lets say for example line 63 with line 71, you would most certainly get some unexpected behaviour, since you set the LED to high,
// when you have not set the output to be the GP01A
//
// Without the non-reordering property of `write_volatile/read_volatile` could that happen in theory
// (argue from the point of data dependencies).
//
// ** your answer here **
//
// From a data dependency point of view one could argue that the compiler could see that write and read depends on
// eachother and therefore not reorder them.
//
// 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