Native FreeRTOS with CubeMX ? (No CMSIS Wrapper)

Hello,

Is there a way to configure FreeRTOS on a STM32 MCU with the CubeMX tool without the CMSIS wrapper ?

This CMSIS has some disavantages for me as:

  • Including third party FreeRTOS library
  • No direct application of the support offer by the FreeRTOS community (Forum, documentation, tutorial, book etc)
  • Reduce functionnality. I can’t find for example any similar Mailbox concept with the CMSIS

Thank you

I’m not familiar enough with the CubeMX tool myself to know if you can use it to create a FreeRTOS project without CMSIS wrappers, but I would guess the answer would be no. None of the ST examples in our distribution or the IoT reference integration for the STM32 IoT board use the CMSIS wrapper though.

1 Like

I think you can integrate the FreeRTOS kernal files by yourself alongside the CubeMX generated files. It’s not as convenient as CubeMX, however much more flexible.

1 Like

Just because the IDE setup the CMSIS wrappers doesn’t mean you need to use them. You can directly call the FreeRTOS functions as much as you desire.

You may have issues mixing between the two for a given FreeRTOS object, maybe needing to create it under CMSIS and extracting the FreeRTOS handle out of the CMSIS object.

1 Like

Thank you for these answers.

I am doing something very similar to what you are saying.
I configured the FreeRTOS kernel through CubeMX and generate the project. Then I remove the CMSIS functions and use the native FreeRTOS apis.

Here is an interesting link that resume what I am doing:
https://jaywang.info/using-native-freertos-in-stm32-microcontrollers/

Some default CMSIS wrapper code will be unfortunately regenerated after each smallest change in CubeMX configuration tool.
I have to remove these lines like

  defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);

  /* Start scheduler */
  osKernelStart();

manualy every time from main() routine.

Yes, you can use FreeRTOS alone (at first sight); just follow the same MCUXpresso IDE approach (from NXP; look for the examples for the LPC1124 chip/board). However, you must stop using the STM32CubeIDE autogenerated code, because there is a problem with the PendSV_Handler interrupt handler: it’s used by FreeRTOS, but the IDE everytime generates its (empty) own and a conflict arises: you must erase the autogenerated one by hand over and over and over again.

Besides that, be aware that the timer SysTick isn’t used for the kernel tick! You must use and configure another one (I just don’t get it, really).

With the NXP approach you don’t even need to generate any FreeRTOS code from the STM32CubeIDE… as long as you don’t use the autogenerated code.

If still interested let me know it to write a tutorial (using the FreeRTOS latest release, 10.5.1 as per today).

EDIT (few seconds after the post): I found this tutorial that says as pretty much as the NXP approach, and seems he resolved the PendSV_Handler thing: