2017-12-13 02:50 AM
2017-12-13 02:15 PM
Cross-post - Keil forum:
2017-12-13 04:07 PM
I don't want to rain on your parade, but the #1 best practice is 'don't write your own RTOS'.
Hopefully you will be getting a degree, or some feeling of a job well done, or education by fire.
A
2017-12-13 11:04 PM
Thanks for your answers ! Unfortunately, none of them was related to RTOS discussion
:(
2017-12-13 11:47 PM
Messages completely coincide, it's strange, the author did not have new ideas at the time of copying the text.
On the topic - for the use of critical sections it is necessary to beat the user with bamboo sticks. The number of strokes is not normalized, but limited by the level of enlightenment. The prohibition of interrupts is the greatest evil.
2017-12-14 12:23 AM
You need to study the process of preempting interrupts of different priorities.
You need two different stacks, for interrupts and for program flows.
All secondary register storages with simultaneous interrupts of different levels are stored in the interrupt stack area. You can make a lot of calls to new interrupts inside interrupts, and this will not affect the program stack.
But you can not switch tasks with an unknown pattern of the interrupt stack !! Switching call-the maximum priority level, will be executed when all more important interrupts have already been executed. Inside the switch call, an interrupt with zero priority is called. So that it was impossible to interrupt the update procedure of the task stack.
2017-12-14 01:40 AM
Inside the switch call, an interrupt with zero priority is called. So that it was impossible to interrupt the update procedure of the task stack.
Where did you get it from ?
freeRTOS is using
only
PendSV with priority 240 to save the context and switch tasks:)
2017-12-14 05:28 AM
Where did my opinion come from?
I broke all my legs about crutches freeRTOS. And I had to write my OS.
https://bitbucket.org/AVI-crak/rtos-cortex-m3-gcc/commits/branch/default
I took for an example
.Switching tasks is started by a timer or a direct call. The interruption from the timer has the highest priority, and it can be superseded by any other interrupt - so the purity of the stack is achieved.
A timer or direct call starts an interrupt with zero priority, in which the task is toggled. This interrupt can no longer be interrupted, and it is always performed without crutches. The interdiction interdiction is a crutch. All freeRTOS is one huge crutch.
And yet - the number of preemptive priority levels - only 16 pieces.
2017-12-14 07:09 AM
So you are suggesting to save/switch context inside high priority interrupt?
Im a little bit confused becouse all ARM documents stands that PendSV should be used as context switcher in os enviroment.
2017-12-14 09:49 AM
Task switching timer (maximum priority) -> PendSV (zero priority) task switching.
The lower the priority, the higher the resistance to displacement. Zero priority is not superseded. But if three or more interrupts with zero priority are triggered simultaneously, they are executed according to their level. For this reason, the zero priority for switching and the maximum for the timer must be unique. For the user, priorities 1-14 remain free. Each priority has 16 levels, or an ordered list. The interrupts that have been triggered (even in the preemptive state) will be processed according to this list.
When interrupts are disabled, the history of the events that are triggered is lost. They are explicitly prohibited, and do not queue for execution. If automatic data collection is used, then interrupting prohibits equilibrium.