How to prevent generation of 'extra' code for ISR
LeonSkoog opened this issue · comments
LeonSkoog commented
Hello,
I'm trying to write simple RTOS and I'm struggling with extra asm code generated by compiler.
I was able to remove trampoline by using #[no_mangle] attribute but I can't figure out how to remove/prevent generation of push {r7, lr}
and pop {r7, pc}
instructions.
Here is my PendSV code:
#[allow(non_snake_case)]
#[no_mangle]
pub fn PendSV() {
unsafe{
asm!("nop")
}
}
Here is generated code:
push {r7, lr}
mov r7, sp
nop
pop {r7, pc}
I'm looking for some sort of attribute or compiler option so I could have just nop
generated as part of PendSV function. Is it possible?
Vadim Kaushan commented
I think you need this: https://github.com/nox/rust-rfcs/blob/master/text/1201-naked-fns.md