AnsweredAssumed Answered

SVC_Handler fails badly - hardfaults

Question asked by r.denis on Sep 6, 2013
Latest reply on Sep 29, 2015 by Clive One
Below is the code for asm SVC handler straight from an example by ARM:

    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.