GD32F130 GPIO EXTI4-15 interrupt handler is slow, would be nice to be able to override it #106
Labels
Component: GPIO/Interrupts
Regarding the GPIO or interrupts component
enhancement
New feature or request
I'm working to help implement a SimpleFOC algorithm for GD32F130-based hoverboards, and running into timing issues with interrupt handling. The GD32F130C8 used on those boards runs at only 48MHz, so every instruction counts when responding to an interrupt.
The current code in this repository is suboptimal in two areas especially when using pins with a high number (e.g. PC14)
EXTI4_15_IRQHandler() calls exti_callbackHandler 11 times before finally servicing PC14 and invoking the relevant callback, plus one more time after the callback. As a generic implementation, that works well. But considering in our project we use PC14 and PB11 for Hall sensors, that adds a non-trivial amount of overhead.
Knowing we have only 2 possible EXTI sources, our code could be as follows
Would it be possible to define the EXTI IRQ handlers with
__attribute__((weak))
so that they can be overridden by our implementation? I would like to build as much as possible on top of the un-modified GD32 Arduino core. Not sure if that would conflict with the.weak EXTI4_15_IRQHandler
definition in startup_gd32f1x0.S, though. I found this warning "If multiple weak definitions are available, the linker generates an error message, unless the linker option --muldefweak is used. In this case, the linker chooses one for use by all calls.", so I'm not sure how that would work. Maybe a global define to enable IRQ handler redefinition?The text was updated successfully, but these errors were encountered: