Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Inline assembly noreturn clobber
I'm writing a bootloader for cortex-m4 and I think I want something like this:
let x = addr;
unsafe{
asm!(
"ldr {tmp}, [{x}, #4]",
"ldr sp, [{x}]",
"blx {tmp}",
x = in(reg) x,
tmp = out(reg) _,
options(noreturn),
);
}
However that is not possible:
error: asm outputs are not allowed with the `noreturn` option
--> src/main.rs:19:13
|
19 | tmp = out(reg) _,
| ^^^^^^^^^^^^^^^^
error: could not compile `bootloader` (bin "bootloader") due to 1 previous error
What would be the correct way to do this?
My current workaround is to add core::hint::unreachable_unchecked()
after the asm block. Is that reasonable?
3 posts - 3 participants
🏷️ rust_feed