This:
SP = (uint16_t)(&dummy)
is changing the stack pointer. Not what you want. You want to instead
push
the destination address to the stack. However, rather than
simulating a function return, it should be simpler to perform an
indirect jump:
asm volatile("ijmp" :: "z"(dummy));
Don't forget that your naked ISR has to save all the call-used
registers, as well as SREG
, r0
and r1
, in its custom prologue. And
restore them in its epilogue. Check the AVR calling
conventions.
This:
SP = (uint16_t)(&dummy)
is changing the stack pointer. Not what you want. You want to instead
push
the destination address to the stack. However, rather than
simulating a function return, it should be simpler to perform an
indirect jump:
asm volatile("ijmp" :: "z"(dummy));
Don't forget that your naked ISR has to save all the call-used
registers, as well as SREG
, r0
and r1
, in its custom prologue. And
restore them in its epilogue. Check the AVR calling
conventions.
This:
SP = (uint16_t)(&dummy)
is changing the stack pointer. Not what you want. You want to instead
push
the destination address to the stack. However, rather than
simulating a function return, it should be simpler to perform an
indirect jump:
asm volatile("ijmp" :: "z"(dummy));
Don't forget that your naked ISR has to save all the call-used
registers, as well as SREG
, r0
and r1
, in its custom prologue. And
restore them in its epilogue. Check the AVR calling
conventions.
This:
SP = (uint16_t)(&dummy)
is changing the stack pointer. Not what you want. You want to instead
push
the destination address to the stack. However, rather than
simulating a function return, it should be simpler to perform an
indirect jump:
asm volatile("ijmp" :: "z"(dummy));
Don't forget that your naked ISR has to save all the call-used
registers, as well as SREG
, r0
and r1
, in its custom prologue. And
restore them in its epilogue. Check the AVR calling
conventions.