Question
SVC_Handler fails badly - hardfaults
Posted on September 06, 2013 at 19:20
Below is the code for asm SVC handler straight from an example by ARM:
SVC_Handler STMFD sp!,{r0-r3,r12,lr} ; Store registers. LDR r0,[lr, #4] ; Calculate address of SWI instruction and load it into r0. BIC r0,r0,#0xff000000 ; Mask off top 8 bits of instruction to give SWI number. ; ; Use value in r0 to determine which SWI routine to execute. ; LDMFD sp!, {r0-r12,pc} ; Restore registers and return. END ; Mark end of this file. And i get Hard Fault failure on LDR instruction . wtf.. Any ideas? I've seen same code sequence in many examples of the same SVC handler, and in other code.