Skip to main content
Sid Price
Associate III
April 24, 2021
Solved

How to manually add FreeRTOS to CubeIDE project

  • April 24, 2021
  • 3 replies
  • 10215 views

I need to add a specific version of FreeRTOS to my STM32F103 CubeIDE project, I cannot use the Middleware package in CubeMX.

I have tried several times to get the FreeRTOS files into CubeIDE, both using "Import" from Filesystem and drag and drop of files into the Project Explorer. Each time the files appear in the Project Explorer but they do not get built.

What am I missing here?

Thanks.

This topic has been closed for replies.
Best answer by Cartu38 OpenDev

I guess still fully doable but have to consider required setup.

If FreeRTOS MW added to configuration:

0693W00000AMZaNQAX.jpg 

If FreeRTOS MW is no part of configuration:

0693W00000AMZacQAH.jpg 

So if disabling FreeRTOS from adding it by yourself you have to untick some of generated IQ handlers ...

Such is about interrupts only ... maybe some other related setups but according to me Device Tool Configuraion should allow you to reach your goal ... just have to find proper settings ...

3 replies

Cartu38 OpenDev
Graduate II
April 26, 2021

No a STM32CubeIDE issue but common Eclipse CDT usage.

At a point you have to explicitly add files / folders you want to include to compile process. Such are so called source(s) entry(ies)

1) Right click on resource(s) to add

0693W00000AMYFiQAP.jpg2) Include whatever build configuration

0693W00000AMYFxQAP.jpg 

3) Notice some small green "C" as resource(s) icon overlay <=> here you are !

0693W00000AMYG7QAP.jpg 

Please note can be added and/or checked thru project's properties

0693W00000AMYFPQA5.jpg

Pavel A.
April 26, 2021

Basically you want to use linked files (Eclipse feature) to point to your FreeRTOS source.

If unsure which files to take, generate a simple Cube project with FreeRTOS and copy the file list from there into your project.

(that's boring in the IDE, but the .project file can be edited/merged manually when you're used to it).

--pa

Cartu38 OpenDev
Graduate II
April 26, 2021

@Community member​  is writing "Each time the files appear in the Project Explorer but they do not get built." so I guess source entry lack is the point.

@Pavel A.​ what you are sharing is a valid way to add file to a project (as addon to copy like @Community member​  is doing) but adding file whatever the way to a project do not imply to get them taken into account a compile time. Bare minimal setup is to get such resources as child of a source entry. Of course if adding resources to a folder which is already declared a source entry (some are per default like Drivers folder or ... ) is doing job silently for you

Sid Price
Sid PriceAuthor
Associate III
April 26, 2021

Thanks for the input, I have now added the FreeRTOS files and they are being compiled.

However, I face a new issue, so, I am wondering if anyone has already added FreeRTOS manually to a CubeIDE project?

The issue is that three of the exception handlers have multiple definitions. For example "SVC_Handler" is defined in both "stm32f0xx_it.c" and also in the FreeRTOS "port.c" files. Looking at the source of "stm32f1xx_it.c", it does not appear that one can remove those definitions without CubeIDE over-writing the file when the project is regenerated.

If I create a CubeIDE project and select FreeRTOS, the "stm32f1xx_it.c" file does NOT have definitions for these three exceptions, and so it compiles just file.

Seems to me that manually adding freeRTOS to a CubeIDE project and being able to regenerate it in the future is just not possible without lots of work.

Anyone have any comments?

Cartu38 OpenDev
Cartu38 OpenDevBest answer
Graduate II
April 26, 2021

I guess still fully doable but have to consider required setup.

If FreeRTOS MW added to configuration:

0693W00000AMZaNQAX.jpg 

If FreeRTOS MW is no part of configuration:

0693W00000AMZacQAH.jpg 

So if disabling FreeRTOS from adding it by yourself you have to untick some of generated IQ handlers ...

Such is about interrupts only ... maybe some other related setups but according to me Device Tool Configuraion should allow you to reach your goal ... just have to find proper settings ...

Sid Price
Sid PriceAuthor
Associate III
April 26, 2021

This is an excellent piece of help and I am going to try it on my project.

However, it appears there is a bug in STM32CubeIDE: I am using Git to switch between branches of my project. One branch has the CubeMx enabled FreeRTOS and the other has my attempts to manually add FreeRTOS. What I see is if the ".ioc" file is open in STM32CubeIDE and I change branches, the "Refresh" option does NOT reload the ".ioc" file. I am sure this has been adding to my issues!

I will report back on your suggestion once I have tested it.