freeRTOS v10.0.1

mouchuanlin wrote on Tuesday, May 15, 2018:

Hi,
I am porting freeRTOS v10.0.1 for STM32L496 Nucleo-144 board. FreeRTOS website mentioned that porting for STM32 need to define following marco in freeRTOSConfig.h while xPortSysTickHandler already define in STM32CubeMX generated file and ARM_CM4F\port.c. So the compiler will complain about duplicate define.

Any solution for this?

https://www.freertos.org/FreeRTOS-for-Cortex-M3-STM32-STM32F100-Discovery.html

#define vPortSVCHandler      SVC_Handler
#define xPortPendSVHandler   PendSV_Handler
#define xPortSysTickHandler  SysTick_Handler

Thanks,
Dick

rtel wrote on Tuesday, May 15, 2018:

Did you actually try this and get a compiler error? If so, please post
the error, as the macro is re-defining xPortSystickHandler to
SysTick_Handler - so removing a definition of the function that adding
another one.

Perhaps there is some confusion on how to use FreeRTOS and the ST Cube
HAL at the same time as both want to install their own SysTick handler.
The normal FreeRTOS way of doing that would be to install the FreeRTOS
SysTick handler then use the tick hook function to call a third part
tick handler if necessary. However in the ST case it has to be the
other way around as the ST interrupt service routines poll the tick time
(not a good thing to do in an ISR) so have to run at the highest
priority - therefore when combining FreeRTOS with the ST Cube HAL you
have to install the ST SystTick handler and call the FreeRTOS one from that?

Confused? Yes, but if you create your project from the STM32CumeMX then
it does this for you so just use the project it creates for you.