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 )
/* 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. */
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(). */
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.