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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
August Svensson
e7020e_2019
Commits
dcf89ebf
Commit
dcf89ebf
authored
6 years ago
by
August Svensson
Browse files
Options
Downloads
Patches
Plain Diff
bare1_1
parent
ee448188
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/bare1.rs
+16
-3
16 additions, 3 deletions
examples/bare1.rs
with
16 additions
and
3 deletions
examples/bare1.rs
+
16
−
3
View file @
dcf89ebf
...
...
@@ -13,6 +13,8 @@
extern
crate
panic_halt
;
use
cortex_m_rt
::
entry
;
use
cortex_m
::{
iprintln
,
Peripherals
};
use
cortex_m_semihosting
::
hprintln
;
#[entry]
#[inline(never)]
...
...
@@ -20,10 +22,15 @@ fn main() -> ! {
// Prepend by `x` by _ to avoid warning (never used).
// The compiler is smart enough to figure out that
// `x` is not used in any meaningful way.
let
mut
_x
=
0
;
let
mut
p
=
Peripherals
::
take
()
.unwrap
();
let
stim
=
&
mut
p
.ITM.stim
[
0
];
loop
{
hprintln!
(
"{}"
,
_x
)
.unwrap
();
_x
+=
1
;
iprintln!
(
stim
,
"{}"
,
_x
);
// cortex_m::asm::nop();
// cortex_m::asm::bkpt();
_x
-=
1
;
...
...
@@ -55,10 +62,16 @@ fn main() -> ! {
// loop, (press pause/suspend to verify this).
// what is the output in the ITM console
//
// ** your answer here **
// * 1
// * 1
// * 1
// * ...
//
// What is the output in the semihosting (openocd) console
// ** your answer here **
// * 0
// * 0
// * 0
// * ...
//
// Commit your answers (bare1_1)
//
...
...
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