Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


void vTaskStartScheduler( void )

Posted by Mohammed Abuteir on July 29, 2010
If I stopped the interrupt after start the schedule. What will be effect of the Freertos .

The follwing code from tasks.c .

In anther Worde if I deleted the code line ‘portDISABLE_INTERRUPTS();’ what will be happened?

void vTaskStartScheduler( void )
portBASE_TYPE xReturn;

/* Add the idle task at the lowest priority. */
xReturn = xTaskCreate( prvIdleTask, ( signed char * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), ( xTaskHandle * ) NULL );

if( xReturn == pdPASS )
/* Interrupts are turned off here, to ensure a tick does not occur
before or during the call to xPortStartScheduler(). The stacks of
the created tasks contain a status word with interrupts switched on
so interrupts will automatically get re-enabled when the first task
starts to run.


xSchedulerRunning = pdTRUE;
xTickCount = ( portTickType ) 0;

/* If configGENERATE_RUN_TIME_STATS is defined then the following
macro must be defined to configure the timer/counter used to generate
the run time counter time base. */

/* Setting up the timer tick is hardware specific and thus in the
portable interface. */
if( xPortStartScheduler() )
/* Should not reach here as if the scheduler is running the
function will not return. */
/* Should only reach here if a task calls xTaskEndScheduler(). */

RE: void vTaskStartScheduler( void )

Posted by Richard Damon on July 29, 2010
You seem to be asking two different cases.
The first question you asked was the effect of stopping interrupts after starting the scheduler, the obvious answer is that these interrupts won't occur and actions based on them won't happen. In particular, if the timer tick stops happening, then timeouts on events will never expire and tasks of the same priority won't share time with time slices, only explicit yields.

The second question is what happens if you remove the indicated portDISABLE_INTERRUPTS(), after that point FreeRTOS goes through some initializations that are needed for the system to be operational, if an interrupt occurs (like the timer) and it calls FreeRTOS API (FromISR versions of course) then things are not set up yet, so corruption or crashing is possible.

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner