diff --git a/examples/rtt_timing.rs b/examples/rtt_timing.rs index 9fe4aa61092a1c3e9207297fb67f9f9ec80324e1..ba33bee1af817613a203f1d78a14a3df3178f2cd 100644 --- a/examples/rtt_timing.rs +++ b/examples/rtt_timing.rs @@ -55,12 +55,12 @@ fn timed_loop() -> (u32, u32) { // > cargo run --example rtt_timing // // [Your answer here] -// 2987 +// 4790152 cycles // // A.2) How many cycles per iteration? // // [Your answer here] -// 4790152 +// 479.0152 cycles // // A.3) Why do we need a wrapping subtraction? // @@ -75,17 +75,17 @@ fn timed_loop() -> (u32, u32) { // start 30305915, end 30375916, diff 70001 // // [Your answer here] -// 30305915 +// 70001 cycles // // B.2) How many cycles per iteration? // // [Your answer here] -// 70001 +// 7.0001 cycles // // What is the speedup (A/B)? // // [Your answer here] -// 4790152 / 70001 = 68.4297652891 +// 479.0152 / 7.0001 = 68.4297652891 // // // Why do you think it differs that much? @@ -124,17 +124,17 @@ fn timed_loop() -> (u32, u32) { // start 1356808538, end 1356848539, diff 40001 // // [Your answer here] -// 1356808538 +// 40001 cycles // // C.2) How many cycles per iteration? // // [Your answer here] -// 40001 +// 4.0001 cycles // // What is the speedup (A/C)? // // [Your answer here] -// 4790152 / 40001 = 119.75080623 +// 479.0152 / 4.0001 = 119.75080623 // // ------------------------------------------------------------------------ // D) Now lets have a closer look at the generated assembly. @@ -223,7 +223,7 @@ fn timed_loop() -> (u32, u32) { // https://developer.arm.com/documentation/ddi0439/b/Data-Watchpoint-and-Trace-Unit/DWT-Programmers-Model // // [Your answer here] -// No, there is no function call. The two following line loads in the loaction of the cycle count, +// No, there is no function call. The two following line loads in the location of the cycle count, // which is always updated. Thus r1 holds the location of the cycle counter. // 0x08000232 <+0>: movw r1, #4100 ; 0x1004 // 0x0800023a <+8>: movt r1, #57344 ; 0xe000 @@ -300,7 +300,7 @@ fn timed_loop() -> (u32, u32) { // By how much does the cycle counter increase for each iteration? // // [Your answer here] -// 4 +// 4 cycles // // ------------------------------------------------------------------------ // F) Reseting the cycle counter @@ -337,7 +337,7 @@ fn timed_loop() -> (u32, u32) { // (when hitting the `timed_loop` breakpoint)? // // [Your answer here] -// 0x00000009 +// 0x00000009 = 9 cycles // // ------------------------------------------------------------------------ // G) Finally some statics