diff --git a/portable/ThirdParty/GCC/Posix/port.c b/portable/ThirdParty/GCC/Posix/port.c index 45bb6f0f5..7d7b5d887 100644 --- a/portable/ThirdParty/GCC/Posix/port.c +++ b/portable/ThirdParty/GCC/Posix/port.c @@ -62,6 +62,7 @@ /* Scheduler includes. */ #include "FreeRTOS.h" #include "task.h" +#include "timers.h" #include "utils/wait_for_event.h" /*-----------------------------------------------------------*/ @@ -178,7 +179,6 @@ portBASE_TYPE xPortStartScheduler( void ) { int iSignal; sigset_t xSignals; -TaskHandle_t pxIdleThread; hMainThread = pthread_self(); @@ -186,8 +186,6 @@ TaskHandle_t pxIdleThread; Interrupts are disabled here already. */ prvSetupTimerInterrupt(); - pxIdleThread = xTaskGetIdleTaskHandle(); - /* Start the first task. */ vPortStartFirstTask(); @@ -201,7 +199,11 @@ TaskHandle_t pxIdleThread; } /* Cancel the Idle task and free its resources */ - vPortCancelThread(pxIdleThread); + vPortCancelThread( xTaskGetIdleTaskHandle() ); +#if ( configUSE_TIMERS == 1 ) + /* Cancel the Timer task and free its resources */ + vPortCancelThread( xTimerGetTimerDaemonTaskHandle() ); +#endif /* configUSE_TIMERS */ /* Restore original signal mask. */ (void)pthread_sigmask( SIG_SETMASK, &xSchedulerOriginalSignalMask, NULL );