"BX LR" causing INVPC Usage Fault exception

I have implemented a context switching code. For going back to privileged user mode after setting the return value in SP + 0x18 address, I am using BX LR instruction.

But code execution goes to HardFault handler and INVPC bit of USAFAULT register is set.

Following is the status of CPU registers just before executing the BX LR instruction. Address (0x100EFA34) saved at SP+0x18 is a valid address where I want PC to go

Parents Reply Children
No data
More questions in this forum