Skip to main content
LMorr.3
Senior
April 13, 2022
Solved

STM32CubeIDE/MX with freeRTOS

  • April 13, 2022
  • 3 replies
  • 4212 views

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?

This topic has been closed for replies.
Best answer by Sara BEN HADJ YAHYA

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.

3 replies

KnarfB
Super User
April 13, 2022

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 Technical Moderator
April 13, 2022

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.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
LMorr.3
LMorr.3Author
Senior
April 13, 2022

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