cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE/MX with freeRTOS

LMorr.3
Senior II

I am using STM32CubeIDE to build a freeRTOS project. I have put my tasks in their own .h and .c files. For example I have a default_task.c file.

The problem is each time I open CubeMX and save my changes, the 'auto code update' feature does not see my default_task.c file and creates a function in main.c.

Is there a doc showing how to configure STM32CubeIDE and CubeMX so that I can have it update my code correctly? If not, is there a way to see what changes CubeMX will be making so that I can make them manually?

1 ACCEPTED SOLUTION

Accepted Solutions
Sara BEN HADJ YAHYA
ST Employee

Hello @LMorr.3,

Please check whether the "General peripheral initialization as a pair of .c/.h files per peripheral " parameter is checked or not. It should be checked.

It is placed under Project Manager -> Code Generator -> Generated Files

0693W00000Lxs0lQAB.png 

If this isn't your issue, could you please share your ioc file and explain it more and provide us with a scenario to reproduce it.

Thanks,

Sara.

View solution in original post

3 REPLIES 3
KnarfB
Principal III

In CubeIDE/MX, in the FreeRTOS Tasks and Queues tab, double-click on defaultTask. Set the Code Generation Option to "As weak". Then, the generated code has the StartDefaultTask function defined as weak. I.e. the linker ignores it, if you provide a normal (non-weak) implementation of StartDefaultTask in your files.

hth

KnarfB

Sara BEN HADJ YAHYA
ST Employee

Hello @LMorr.3,

Please check whether the "General peripheral initialization as a pair of .c/.h files per peripheral " parameter is checked or not. It should be checked.

It is placed under Project Manager -> Code Generator -> Generated Files

0693W00000Lxs0lQAB.png 

If this isn't your issue, could you please share your ioc file and explain it more and provide us with a scenario to reproduce it.

Thanks,

Sara.

LMorr.3
Senior II

Thank you for the info., I will try building a new project with those settings to learn more about how it works.