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

Cortex R5 ARM processor

HI All,

I am trying to use FREE RTOS in cortex R5 dual core MCU.

Initially the MCU is in Supervisor mode. But in main function, i want to be a processor mode will be in system mode(0x1F).

But i do not find any instruction how to switch from supervisor mode(0x13) to system mode(0x1F).

Why we need to switch from supervisor mode to system mode if both are working in privilege mode because for the unitization of the RTOS, scheduler should be in system mode. 

Can any one please tell me how to switch from supervisor mode to system mode.

I have tried to switch but the system will be reset automatically after change in system mode.

 have see the mode in CPSR register.

Thanks and regard 

Pankaj verma

Parents
  • HI Synnott,

    Yes you are right and i have tried below code as per your suggestion.

    It is jump to the supervisor mode to system mode by using below instruction.

    .def _CPU_system_mode_Switch
    .asmFunc
    _CPU_system_mode_Switch


    MOV R1, LR
    MOV R2, SP
    MRS r0, CPSR                     //read cpsr into r0
    orr r0, r0, #0x1f                       //set mode to SYS
    MSR cpsr, r0                           //write r0 back to cpsr
    MOV LR, R1
    MOV SP, R2
    bx lr                                         //return
    .endasmfunc

    Is it correct?

    I will also try your code.

    Can you tell me that, if a application jump to system mode to supervisor mode at any time and vise versa  . It will not effect to running application and RTOS behavior's.

    Thanks for your great help, Have a nice day.

    Pankaj Verma

Reply
  • HI Synnott,

    Yes you are right and i have tried below code as per your suggestion.

    It is jump to the supervisor mode to system mode by using below instruction.

    .def _CPU_system_mode_Switch
    .asmFunc
    _CPU_system_mode_Switch


    MOV R1, LR
    MOV R2, SP
    MRS r0, CPSR                     //read cpsr into r0
    orr r0, r0, #0x1f                       //set mode to SYS
    MSR cpsr, r0                           //write r0 back to cpsr
    MOV LR, R1
    MOV SP, R2
    bx lr                                         //return
    .endasmfunc

    Is it correct?

    I will also try your code.

    Can you tell me that, if a application jump to system mode to supervisor mode at any time and vise versa  . It will not effect to running application and RTOS behavior's.

    Thanks for your great help, Have a nice day.

    Pankaj Verma

Children