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.

TMS570LC4357: User Mode

Part Number: TMS570LC4357


Hello,

We are trying to separate between safety/time critical tasks and those that not. To do that we are executing the safety/time critical tasks in the processor privileged modes (SVC, IRQ and FIQ) and the none critical tasks in User mode. This also allows us to have memory protection with the MPU, where the memory of  the tasks run in privileged modes is protected from the none-safety tasks. The problem that we are having is that after switching to the User mode the IRQs and the FIQs are disabled and cannot be re-enabled in this mode. This makes the system none deterministic in the User mode and opens the possibility of hanging the safety critical tasks by none safety critical tasks. The gain of the memory protection and software criticality separation that we achieved with this software architecture is being eliminated by the loss of the system determinism. Is there any way to resolve this issue in the user mode?

Thanks,

Alex

  • Hi Alex,

    Interrupts do not need to be disabled when the CPU is in user mode. This is certainly not done automatically. In fact the FIQ cannot be disabled once enabled as it is implemented as a non maskable interrupt on Cortex R4/5.

    Regards,

    Sunil

  • Hi Sunil,

    What you say make sense, but it looks like IRQs and FIQs are automatically disabled when I switch to User mode. Maybe I am doing something wrong, but I remember reading somewhere that IRQs and FIQs need to be re-enable when switching from User mode to SVC. Here is how my code looks like:

    if(SwCfg->SwIntf[SwIdx]->swLevel > SW_LEVEL_B)

    { // Execute in User Mode

    __asm("USRMODE1: cps #16");

    SwDescriptor->BackgroundExec();

    __asm("SVC1: svc #1"); // Get back to Supervisor mode

    }

    In the software interrupt exception I do:

    _enable_IRQ();

    _enable_FIQ();

    Otherwise, I don't get the interrupts after I enter the User mode and come back from it. The interrupts are enabled before those lines of code are executed.

    I will keep checking what's wrong, but if you see something I'm doing wrong, please let me know.

    Thanks,

    Alex

  • Hi Sunil,

    It was my bad. My software hanged during initialization of the software that runs in User mode. That was before I enabled the interrupts. It does not hang in the background execution in User mode if I add infinite loop there. I guess I just got confused.

    Thanks for your help,

    Alex