2018-11-13 11:33 PM
We are using CubeMX (incl. FreeRtos) to update our settings.
The problem is that CubeMX will always create a default task in the main. We also tried to remove the following line from the ioc file "FREERTOS.Tasks01=defaultTask,0,128,StartDefaultTask,Default,NULL" but it will automatically rewrite it.
Is there a way to disable the default task code generation ?
Thanks
2018-11-16 03:23 AM
Hello @MEber.10 ,
I will highlight this point internally and one of our STM32CubeMX experts will answer you ASAP. Meanwhile, could you please precise which STM32CubeMX version you're using.
Khouloud.
2018-12-04 01:39 AM
Hi @MEber.10
I want to know the CubeMX version you are using as well as the ioc file that generated this problem.
Best Regards,
Wael.
2018-12-05 01:52 AM
Hi @MEber.10
I tried with an STM32F4 MCU. I noticed that you're right
Your request has been redirected to the development team. it will be corrected in the next release.
Best Regards.
Wael.
2019-01-23 03:36 AM
Hi, I just updated to STM32CubeMX V5.0.1 /2-January-2019 and issue is still there. Not possible to delete defaultTask using GUI and it is re-added if manually removed from ioc.
In which release is this planned to be corrected?
Best regards
/Stefan
2019-01-23 04:29 AM
Hi @SAnde.12
Your request has been redirected to the development team. it will be corrected in the release 5.2.0 of CubeMX .
Best Regards,
Wael
2019-01-23 05:48 AM
Hi all,
I "fixed" this problem, renaming the defaultTask to another task used in my application, and this works.
It is not a "final" solution, but I can kept RAM free.
I will wait for oficial soution.
Regards
Jordi
2019-08-14 10:39 AM
I am having a similar issue. When I remove the code generated for the DefaultTask, I am met with a hard fault. What is depending on this default task being around and how do I break that dependency?
2021-10-20 10:03 AM
My workaround is to simply add a return statement inside MX_FREERTOS_Init() user code section.
void MX_FREERTOS_Init(void) {
/* USER CODE BEGIN Init */
startMyTask(); // create and start your own task here
return; //return to avoid creation of default task
/* USER CODE END Init */
/* USER CODE BEGIN RTOS_MUTEX */
/* add mutexes, ... */
/* USER CODE END RTOS_MUTEX */
/* USER CODE BEGIN RTOS_SEMAPHORES */
/* add semaphores, ... */
/* USER CODE END RTOS_SEMAPHORES */
/* USER CODE BEGIN RTOS_TIMERS */
/* start timers, add new ones, ... */
/* USER CODE END RTOS_TIMERS */
/* USER CODE BEGIN RTOS_QUEUES */
/* add queues, ... */
/* USER CODE END RTOS_QUEUES */
/* Create the thread(s) */
/* creation of defaultTask */
defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);
/* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */
/* USER CODE END RTOS_THREADS */
/* USER CODE BEGIN RTOS_EVENTS */
/* add events, ... */
/* USER CODE END RTOS_EVENTS */
}
The default task will never start this way. The compiler should be smart enough to optimize out the function as it is an empty function and only referenced by dead code.
2022-08-31 01:44 AM
The problem still exists in 1.10.1. The task creation is in main now so the workaround with return does not work. All application tasks are created elsewhere using freertos API. In my project the default task is empty only taking memory and cannot be used to anything else. I was considering deleting it by that won't help when full static allocation is used.
Is there any plan to fix that? It would be nice for processors with just few kB of ram not not waste it. Just add a user section around so we can use #if 0 or add checkbox to mx ui