USP, ISP - when to use which?

I am confused with two stack pointers in RX devices - User Stack Pointer, and Interrupt Stack Pointer?

In particular, when is USP used? And how? Is it used by RTOS when there are multiple tasks (context switching)?

  • When i developed program with ucos, i make stacks for tasks and a stack for program, stacks for task are used for only one task but the stack for program is the whole program. the SP will jump to stack where the program runs to.
  • If you're writing a "bare metal" firmware, with a simple task loop, you may well not use USP at all. You'll spend the entire time running in Supervisor Mode, using the ISP. You should consider the security implications before taking this route.

    An RTOS may well run its tasks in User Mode, with a separate stack and stored SP associated with each task's context. It can use the Memory Protection Unit (where available) to limit each task's addressable memory areas, and the permissions on them. This can help avoid user stack overrun, too.

  • This thread will be archived due to inactivity.

    Mike Clements
    RenesasRulx Moderator