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

context switch

I am programming a simple full pre-emptive RTOS. It needs context switch. For saving contexts, is it enough to save all registers and CPSR? if tasks have local variables, and the complier uses memories to store them. If just saving registers, it seems not enough. What should I do?

thank you for your help!!!

Parents
  • Local variables stay on the stack unless you defined them as static. Therefore you should not have any static variables in a function.

    The stack and the registors are saved by the OS and restored by the OS.

    Get a copy of the book and read it. Code is written in 'c' You can also (at least you use to be able to) download the source from there web. They have ports for difference uP's. You should be able to use the source as a starting point.

    Look at the license agreement.

Reply
  • Local variables stay on the stack unless you defined them as static. Therefore you should not have any static variables in a function.

    The stack and the registors are saved by the OS and restored by the OS.

    Get a copy of the book and read it. Code is written in 'c' You can also (at least you use to be able to) download the source from there web. They have ports for difference uP's. You should be able to use the source as a starting point.

    Look at the license agreement.

Children
No data