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
Anton
e7020e_2019
Commits
33c5a4ec
Commit
33c5a4ec
authored
6 years ago
by
anttib-5
Browse files
Options
Downloads
Patches
Plain Diff
bare1_2
parent
36c67b6e
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
+33
-82
33 additions, 82 deletions
examples/bare1.rs
with
33 additions
and
82 deletions
examples/bare1.rs
+
33
−
82
View file @
33c5a4ec
...
@@ -24,8 +24,8 @@ fn main() -> ! {
...
@@ -24,8 +24,8 @@ fn main() -> ! {
let
mut
_x
=
0
;
let
mut
_x
=
0
;
loop
{
loop
{
_x
+=
1
;
_x
+=
1
;
cortex_m
::
asm
::
nop
();
//
cortex_m::asm::nop();
cortex_m
::
asm
::
bkpt
();
//
cortex_m::asm::bkpt();
_x
-=
1
;
_x
-=
1
;
}
}
}
}
...
@@ -68,32 +68,37 @@ fn main() -> ! {
...
@@ -68,32 +68,37 @@ fn main() -> ! {
//
//
// What is the output of:
// What is the output of:
// (gdb) disassemble
// (gdb) disassemble
//
//Dump of assembler code for function main:
//Dump of assembler code for function Reset:
// 0x08000400 <+0>: sub sp, #16
// => 0x08000616 <+0>: bl 0x8000686 <DefaultPreInit>
// 0x08000402 <+2>: movs r0, #0
// 0x0800061a <+4>: b.n 0x800061c <Reset+6>
// 0x08000404 <+4>: str r0, [sp, #12]
// 0x0800061c <+6>: movw r0, #0
// 0x08000406 <+6>: b.n 0x8000408 <main+8>
// 0x08000620 <+10>: movt r0, #8192 ; 0x2000
// 0x08000408 <+8>: ldr r0, [sp, #12]
// 0x08000624 <+14>: movw r1, #0
// 0x0800040a <+10>: adds r1, r0, #1
// 0x08000628 <+18>: movt r1, #8192 ; 0x2000
// 0x0800040c <+12>: mov r2, r1
// 0x0800062c <+22>: bl 0x8000688 <r0::zero_bss>
// 0x0800040e <+14>: cmp r1, r0
// 0x08000630 <+26>: b.n 0x8000632 <Reset+28>
// 0x08000410 <+16>: str r2, [sp, #8]
// 0x08000632 <+28>: movw r0, #0
// 0x08000412 <+18>: bvs.n 0x800042c <main+44>
// 0x08000636 <+32>: movt r0, #8192 ; 0x2000
// 0x08000414 <+20>: b.n 0x8000416 <main+22>
// 0x0800063a <+36>: movw r1, #0
// 0x08000416 <+22>: ldr r0, [sp, #8]
// 0x0800063e <+40>: movt r1, #8192 ; 0x2000
// 0x08000418 <+24>: str r0, [sp, #12]
// 0x08000642 <+44>: movw r2, #2580 ; 0xa14
// 0x0800041a <+26>: ldr r1, [sp, #12]
// 0x08000646 <+48>: movt r2, #2048 ; 0x800
// 0x0800041c <+28>: subs r2, r1, #1
// 0x0800064a <+52>: bl 0x80006d0 <r0::init_data>
// 0x0800041e <+30>: cmp r1, #1
// 0x0800064e <+56>: b.n 0x8000650 <Reset+58>
// 0x08000420 <+32>: str r2, [sp, #4]
// 0x08000650 <+58>: movw r0, #60808 ; 0xed88
// 0x08000422 <+34>: bvs.n 0x800043a <main+58>
// 0x08000654 <+62>: movt r0, #57344 ; 0xe000
// 0x08000424 <+36>: b.n 0x8000426 <main+38>
// 0x08000658 <+66>: ldr r1, [r0, #0]
// 0x08000426 <+38>: ldr r0, [sp, #4]
// 0x0800065a <+68>: orr.w r1, r1, #15728640 ; 0xf00000
// 0x08000428 <+40>: str r0, [sp, #12]
// 0x0800065e <+72>: bl 0x800074a <core::ptr::write_volatile>
// => 0x0800042a <+42>: b.n 0x8000408 <main+8>
// 0x08000662 <+76>: b.n 0x8000664 <Reset+78>
// 0x0800042c <+44>: movw r0, #2268 ; 0x8dc
// 0x08000664 <+78>: bl 0x800066a <ResetTrampoline>
// 0x08000430 <+48>: movt r0, #2048 ; 0x800
// 0x08000668 <+82>: udf #254 ; 0xfe
// 0x08000434 <+52>: bl 0x800045c <panic>
// 0x08000438 <+56>: udf #254 ; 0xfe
// 0x0800043a <+58>: movw r0, #2340 ; 0x924
// 0x0800043e <+62>: movt r0, #2048 ; 0x800
// 0x08000442 <+66>: bl 0x800045c <panic>
// 0x08000446 <+70>: udf #254 ; 0xfe
// End of assembler dump.
// End of assembler dump.
//
//
// Commit your answers (bare1_2)
// Commit your answers (bare1_2)
...
@@ -104,32 +109,6 @@ fn main() -> ! {
...
@@ -104,32 +109,6 @@ fn main() -> ! {
// What is the output of:
// What is the output of:
// (gdb) disassemble
// (gdb) disassemble
//
//
//Dump of assembler code for function Reset:
// => 0x0800061e <+0>: bl 0x800068e <DefaultPreInit>
// 0x08000622 <+4>: b.n 0x8000624 <Reset+6>
// 0x08000624 <+6>: movw r0, #0
// 0x08000628 <+10>: movt r0, #8192 ; 0x2000
// 0x0800062c <+14>: movw r1, #0
// 0x08000630 <+18>: movt r1, #8192 ; 0x2000
// 0x08000634 <+22>: bl 0x8000690 <r0::zero_bss>
// 0x08000638 <+26>: b.n 0x800063a <Reset+28>
// 0x0800063a <+28>: movw r0, #0
// 0x0800063e <+32>: movt r0, #8192 ; 0x2000
// 0x08000642 <+36>: movw r1, #0
// 0x08000646 <+40>: movt r1, #8192 ; 0x2000
// 0x0800064a <+44>: movw r2, #2580 ; 0xa14
// 0x0800064e <+48>: movt r2, #2048 ; 0x800
// 0x08000652 <+52>: bl 0x80006d8 <r0::init_data>
// 0x08000656 <+56>: b.n 0x8000658 <Reset+58>
// 0x08000658 <+58>: movw r0, #60808 ; 0xed88
// 0x0800065c <+62>: movt r0, #57344 ; 0xe000
// 0x08000660 <+66>: ldr r1, [r0, #0]
// 0x08000662 <+68>: orr.w r1, r1, #15728640 ; 0xf00000
// 0x08000666 <+72>: bl 0x8000752 <core::ptr::write_volatile>
// 0x0800066a <+76>: b.n 0x800066c <Reset+78>
// 0x0800066c <+78>: bl 0x8000672 <ResetTrampoline>
// 0x08000670 <+82>: udf #254 ; 0xfe
// End of assembler dump.
//
//
// Commit your answers (bare1_3)
// Commit your answers (bare1_3)
//
//
...
@@ -139,32 +118,6 @@ fn main() -> ! {
...
@@ -139,32 +118,6 @@ fn main() -> ! {
// What is the output of:
// What is the output of:
// (gdb) disassemble
// (gdb) disassemble
//
//
// Dump of assembler code for function Reset:
// => 0x08000622 <+0>: bl 0x8000692 <DefaultPreInit>
// 0x08000626 <+4>: b.n 0x8000628 <Reset+6>
// 0x08000628 <+6>: movw r0, #0
// 0x0800062c <+10>: movt r0, #8192 ; 0x2000
// 0x08000630 <+14>: movw r1, #0
// 0x08000634 <+18>: movt r1, #8192 ; 0x2000
// 0x08000638 <+22>: bl 0x8000694 <r0::zero_bss>
// 0x0800063c <+26>: b.n 0x800063e <Reset+28>
// 0x0800063e <+28>: movw r0, #0
// 0x08000642 <+32>: movt r0, #8192 ; 0x2000
// 0x08000646 <+36>: movw r1, #0
// 0x0800064a <+40>: movt r1, #8192 ; 0x2000
// 0x0800064e <+44>: movw r2, #2580 ; 0xa14
// 0x08000652 <+48>: movt r2, #2048 ; 0x800
// 0x08000656 <+52>: bl 0x80006dc <r0::init_data>
// 0x0800065a <+56>: b.n 0x800065c <Reset+58>
// 0x0800065c <+58>: movw r0, #60808 ; 0xed88
// 0x08000660 <+62>: movt r0, #57344 ; 0xe000
// 0x08000664 <+66>: ldr r1, [r0, #0]
// 0x08000666 <+68>: orr.w r1, r1, #15728640 ; 0xf00000
// 0x0800066a <+72>: bl 0x8000756 <core::ptr::write_volatile>
// 0x0800066e <+76>: b.n 0x8000670 <Reset+78>
// 0x08000670 <+78>: bl 0x8000676 <ResetTrampoline>
// 0x08000674 <+82>: udf #254 ; 0xfe
// End of assembler dump.
//
//
// Commit your answers (bare1_4)
// Commit your answers (bare1_4)
//
//
...
@@ -177,8 +130,6 @@ fn main() -> ! {
...
@@ -177,8 +130,6 @@ fn main() -> ! {
// Compare the generated assembly for the loop
// Compare the generated assembly for the loop
// between the dev (unoptimized) and release (optimized) build.
// between the dev (unoptimized) and release (optimized) build.
//
//
// The optimized assembly code is much longer (so long that I could not even copy it)
// It is longer since it executes instructions that the non-optimized does not make
//
//
// commit your answers (bare1_5)
// commit your answers (bare1_5)
//
//
...
...
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