2024-12-20 05:29 AM - edited 2024-12-20 05:39 AM
Background, We have projects where the SYS timebase is set to a peripheral timer. Currently, this no longer works with the new cubeMX version.
In STM32CubeIDE 1.17, migrating projects to the updated CubeMX version (6.12.0 -> 6.13.0) modifies the FreeRTOSConfig.h file in Core/Inc. Specifically, the following changes occur:
Old lines (140–143):
New lines (144–146):
The old configuration ensured that FreeRTOS used its SysTick implementation from port.c. Specifically, xPortSysTickHandler in port.c was renamed to SysTick_Handler, matching the function name in the startup file's interrupt vector.
With the new configuration, this renaming no longer happens. If the SYS timebase is configured to use a timer peripheral (instead of SysTick), there is no implementation of the SysTick_Handler function, leaving the interrupt unhandled. As a result, the Default_Handler is used, which prevents FreeRTOS from switching tasks.
If the SYS timebase is configured to use SysTick in the .ioc file, an implementation of SysTick_Handler is generated in stm32f3xx_it.c. This generated function calls both HAL_IncTick and xPortSysTickHandler. This indicates that ST assumes the SYS timebase is always set to SysTick and that the use of a timer peripheral as the SYS timebase is no longer supported.
Effectively, FreeRTOS no longer works when using a timer peripheral as the SYS timebase in STM32CubeIDE 1.17 after migrating the project.
2024-12-20 07:29 AM - edited 2024-12-20 07:30 AM
Yes, in early FreeRTOS it contained the SysTick handler, but later they added co-existence with other software such as the STM32 "HAL" and assume that the handler exists in external code. So we have to keep an eye on this and fix whenever necessary.