#59 patch: update comments and handling of xPortStartScheduler()

closed-invalid
nobody
None
5
2013-02-10
2013-02-04
No

Patchfile attached.

Discussion

  • Forgot to add that this is against V7.3.0.

     
  • Richard
    Richard
    2013-02-10

    • status: open --> closed-invalid
     
  • Richard
    Richard
    2013-02-10

    Code had already been updated after conversation on the support forum, and I still don't agree with the patch. The code is currently as follows:

    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 ) 0U;

    /* 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() != pdFALSE )
    {
    /* 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(). */
    }
    }
    else
    {
    /* This line will only be reached if the kernel could not be started,
    because there was not enough FreeRTOS heap to create the idle task
    or the timer task. */
    configASSERT( xReturn );
    }