Skip to content

Delete enable interrupts in xPortStartScheduler() #2

Description

@yehuda-bernstein

The line portENABLE_INTERRUPTS(); in the function xPortStartScheduler(void) should be removed.
This might cause the context to run in main() stack and crash the system.
See remark at function void vTaskStartScheduler( void ) lines 2064-2068:

/ 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. /

BaseType_t xPortStartScheduler(void)
{
vPortSetupTimerInterrupt();

ulCriticalNesting = 0;

#if(configUSE_PREEMPTION == 1)
bPreemptive = 1;
#else
bPreemptive = 0;
#endif

portENABLE_INTERRUPTS();
portRESTORE_FIRST_CONTEXT();

// Should not get here!
return pdFAIL;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions