MCPcopy Create free account
hub / github.com/FreeRTOS/FreeRTOS-Kernel / vTaskStartScheduler

Function vTaskStartScheduler

tasks.c:2752–2833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2750}
2751
2752void vTaskStartScheduler( void )
2753{
2754 BaseType_t xReturn;
2755
2756 #if ( configUSE_TIMERS == 1 )
2757 {
2758 xReturn = xTimerCreateTimerTask();
2759 }
2760 #endif /* configUSE_TIMERS */
2761
2762 xReturn = prvCreateIdleTasks();
2763
2764 if( xReturn == pdPASS )
2765 {
2766 /* freertos_tasks_c_additions_init() should only be called if the user
2767 * definable macro FREERTOS_TASKS_C_ADDITIONS_INIT() is defined, as that is
2768 * the only macro called by the function. */
2769 #ifdef FREERTOS_TASKS_C_ADDITIONS_INIT
2770 {
2771 freertos_tasks_c_additions_init();
2772 }
2773 #endif
2774
2775 /* Interrupts are turned off here, to ensure a tick does not occur
2776 * before or during the call to xPortStartScheduler(). The stacks of
2777 * the created tasks contain a status word with interrupts switched on
2778 * so interrupts will automatically get re-enabled when the first task
2779 * starts to run. */
2780 portDISABLE_INTERRUPTS();
2781
2782 #if ( configUSE_NEWLIB_REENTRANT == 1 )
2783 {
2784 /* Switch Newlib's _impure_ptr variable to point to the _reent
2785 * structure specific to the task that will run first.
2786 * See the third party link http://www.nadler.com/embedded/newlibAndFreeRTOS.html
2787 * for additional information. */
2788 _impure_ptr = &( pxCurrentTCB->xNewLib_reent );
2789 }
2790 #endif /* configUSE_NEWLIB_REENTRANT */
2791
2792 xNextTaskUnblockTime = portMAX_DELAY;
2793 xSchedulerRunning = pdTRUE;
2794 xTickCount = ( TickType_t ) configINITIAL_TICK_COUNT;
2795
2796 /* If configGENERATE_RUN_TIME_STATS is defined then the following
2797 * macro must be defined to configure the timer/counter used to generate
2798 * the run time counter time base. NOTE: If configGENERATE_RUN_TIME_STATS
2799 * is set to 0 and the following line fails to build then ensure you do not
2800 * have portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() defined in your
2801 * FreeRTOSConfig.h file. */
2802 portCONFIGURE_TIMER_FOR_RUN_TIME_STATS();
2803
2804 traceTASK_SWITCHED_IN();
2805
2806 /* Setting up the timer tick is hardware specific and thus in the
2807 * portable interface. */
2808 if( xPortStartScheduler() != pdFALSE )
2809 {

Callers

nothing calls this directly

Calls 4

xTimerCreateTimerTaskFunction · 0.85
prvCreateIdleTasksFunction · 0.85
xPortStartSchedulerFunction · 0.50

Tested by

no test coverage detected