Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pkourany opened this issue Jul 30, 2019 · 1 comment
Closed

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

pkourany opened this issue Jul 30, 2019 · 1 comment
Assignees
Labels
bug 🐛 Something isn't working
Milestone

Comments

@pkourany
Copy link
Contributor

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
@fpistm
Copy link
Member

fpistm commented Jul 31, 2019

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.

@fpistm fpistm added the bug 🐛 Something isn't working label Jul 31, 2019
@fpistm fpistm assigned fpistm and ABOSTM and unassigned fpistm Jul 31, 2019
@pkourany pkourany mentioned this issue Aug 7, 2019
ABOSTM added a commit to ABOSTM/Arduino_Core_STM32 that referenced this issue Aug 19, 2019
@fpistm fpistm added this to the 1.7.0 milestone Aug 19, 2019
@fpistm fpistm closed this as completed in cfe6dd8 Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants