Upgrading FreeRTOS from v10.3.1 (from CubeMX ) to v11.2.0 (from freeRTOS repository)
Hello ST Community,
I'm working on an STM32H753VIT6 project and need to upgrade FreeRTOS from v10.3.1 to v11.2.0 due to cybersecurity requirements. I've encountered several integration challenges that I'd like to share and seek guidance on.
Background
Current Setup:
- Working on an STM32H753VIT6 microcontroller
- FreeRTOS v10.3.1 with CMSIS-RTOS v2 wrapper automatically generated using CubeMX which works seamlessly out of the box
Target:
- Using the newest FreeRTOS v11.2.0 from official repository (preferably without the CMSIS wrapper so future upgrading will be easier): https://github.com/FreeRTOS/FreeRTOS-Kernel/releases/tag/V11.2.0
The process:
So I followed some guides from the FreeRTOS forums and the ST community forums.
Like this one: https://community.st.com/t5/stm32cubemx-mcus/is-there-a-way-to-disable-the-automatic-default-task-creation-when-c-2560/td-p/256903
where I've been told there is no other way of upgrading (at least for my STM32H753VIT6) than deactivating the FreeRTOS from within the CubeMX, then downloading the lib from FreeRTOS repository and replacing it. So I followed this guide, and my first problem was duplicate definitions of some interrupt handler functions like PendSV_Handler and SVC_Handler, which were autogenerated by MX in stm32h7xx_it.c and in Port.c in the freertos libs. I found a way to disable the generation of these handlers in MX by unchecking some configuration in the NVIC window under the Code Generation tab (unchecked the "Generate IRQ handler" options for "Pendable request for system service" and "System service call via SWI instruction").
After solving this issue, I compiled successfully, but when I tried to run the code, it got stuck. After debugging, I realized the problem was related to the initialization process. With the CMSIS-RTOS wrapper in v10.3.1, there were two functions: osKernelInitialize() and osKernelStart(). The osKernelInitialize() function prepared the FreeRTOS environment, allowing some FreeRTOS API calls (like vTaskDelay() and timer functions) to work even before osKernelStart() was called.
Additionally, I encountered missing hook function errors:
undefined reference to `vApplicationIdleHook`
undefined reference to `vApplicationGetIdleTaskMemory`
undefined reference to `vApplicationGetTimerTaskMemory`
and many more Hard Fault and assertions erros caused by my code not intgrating well with the new freertos lib without the cmsis warpper
And I found the upgrading process extermly diffcult and full of uncertenties
Questions for ST
- So is there a “best practice” approach for upgradig an already exist project to a newer freertos version ?
- About the CMSIS warpper what are the benfits I get from using it ? is it better to work with or without ?
Thank you for any guidance you can provide!
