Open yyjdelete opened 1 year ago
Interesting. That comes from https://github.com/STMicroelectronics/STM32CubeF4/blob/master/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c#L150-L168.
So the code should rather be
extern void xPortSysTickHandler(void);
void SysTick_Handler(void)
{
/* only clear overflag in not-tickless mode */
#if !defined(configUSE_TICKLESS_IDLE) || configUSE_TICKLESS_IDLE == 0
/* Clear overflow flag */
SysTick->CTRL;
#endif
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
{
/* Call tick handler */
xPortSysTickHandler();
}
}
?
SysTick_Handler
in gd32-spl-freertos(without cmsis_os2) shouldn't auto clear overflow flag of SysTick. https://github.com/CommunityGD32Cores/gd32-pio-projects/blob/76bdc2dacb82f64a1ca436d2efc592b96acaed54/gd32-spl-freertos/src/main.c#L139-L149It will break tickless mode for FreeRTOS(
#define configUSE_TICKLESS_IDLE 1
), since the defaultvPortSuppressTicksAndSleep
will check the flag https://github.com/CommunityGD32Cores/gd32-pio-projects/blob/d16b658da884a59b2d13c52d802eb0d0262e043f/gd32-spl-freertos/lib/FreeRTOS/src/portable/ARM_CM3/port.c#L552-L566