2025-07-17 2:02 AM
Hello!
We have recently updated our STM32CubeIDE to a newer version (1.19.0, from 1.18.0) and we have encountered an issue when using CubeMX. Whenever we launch the code generation some code sections in the file 'app_freertos.c' get duplicated. For example:
/* Definitions for defaultTask */
osThreadId_t defaultTaskHandle;
const osThreadAttr_t defaultTask_attributes = {
.name = "defaultTask",
.priority = (osPriority_t) osPriorityNormal,
.stack_size = 1024 * 4
};
/* Definitions for i2c_Task */
osThreadId_t i2c_TaskHandle;
const osThreadAttr_t i2c_Task_attributes = {
.name = "i2c_Task",
.priority = (osPriority_t) osPriorityAboveNormal,
.stack_size = 512 * 4
};
will become:
/* Definitions for defaultTask */
osThreadId_t defaultTaskHandle;
const osThreadAttr_t defaultTask_attributes = {
.name = "defaultTask",
.priority = (osPriority_t) osPriorityNormal,
.stack_size = 1024 * 4
};
/* Definitions for i2c_Task */
osThreadId_t i2c_TaskHandle;
const osThreadAttr_t i2c_Task_attributes = {
.name = "i2c_Task",
.priority = (osPriority_t) osPriorityAboveNormal,
.stack_size = 512 * 4
};
/* Definitions for defaultTask */
osThreadId_t defaultTaskHandle;
const osThreadAttr_t defaultTask_attributes = {
.name = "defaultTask",
.priority = (osPriority_t) osPriorityNormal,
.stack_size = 1024 * 4
};
/* Definitions for i2c_Task */
osThreadId_t i2c_TaskHandle;
const osThreadAttr_t i2c_Task_attributes = {
.name = "i2c_Task",
.priority = (osPriority_t) osPriorityAboveNormal,
.stack_size = 512 * 4
};
and the same goes for the assignment of the task handles, as well as for the implementations of the task start functions. Other files like 'main.c' are not affected by this it seems. However I cannot confirm if the above mentioned file is the only one.
We are using a STM32U5G9J-DK2 for our project if this is relevant to the problem.
Is there a way to prevent the code generator from doing this? Our machines are centrally managed and I cannot easily go back to the previous version of the IDE.
Solved! Go to Solution.
2025-07-17 5:12 AM
Hello @Katzenfutterdose ,
Further to your comment, I am not able to reproduce your behavior.
(Creating new Ioc.File with STM32U5G9J-DK2 on STM32CubeMX 6.14.0 and creating two tasks, then migrating the project to STM32CubeMX 6.15).
I suggest that you delete these two duplicate tasks, save the project and generate the code.
I will be waiting for your feedback.
Thanks.
Mahmoud
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-07-17 2:43 AM
Hello @Katzenfutterdose
First let me thank you for posting and welcome to the ST Community.
Your request is under investigation, and I will get back to you ASAP.
For more investigation, I suggest please that you provide your Ioc.File.
Thanks.
Mahmoud
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-07-17 2:56 AM
Hello @Mahmoud Ben Romdhane
Thank you for your reply! I have attached the .ioc file of the project below. I forgot to mention in the original post, that we also migrated to the newer software package versions after we were prompted by the IDE after the update.
2025-07-17 5:12 AM
Hello @Katzenfutterdose ,
Further to your comment, I am not able to reproduce your behavior.
(Creating new Ioc.File with STM32U5G9J-DK2 on STM32CubeMX 6.14.0 and creating two tasks, then migrating the project to STM32CubeMX 6.15).
I suggest that you delete these two duplicate tasks, save the project and generate the code.
I will be waiting for your feedback.
Thanks.
Mahmoud
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-07-17 5:28 AM
Hello @Mahmoud Ben Romdhane
Your suggestion fixed the issue. To be honest I didn't think to look at the FreeRTOS config inside of CubeMX as I didn't know it was possible to create two identical tasks in there. I still don't know how they got there in the first place but that doesn't matter now.
Thank you for your time!