FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [February 2014 Threads]
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.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FreeRTOSSWIHandler
; 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?
All IRQs are disabled by the hardware, which is why you can't find software doing it. The IRQ handler reenables interrupts so interrupts can nest but the SVC handler doesn't.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.