Skip to content

Unchecked reference to TIM13 in TIM8_IRQHandler in timer.c #585

Closed
@pkourany

Description

@pkourany

Latest Arduino Core release 1.61

file: https://github.com/stm32duino/Arduino_Core_STM32/blob/master/cores/arduino/stm32/timer.c

void TIM8_IRQHandler(void)
{
  if (timer_handles[TIMER8_INDEX] != NULL) {
    HAL_TIM_IRQHandler(timer_handles[TIMER8_INDEX]);
  }

#if defined(STM32F1xx) || defined(STM32F2xx) ||defined(STM32F4xx) || defined(STM32F7xx)
  if (timer_handles[TIMER13_INDEX] != NULL) {
    HAL_TIM_IRQHandler(timer_handles[TIMER13_INDEX]);
  }
#endif
}
#endif //TIM8_BASE

TIM8_IRQHandler references to TIMER13_INDEX even though not all checked product lines implement a TIMER13. This causes a compile error when creating an F103xE variant (F103RC in this case). Adding a check for TIMER13_BASE prevents the error:

void TIM8_IRQHandler(void)
{
  if (timer_handles[TIMER8_INDEX] != NULL) {
    HAL_TIM_IRQHandler(timer_handles[TIMER8_INDEX]);
  }

#if defined(STM32F1xx) || defined(STM32F2xx) ||defined(STM32F4xx) || defined(STM32F7xx)
#if defined(TIMER13_BASE)
  if (timer_handles[TIMER13_INDEX] != NULL) {
    HAL_TIM_IRQHandler(timer_handles[TIMER13_INDEX]);
  }
#endif
#endif
}
#endif //TIM8_BASE

Metadata

Metadata

Assignees

Labels

bug 🐛Something isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions