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] [July 2010 Threads] 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.
STEPPING THROUGH HERE USING A DEBUGGER CAN CAUSE BIG PROBLEMS IF THE DEBUGGER ALLOWS INTERRUPTS TO BE PROCESSED. */ portDISABLE_INTERRUPTS();
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. */ portCONFIGURE_TIMER_FOR_RUN_TIME_STATS();
/* 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. */ } else { /* 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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|