Skip to content
Snippets Groups Projects
Commit 45a6916a authored by Edvin Åkerfeldt's avatar Edvin Åkerfeldt
Browse files

timing_resources, Q1: EXTI0 explanation

parent 03f80b1a
No related branches found
No related tags found
No related merge requests found
......@@ -72,6 +72,26 @@ const APP: () = {
// Explain what is happening here in your own words.
//
// [Your code here]
/*
Tl;dr,
1. Saves privious basepri, and stops at our breakpoint
2. Loads our shared resource from memmory
3. Increment resource by 1 and save it back to memory
4. Changes back basepri to what it was before
5. Branches back to where we were before the exception.
08000232 <EXTI0>:
8000232: 40 f2 00 01 movw r1, #0 // Loads 0 into r1
8000236: ef f3 11 80 mrs r0, basepri // Save the current basepri into r0
800023a: 00 be bkpt #0 // Breakpoint here <-- Our interupt code begins here
800023c: c2 f2 00 01 movt r1, #8192 // Puts 0x2000 into top 16-bits of r1 => 0x20000000 (The location of the shared resource, maybe also the begining of our memory)
8000240: d1 e9 00 23 ldrd r2, r3, [r1]// Equivalent to: ldr r2, [r1]; ldr r3, [r1, #4], ie loads the bottom half of the shared resource into r2 and the top half into r3
8000244: 01 32 adds r2, #1 // Add 1 to r2, update flag (N, Z, C, V ie carry flags etc) <-- Increments our shared resource with 1
8000246: 43 f1 00 03 adc r3, r3, #0 // Add 0 to r3 (with carry) <-- Add the carry if we have carry from last operation
800024a: c1 e9 00 23 strd r2, r3, [r1]// Saves back our shared resource into main memory <-- Our interupt code stops here
800024e: 80 f3 11 88 msr basepri, r0 // Changes the basepri to what it was before
8000252: 70 47 bx lr // Branches back to where we were before
*/
//
// > cargo run --example timing_resources --release --features nightly
// Then continue to the first breakpoint instruction:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment