Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
e7020e_2019
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Henrik Theolin
e7020e_2019
Commits
16f16fd0
Commit
16f16fd0
authored
6 years ago
by
Henrik Theolin
Browse files
Options
Downloads
Patches
Plain Diff
bare0_3
parent
dbe09940
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/bare0.rs
+5
-5
5 additions, 5 deletions
examples/bare0.rs
with
5 additions
and
5 deletions
examples/bare0.rs
+
5
−
5
View file @
16f16fd0
...
@@ -19,7 +19,7 @@ extern crate panic_halt;
...
@@ -19,7 +19,7 @@ extern crate panic_halt;
use
cortex_m_rt
::
entry
;
use
cortex_m_rt
::
entry
;
// a constant (cannot be changed at run-time)
// a constant (cannot be changed at run-time)
const
X_INIT
:
u32
=
1
0
;
const
X_INIT
:
u32
=
0
xffffffff
;
// global mutabale variables (changed using unsafe code)
// global mutabale variables (changed using unsafe code)
static
mut
X
:
u32
=
X_INIT
;
static
mut
X
:
u32
=
X_INIT
;
...
@@ -31,9 +31,9 @@ fn main() -> ! {
...
@@ -31,9 +31,9 @@ fn main() -> ! {
let
mut
x
=
unsafe
{
X
};
let
mut
x
=
unsafe
{
X
};
loop
{
loop
{
x
+=
1
;
// <- place breakpoint here (3)
x
.wrapping_add
(
1
)
;
// <- place breakpoint here (3)
unsafe
{
unsafe
{
X
+=
1
;
X
.wrapping_add
(
1
)
;
Y
=
X
;
Y
=
X
;
assert!
(
x
==
X
&&
X
==
Y
);
assert!
(
x
==
X
&&
X
==
Y
);
}
}
...
@@ -75,10 +75,10 @@ fn main() -> ! {
...
@@ -75,10 +75,10 @@ fn main() -> ! {
//
//
// Change (both) += opertions to use wrapping_add
// Change (both) += opertions to use wrapping_add
// load and run the progam, what happens
// load and run the progam, what happens
// **
your answer here
**
// **
x value stays at u32 max 4294967295
**
//
//
// Now continue exectution, what happens
// Now continue exectution, what happens
// **
your answer here
**
// **
X,Y and x = 4294967295
**
//
//
// Commit your answers (bare0_3)
// Commit your answers (bare0_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