diff --git a/examples/timing_resources.rs b/examples/timing_resources.rs index dd5abe4296d3c7daae0027843f85d54e99fa1c12..3d89b1456326737fce5e9cee36c40cc8d7952b0a 100644 --- a/examples/timing_resources.rs +++ b/examples/timing_resources.rs @@ -40,9 +40,9 @@ const APP: () = { rtic::pend(stm32f411::Interrupt::EXTI0); asm::bkpt(); cx.resources.shared.lock(|shared| { - // asm::bkpt(); + asm::bkpt(); *shared += 1; - // asm::bkpt(); + asm::bkpt(); }); asm::bkpt(); } @@ -168,6 +168,9 @@ Yes, but very minimal. The only thing that needs to be infered is the changing o // (gdb) x 0xe0001004 // // [Your answer here] +/* +37 cycles +*/ // // You should have a total execution time in the range of 30-40 cycles. // @@ -175,6 +178,9 @@ Yes, but very minimal. The only thing that needs to be infered is the changing o // `exti0` was safe without locking the resource. // // [Your answer here] +/* +It was safe because exti0 had the highest priority of the tasks accessing the resource. +*/ // // In `exti1` we also access `shared` but this time through a lock. // @@ -204,10 +210,16 @@ Yes, but very minimal. The only thing that needs to be infered is the changing o // (gdb) x 0xe0001004 // // [Your answer here] +/* +52 cycles +*/ // // Calculate the total time (in cycles), for this section of code. // // [Your answer here] +/* +52 - 37 = 15 cycles +*/ // // You should get a value around 15 cycles. // @@ -248,6 +260,9 @@ Yes, but very minimal. The only thing that needs to be infered is the changing o // (gdb) x 0xe0001004 // // [Your answer here] +/* +40 cycles +*/ // // (gdb) c // @@ -258,6 +273,9 @@ Yes, but very minimal. The only thing that needs to be infered is the changing o // (gdb) x 0xe0001004 // // [Your answer here] +/* +50 cycles +*/ // // From a real-time perspective the critical section infers // blocking (of higher priority tasks). @@ -265,6 +283,9 @@ Yes, but very minimal. The only thing that needs to be infered is the changing o // How many clock cycles is the blocking? // // [Your answer here] +/* +10 cycles +*/ // // Finally continue out of the closure. // @@ -275,6 +296,9 @@ Yes, but very minimal. The only thing that needs to be infered is the changing o // (gdb) x 0xe0001004 // // [Your answer here] +/* +52 cycles +*/ // // This is the total execution time of: //