Page 1 of 1

TIMv1 driver define error

Posted: Fri Mar 27, 2020 2:59 pm
by srichard95
Dear Giovanni,

I have started to use the newest version of the ChibiOS and during the compiling i got errors to ICUD7, PWMD7. The TIMER7 is used for GPT.

Chibios version: ChibiOS 20.3.0
Platform: STM32
Compiler: gcc-arm-none-eabi-8-2018-q4-major

I take a look at to the "os/hal/ports/STM32/stm32_tim7.inc" and i found this at line 95:

Code: Select all

/**
 * @brief   TIM7 interrupt handler.
 *
 * @isr
 */
OSAL_IRQ_HANDLER(STM32_TIM7_HANDLER) {

  OSAL_IRQ_PROLOGUE();

#if HAL_USE_GPT
#if STM32_GPT_USE_TIM7
  gpt_lld_serve_interrupt(&GPTD7);
#endif
#endif
#if HAL_USE_ICU
  icu_lld_serve_interrupt(&ICUD7);
#endif
#if HAL_USE_PWM
  pwm_lld_serve_interrupt(&PWMD7);
#endif
#if 1
#if STM32_ST_USE_TIM7
  st_lld_serve_interrupt();
#endif
#endif

  OSAL_IRQ_EPILOGUE();
}


The compiler gives an error because ICU is activated and tries to call ICU "lld_serve_interrupt" but ICUD7 is not activated. If the ICU and PWM subsystem activeted it also tries to call both lld functions which I guess is not functional.

I have made the following changes and the errors fixed:

Code: Select all

/**
 * @brief   TIM7 interrupt handler.
 *
 * @isr
 */
OSAL_IRQ_HANDLER(STM32_TIM7_HANDLER) {

  OSAL_IRQ_PROLOGUE();

#if HAL_USE_GPT
#if STM32_GPT_USE_TIM7
  gpt_lld_serve_interrupt(&GPTD7);
#endif
#endif
#if HAL_USE_ICU
#if STM32_ICU_USE_TIM7
  icu_lld_serve_interrupt(&ICUD7);
#endif
#endif
#if HAL_USE_PWM
#if STM32_PWM_USE_TIM7
  pwm_lld_serve_interrupt(&PWMD7);
#endif
#endif
#if 1
#if STM32_ST_USE_TIM7
  st_lld_serve_interrupt();
#endif
#endif

  OSAL_IRQ_EPILOGUE();
}


In that case i can activate ICU and PWM subsystem while I using the TIMER7 for GPT. It is the same error for TIM6. I suppose it is a bug. If not, i apologize for take your time.

Best regards
Richard

Re: TIMv1 driver define error

Posted: Fri Mar 27, 2020 4:08 pm
by Giovanni
Hi Richard,

Thanks for finding, it is an obvious error, there is a missing check there. Will be fixed in next version and in trunk ASAP.

Giovanni

Re: TIMv1 driver define error

Posted: Fri Mar 27, 2020 4:20 pm
by Giovanni
Fixed as bug #1078 in repository.

Giovanni