diff --git a/examples/binds.rs b/examples/binds.rs index db5bd96f1a..601f245a0c 100644 --- a/examples/binds.rs +++ b/examples/binds.rs @@ -34,10 +34,11 @@ mod app { rtic::pend(Interrupt::UART0); - debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator - loop { + // Exit moved after nop to ensure that rtic::pend gets + // to run before exiting cortex_m::asm::nop(); + debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } } diff --git a/examples/extern_binds.rs b/examples/extern_binds.rs index e445f4ecca..c2186cb7fb 100644 --- a/examples/extern_binds.rs +++ b/examples/extern_binds.rs @@ -40,10 +40,11 @@ mod app { rtic::pend(Interrupt::UART0); - debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator - loop { cortex_m::asm::nop(); + // Exit moved after nop to ensure that rtic::pend gets + // to run before exiting + debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } } diff --git a/examples/generics.rs b/examples/generics.rs index f9a6aacfc8..6243d562e8 100644 --- a/examples/generics.rs +++ b/examples/generics.rs @@ -39,6 +39,9 @@ mod app { rtic::pend(Interrupt::UART1); + // Exit moved after nop to ensure that rtic::pend gets + // to run before exiting + cortex_m::asm::nop(); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } diff --git a/examples/hardware.rs b/examples/hardware.rs index 8f29455969..590bf6ab66 100644 --- a/examples/hardware.rs +++ b/examples/hardware.rs @@ -37,10 +37,11 @@ mod app { rtic::pend(Interrupt::UART0); - debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator - loop { + // Exit moved after nop to ensure that rtic::pend gets + // to run before exiting cortex_m::asm::nop(); + debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } }