A context switch requires the entire execution context to be saved. On the AVR microcontroller the context consists
of:
- 32 general purpose processor registers. The gcc development tools assume register R1 is set to zero.
- Status register. The value of the status register affects instruction execution, and must be be preserved across
context switches.
- Program counter. Upon resumption, a task must continue execution from the instruction that was about to be
executed immediately prior to its suspension.
- The two stack pointer registers.
Next: RTOS Implementation - Saving The Context