cancel
Showing results for 
Search instead for 
Did you mean: 

FreeRTOS with CubeMX different than freertos.org

gerhard
Associate II
Posted on July 29, 2015 at 19:15

There seem to be many differences between FreeRTOS code generated with CubeMX, and FreeRTOS code examples downloaded from freertos.org

I use the ''Prectical Guide'' and Example code from freertos.org, but have to modify many things, like function names, IDs and so on.

FreeRTOS code generated with CubeMX uses:

  /* Start thread 1 */

  LEDThread1Handle = osThreadCreate(osThread(LED1), NULL);

and

  /* Start scheduler    */

  osKernelStart();

While

FreeRTOS code examples downloaded from freertos.org uses:

 /* Create the other task in exactly the same way. */

 xTaskCreate( vTask2, ''Task 2'', 240, NULL, 1, NULL );

and

 /* Start the scheduler so our tasks start executing. */

 vTaskStartScheduler();

Is there a better way to do this?

Is there a Reference / Users manual for the CubeMX FreeRTOS code?

Do I just work through CubeFx examples like

....\STM32Cube_FW_F0_V1.2.0\Projects\STM32F072B-Discovery\Applications\FreeRTOS\FreeRTOS_ThreadCreation\Src

Any help appreciated
2 REPLIES 2
Posted on July 30, 2015 at 18:33

Hi Gerhard,

As you can verify in 

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/DM00105262.pdf

, osThreadCreate and osKernelStart are CMSIS-RTOS APIs (page 13), while xTaskCreate and  vTaskStartScheduler are FREE RTOS APIs (page 8). I think the User Manual mentioned can be helpful.

-Shahrzad- 

bernhard239955
Associate II
Posted on July 30, 2015 at 18:39

That's because STM32CubeMX builds on CMSIS, an API that has been defined by ARM to be used as kind of standard. The real time OS (e.g. FreeRTOS or Keil's RTX) is wrapped by a port library that provides the same CMSIS API, so in theory you don't have to change your code when you change the realtime OS.

In practice, this works more or less, as there are some differences between different ports, but it's better than nothing to be portable between different real time OSes.

So, if you don't need special properties that only FreeRTOS has, try to go the CMSIS path.