Skip to content

Commit 9764121

Browse files
committed
Upgrade of semihosting changed timing
New semihosting 0.5 does not use error handling, returns directly and as semihosting is generally slow this led to missing print statements. Workaround is to add NOP, which seems sufficient to let it flush the buffers
1 parent 050313d commit 9764121

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

examples/binds.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ mod app {
3434

3535
rtic::pend(Interrupt::UART0);
3636

37-
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
38-
3937
loop {
38+
// Exit moved after nop to ensure that rtic::pend gets
39+
// to run before exiting
4040
cortex_m::asm::nop();
41+
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
4142
}
4243
}
4344

examples/extern_binds.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ mod app {
4040

4141
rtic::pend(Interrupt::UART0);
4242

43-
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
44-
4543
loop {
4644
cortex_m::asm::nop();
45+
// Exit moved after nop to ensure that rtic::pend gets
46+
// to run before exiting
47+
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
4748
}
4849
}
4950

examples/generics.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ mod app {
3939

4040
rtic::pend(Interrupt::UART1);
4141

42+
// Exit moved after nop to ensure that rtic::pend gets
43+
// to run before exiting
44+
cortex_m::asm::nop();
4245
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
4346
}
4447

examples/hardware.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ mod app {
3737

3838
rtic::pend(Interrupt::UART0);
3939

40-
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
41-
4240
loop {
41+
// Exit moved after nop to ensure that rtic::pend gets
42+
// to run before exiting
4343
cortex_m::asm::nop();
44+
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
4445
}
4546
}
4647

0 commit comments

Comments
 (0)