Bug: CubeMX generated code does use EXTI RegisterCallback when set in .ioc
Setup:
- STM32CubeMX Version v6.14.0
- SMT32Cube FW_G4 V1.16.0
Problem Description:
When enabling RegisterCallback for EXTI Interrupts, the generated code still calls a predefined interrupt callback for EXTI interrupts and does not call the registered callback function.
/**
* @brief Handle EXTI interrupt request.
* @PAram GPIO_Pin Specifies the port pin connected to corresponding EXTI line.
* @retval None
*/
void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin)
{
/* EXTI line interrupt detected */
if (__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != 0x00u)
{
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
HAL_GPIO_EXTI_Callback(GPIO_Pin);
}
}
/**
* @brief EXTI line detection callback.
* @PAram GPIO_Pin: Specifies the port pin connected to corresponding EXTI line.
* @retval None
*/
__weak void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(GPIO_Pin);
/* NOTE: This function should not be modified, when the callback is needed,
the HAL_GPIO_EXTI_Callback could be implemented in the user file
*/
}The generated code sets the correct #define value, but the define value is not referenced anywhere in the code.
#define USE_HAL_EXTI_REGISTER_CALLBACKS 1U
Expected: The interrupt calls the registered callback function instead.
How to reproduce:
- Enable EXTI Register Callback:

- Set a GPIO to trigger an interrupt:

- Enable interrupt for the GPIOs EXTI line

- Generate Code
- The generated interrupt handler does not call the registered interrupt. Instead, it uses the normal interrupt function just as if RegisterCallback for EXTI is disabled.
