cancel
Showing results for 
Search instead for 
Did you mean: 

Will STM32CubeMX support FreeRTOS for STM32U5-series?

KHofm.1
Associate II

Hi there,

I would appreciate support in CubeMX for FreeRTOS for STM32U5-series. Currently I cannot find out how to configure this via the tool.

FreeRTOS.org recently released a demo for IoT Reference Integration, running on an STM32U5.

My old code is written and tested for using FreeRTOS, now we have to use the STM32U5-series, because older µC-series were not available.

Is the porting already planned and if yes, when do you plan the release?

Thanks for your answer ind advance.

Best regards,

K.

1 ACCEPTED SOLUTION

Accepted Solutions
Sara BEN HADJ YAHYA
ST Employee

Hello @KHofm.1​ ,

Thanks for your feedback,

We still don't know when will FreeRTOS be supported in CubeMX for U5. We will inform you as soon as we have any news.

Please check this Github repository, there are some FreeRTOS examples (ioc not available) for NUCLEO-U575ZI-Q that might be helpful.

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly :)

Thanks for your contribution and do not hesitate to raise any issue/ feedback.

 Sara.

View solution in original post

5 REPLIES 5
Sara BEN HADJ YAHYA
ST Employee

Hello @KHofm.1​ ,

Thanks for your feedback,

We still don't know when will FreeRTOS be supported in CubeMX for U5. We will inform you as soon as we have any news.

Please check this Github repository, there are some FreeRTOS examples (ioc not available) for NUCLEO-U575ZI-Q that might be helpful.

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly :)

Thanks for your contribution and do not hesitate to raise any issue/ feedback.

 Sara.

HFrei.1
Associate

I have the very same problem - old code that must be migrated.

The referenced FreeRTOS samples from Github are working - without ioc!

But as soon as I try to create a project with an ioc and copy and activate the FreeRTOS,

the first task fails with a wrong register value (248 instead of 2 (first Task)).

The call stack seems also to be different.

Already compared project settings, linker script, and startup code.

What have I missed?

Has anyone managed to create a project with freeRTOS and ioc together ?

Thanks.

KHofm.1
Associate II

Hello HFrei,

in the end I migrated the code successfully, starting from fetching the huge github-example with U5 and FreeRTOS at https://github.com/FreeRTOS/iot-reference-stm32u5

  • I created my U585-project using the ioc-file,
  • added the pure FreeRTOS stuff from github in a separate directory,
  • configured it by using FreeRTOSConfig.h,
  • used heap4.c,
  • and added cmsis_os2.c
  • adapted the callbacks to call functions in port.c
//defined this at startup to redirect to SysTick_Handler in port.c
void _SysTick_Handler( void )
{
    SysTick->CTRL;     /* Clear overflow flag */
    if( xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED )
    {   /* Call the cortex-m33 port systick handler */
        SysTick_Handler();
    } 
    HAL_IncTick();
}

and compiled it successfully,...finally, after some days.

I did not change anything relevant in FreeRTOS code basically. I configured the controller in CubeMX without multi-threading support, disabled the trusted zone and set the priorities of the IRQs adequate for use with FreeRTOS.

By making the user-code modular (one singIe call in main.c to create app-threads) I can re-generate ioc-code for the U585 anytime and use the same user-code now for other platforms.

I hope this helps a bit.

Kai

HFrei.1
Associate

Hello Kai,

Thanks for the hints.

I have a U575. Did the steps you explained and it compiles and links finally.

But the result stays the same.

Even copied all of the CMSIS drivers, so everything should be the same as in the template - which still starts with the correct task number.

As soon as it comes to start the first task:

	/* Register are stored on the stack in the following order - R0, R1, R2, R3,
	 * R12, LR, PC, xPSR. */
	ulPC = pulCallerStackAddress[ 6 ];
	ucSVCNumber = ( ( uint8_t *) ulPC )[ -2 ];
 
	switch( ucSVCNumber )
	{

the ucSVCNumber has the value of 248 instead of 2.

My question is: Did you face the same problem?

Otherwise I will stop here wasting time and port the system to ThreadX.

schwac
Associate

Hey guys, I am also in need of full freertos support for the STM32U5. I see that it is now added as an option called X-CUBE-FREERTOS, but it doesn't have integration with the USB and FATFS libraries. It look like the new ThreadX rtos is the only one with full support. Does this mean you are recommending switching to it completely? I would really prefer to have freertos as an option as well. I have alot of experience with it (as many others do) and it was working great for us. Can you please provide full cube support in future versions? Thanks!!!