We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I'm using the STM32 F407 (Cortex M4), and I am also only using assembly in uVision IDE. So far I have managed to setup a ISR for a pushbutton generated interrupt via GPIO. This all works, I get the ISR handler hit, but after I perform my ISR function how do I return back to thread mode, and set the PC back to last point of execution ?
I have tried doing a straightforward BX LR like the ARM wiki states, (LR is currently set to 0xFFFF FFF9 which is the exception return set by the CPU), I thought when the CPU saw I was trying to set PC to this it would auto handle the transition back to thread, but it goes straight to hard fault handler. Then I tried manually popping off r0,r4 and then pop PC, to set the PC directly to the 5th item on the stack (only main stack is used), this was the previous execution address, but I'm not sure how to change back to thread from handler mode.
So my question is does the CPU handle switching execution back to thread after handler, or do I have to manually unwind the stack, set the PC correctly and change mode back to thread ?
Thanks.