Skip to content

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

Closed

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

Activity

  1. fpistm commented on Jul 31, 2019

    @fpistm
    Member

    Hi @pkourany
    thanks for the issue.
    This is right, the only references to TIM13 are aliases:

    #define TIM8_UP_TIM13_IRQn TIM8_UP_IRQn
    #define TIM13_IRQn TIM8_UP_IRQn

    #define TIM8_UP_TIM13_IRQHandler TIM8_UP_IRQHandler
    #define TIM13_IRQHandler TIM8_UP_IRQHandler

    This issue will be handled thanks the Hardware Timer PR #576.

  2. added
    bug 🐛
    on Jul 31, 2019
  3. assigned and unassigned on Jul 31, 2019
  4. added a commit that references this issue on Aug 19, 2019
    b3bbeeb
  5. added this to the 1.7.0 milestone on Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug 🐛

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions