kbshibukumar wrote on Friday, February 28, 2014:
In the file FreeRTOS_Demo/Source/FreeRTOS-Source/Portable/RVDS/ARM-CA9/portmacro.h, we have the following definition.
#define portYIELD() __asm( “SWI 0” );
Now, the corresponding SWI handler in portASM.s is
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SVC handler is used to start the scheduler and yield a task.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FreeRTOS_SWI_Handler
; Check whether an iterrupt can occur at this point.
PRESERVE8
; Save the context of the current task and select a new task to run.
portSAVE_CONTEXT
LDR R0, =vTaskSwitchContext
BLX R0
vPortRestoreTaskContext
portRESTORE_CONTEXT
However, nowhere in the above code, interrupts are disabled. Doesn’t it cause any problem if any other interrupt comes and moves a task into the ready queue or schedules a new task in the mean time?