Skip to content

Incorrect SysTick_Handler() generation when SysTick selected as time base for HAL #5

Description

@nickshl

When I generated code for STM32H5 using SysTick selected as time base for HAL, HAL delay doesn't work. Yes, I know about the warning, I know limitations and I fine with that... when it works. But it doesn't. The reason why it doesn't work that next line uncommented in FreeRTOSConfig.h:
#define SysTick_Handler xPortSysTickHandler
and SysTick_Handler doesn't generated by STM32CubeMX. This how it handled for STM32F1 series. FreeRTOSConfig.h:

/* IMPORTANT: This define is commented when used with STM32Cube firmware, when the timebase source is SysTick,
              to prevent overwriting SysTick_Handler defined within STM32Cube HAL */

/* #define xPortSysTickHandler SysTick_Handler */

And SysTick_Handler added to stm32f1xx_it.c:

/**
  * @brief This function handles System tick timer.
  */
void SysTick_Handler(void)
{
  /* USER CODE BEGIN SysTick_IRQn 0 */

  /* USER CODE END SysTick_IRQn 0 */
  HAL_IncTick();
#if (INCLUDE_xTaskGetSchedulerState == 1 )
  if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
  {
#endif /* INCLUDE_xTaskGetSchedulerState */
  xPortSysTickHandler();
#if (INCLUDE_xTaskGetSchedulerState == 1 )
  }
#endif /* INCLUDE_xTaskGetSchedulerState */
  /* USER CODE BEGIN SysTick_IRQn 1 */

  /* USER CODE END SysTick_IRQn 1 */
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions