Context switch in FreeRTOS
Posted: Mon Jan 22, 2018 11:39 am
I am thinking about implementing my own preemptive scheduler for ESP32. I'm sure I can only program a context switch in assembler. Since I don't want to deal with assembler for ESP32, but I had the idea to reuse some functions from FreeRTOS. I looked at the libraries and found these two functions in xtensa_rtos. h:
void XT_RTOS_INT_ENTER (void)
void XT_RTOS_INT_EXIT (void)
Is it correct that I can call these functions in an interrupt to cause a context switch? XT_RTOS_INT_ENTER saves the context of the current task interrupted by the interrupt? XT_RTOS_INT_EXIT restores the last saved context?
The comments state that these functions can only be executed for a Call0 instruction. What's the meaning of this?
There is another file called xtensa_context.S with the two functions:
text_context_restore
text_context_save
What is the meaning of this S-file?
Thank you in advance for your help.
void XT_RTOS_INT_ENTER (void)
void XT_RTOS_INT_EXIT (void)
Is it correct that I can call these functions in an interrupt to cause a context switch? XT_RTOS_INT_ENTER saves the context of the current task interrupted by the interrupt? XT_RTOS_INT_EXIT restores the last saved context?
The comments state that these functions can only be executed for a Call0 instruction. What's the meaning of this?
There is another file called xtensa_context.S with the two functions:
text_context_restore
text_context_save
What is the meaning of this S-file?
Thank you in advance for your help.