WIN32-MingW Demo does not end correctly


I found a strange behavior in WIN32-MingW Demo application.

Demo application never ends in CodeCoverage configuration.
At first, “No errors” appears six times in console window.(This is an expected behavior)
After that, “Error: Notification” appears repeatedly until user pushes the “Stop” button on Eclipse.

Expected behavior
Program should end itself after six “No errors”.
I believe that because
vFullDemoIdleFunction()(main_full.c) calls
vTaskEndScheduler()(task.c) which calls

Probable cause
In demo, vTaskEndScheduler() is called from idle task.(here)
vTaskEndScheduler() deletes all idle tasks before calling vPortEndScheduler().(here)
Then, vTaskEndScheduler() stops itself and never call vPortEndScheduler().

Modification option
This behavior has not been observed after the following modification.
Guard condition(“if” statement) is added to deleting idle task in vTaskEndScheduler().

    for( xCoreID = 0; xCoreID < ( BaseType_t ) configNUMBER_OF_CORES; xCoreID++ )
    	if(xTaskGetCurrentTaskHandle() != xIdleTaskHandles[xCoreID]) // <- Added
              vTaskDelete( xIdleTaskHandles[ xCoreID ] );

I am not sure this modification is correct because I don’t understand correct way to end scheduler.
If vTaskEndScheduler() should not called from idle task, maybe demo application should be modified.

Could anyone give me advice?

Source code: The latest version on Github. It is newer than the latest release 202212.01.
Compiler: MinGW32 v5.0.2 and MinGW-w64 v5.0.0. (I tried both but results were same)
IDE: Eclipse

If modification is enough simple and easy, maybe I can send a pull request.
Thank you for your help in advance.


Thank you for reporting this issue. vTaskEndScheduler is updated in this PR to delete kernel created tasks in this function. The purpose is to facilitate memory check tool to run with posix simulator. Calling vTaskEndScheduler in idle task will result in deleting the running idle task itself.

I have created a PR to call vTaskEndScheduler in an application created task. Would you please give it a try and see if it solves the problem you observed?


Thank you for handling this issue.
I merged your modification to my local project and I saw problem is modified.
Demo application ends correctly after your modification.
Thank you very much for your help!

1 Like

Thanks for confirming the fix!