When udelay() (from generic/armcm_timer.h) is used in my code, it compiles for STM32F103, but fails for STM32G0B1.
Well, checking Makefile in stm32 folder shows,that G0 didn’t use armcm_timer code:
timer-src-y := generic/armcm_timer.c
timer-src-$(CONFIG_MACH_STM32F0) := generic/timer_irq.c stm32/stm32f0_timer.c
timer-src-$(CONFIG_MACH_STM32G0) := generic/timer_irq.c stm32/stm32f0_timer.c
Is there any reason, why udelay() not included into stm32f0_timer.c?
Maybe we need small follow-up for this commit? https://github.com/Klipper3d/klipper/commit/700e35c6ac74a64719fbc38fe66386dd422613f3
Thanks.
To reduce duplication, I put ‘weak’ attribute in my code:
Is this variant applicable?
Originally my goal was to try to avoid adding delays to the code, as we generally try to keep the micro-controller code fast. However, certain devices ultimately require delays so there have been a few cases where udelay() and/or ndelay() are needed.
It probably would be better to introduce generic versions of these functions and share their implementation across all the code.
The armcm variant could likely be renamed to early_udelay() as it has slightly different semantics than typical udelay() users (some boards may need a delay prior to the main timer code being initialized).
Cheers,
-Kevin
1 Like