This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to return from FIQ ISR in assembly?

I am writing an assembly FIQ ISR using GCC complier. I want to change return address in FIQ ISR so that after ISR, it returns to the requested address. the reason for doing that is because i am writing a RTOS.

what are the instruction for ISR return in assembly? is it

 SUBS PC, R14, #4

? i know in 8051, noraml function call return is RET, ISR return is RETI.

Parents
  •  SUBS PC, R14, #4
    


    will cause CPSR to be replaced by SPSR_FIQ

     SUB PC, R14, #4
    


    will cause CPSR to remain the same (not be replaced by SPSR_IRQ)

    an LDM instruction that references the PC will cause CPSR to be replaced by SPSR_FIQ.

    If you are doing a task switch, you definately want to set the CPSR to the correct value, and not what it currently is in the FIQ routine (this usually means that you will need to put into SPSR_FIQ the value that you would like CPSR to be after the return).

Reply
  •  SUBS PC, R14, #4
    


    will cause CPSR to be replaced by SPSR_FIQ

     SUB PC, R14, #4
    


    will cause CPSR to remain the same (not be replaced by SPSR_IRQ)

    an LDM instruction that references the PC will cause CPSR to be replaced by SPSR_FIQ.

    If you are doing a task switch, you definately want to set the CPSR to the correct value, and not what it currently is in the FIQ routine (this usually means that you will need to put into SPSR_FIQ the value that you would like CPSR to be after the return).

Children