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
Henrik Theolin
e7020e_2019
Commits
3b4a1cd9
Commit
3b4a1cd9
authored
6 years ago
by
Henrik Theolin
Browse files
Options
Downloads
Patches
Plain Diff
bare1_7
parent
5aad58aa
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/bare1.rs
+36
-5
36 additions, 5 deletions
examples/bare1.rs
with
36 additions
and
5 deletions
examples/bare1.rs
+
36
−
5
View file @
3b4a1cd9
...
...
@@ -16,6 +16,8 @@ use cortex_m_rt::entry;
use
cortex_m
::{
iprintln
,
Peripherals
};
use
cortex_m_semihosting
::
hprintln
;
use
core
::
num
::
Wrapping
;
#[entry]
#[inline(never)]
fn
main
()
->
!
{
...
...
@@ -25,14 +27,15 @@ fn main() -> ! {
//let mut p = Peripherals::take().unwrap();
//let stim = &mut p.ITM.stim[0];
let
mut
_x
=
0
;
let
mut
_x
=
Wrapping
(
0u32
);
let
one
=
Wrapping
(
1u32
);
loop
{
_x
+=
1
;
_x
+=
one
;
cortex_m
::
asm
::
nop
();
//iprintln!(stim, "{}",_x);
//hprintln!("{}", _x).unwrap();
cortex_m
::
asm
::
bkpt
();
_x
-=
1
;
_x
-=
one
;
}
}
...
...
@@ -283,11 +286,39 @@ fn main() -> ! {
//
// What is now the disassembly of the code in dev mode?
//
// ** your answer here **
// **
// Dump of assembler code for function main:
// 0x080004e4 <+0>: sub sp, #8
// 0x080004e6 <+2>: movs r0, #0
// 0x080004e8 <+4>: str r0, [sp, #0]
// 0x080004ea <+6>: movs r0, #1
// 0x080004ec <+8>: str r0, [sp, #4]
// 0x080004ee <+10>: b.n 0x80004f0 <main+12>
// 0x080004f0 <+12>: ldr r1, [sp, #4]
// 0x080004f2 <+14>: mov r0, sp
// 0x080004f4 <+16>: bl 0x8000490 <core::num::wrapping::_$LT$impl$u20$core..ops..arith..AddAssign$u20$for$u20$core..num..Wrapping$LT$u32$GT$$GT$::add_assign::hbb56dbef6bcfa964>
// 0x080004f8 <+20>: b.n 0x80004fa <main+22>
// 0x080004fa <+22>: bl 0x80004e0 <cortex_m::asm::nop::h0ac7b7a3f33f2667>
// 0x080004fe <+26>: b.n 0x8000500 <main+28>
// => 0x08000500 <+28>: bkpt 0x0000
// 0x08000502 <+30>: b.n 0x8000504 <main+32>
// 0x08000504 <+32>: ldr r1, [sp, #4]
// 0x08000506 <+34>: mov r0, sp
// 0x08000508 <+36>: bl 0x80004b8 <core::num::wrapping::_$LT$impl$u20$core..ops..arith..SubAssign$u20$for$u20$core..num..Wrapping$LT$u32$GT$$GT$::sub_assign::hcf06b8f89372a809>
// 0x0800050c <+40>: b.n 0x800050e <main+42>
// 0x0800050e <+42>: b.n 0x80004f0 <main+12>
// End of assembler dump.
// **
//
// What is now the disassembly of the code in release mode?
//
// ** your answer here **
// **
// Dump of assembler code for function main:
// 0x08000400 <+0>: nop
// => 0x08000402 <+2>: bkpt 0x0000
// 0x08000404 <+4>: b.n 0x8000400 <main>
// End of assembler dump.
// **
//
// commit your answers (bare1_7)
//
...
...
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