Many embedded systems reach a level of complexity where having a basic set of scheduling primitives
and ability to run different tasks can be helpful. The operation of switching from one task to
another is known as a context switch. A Real Time Operating System (RTOS) will typically
provide this functionality. Having a foundational knowledge of how the core of an RTOS works
can be a valuable skill set for an embedded engineer to have.
This is a companion discussion topic for the original entry at https://interrupt.memfault.com/blog/cortex-m-rtos-context-switching
Nice blog. I am looking for best opensource tool to trace FreeRTOS tasks. Any suggestion?
Also from you experiences can you suggest when to use static Memory Allocation and when Dynamic in FreeRTOS ? I always have a doubt.
Thanks
Correct me if I am wrong but I’m pretty sure there is a significant bug in the above assembly code where it conditionally stacks the FPU.
tst r14, #0x10
it eq
vstmbeq r0!, {s16-s31}
Shouldn’t “it eq” be “it ne”? The tst instruction will set the zero flag according to the result, so if the bit is set, i.e r14 & 0x10 is true (1), Z flag will be zero and the “EQ” will thus not execute.