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…