This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Test of CPU compare module



Hello, I'm trying to test the CPU compare module.

I want to run its self-test and propagate a error from it to the ESM.

I'm stucked in getting in privileged mode to write in the CCMKEYR register.

I've tried to write it inside a Interruption to test if it is the privileged mode, but keeps reading zero.

I'm missing something ? There is a way to get in supervisor mode ?

Thanks,

Cristiano

  • Hello Cristiano,

    You can use the SuperVisor Call  (SVC) instruction (formerly SWI) to enter Supervisor mode,

    Please be aware that the use of SWI is deprecated on the v7R architecture (Cortex-R4(f)). It should be replaced by the SVC instruction in any code.

     To be able to cover both cases, following code snippet can be used:

    SUPERVISOR SERVICE ROUTINE
    svc:    STMFD       sp!, {r0-r12,lr}        ; Save registers on stack
             LDRB         r0, [lr,#-1]         ; Load the SVC-# into R0
    -----
    -----
    -----
             LDMFD   sp!, {r0-r12,pc}^   ; Restore registers and return
     
     
    Also by default out of reset you will be in supervisor mode
    - Hari

  • Hello Cristiano,

    Can you verify the answer so that i can close the post