Triggering an external interrupt and attended using the library callback

The HAL library is no designed for the user to place other code than the IRQ routines calls. Its in the Callbacks where all the proper code shall be located

#include "bsp.h"

int main(void)
{
    GPIO_InitTypeDef GPIO_InitStruct;               /*gpios initial structure*/
    
    HAL_Init();                                     /*Init HAL library*/
    __HAL_RCC_GPIOA_CLK_ENABLE();                   /*Enable clock on port A*/
  
    GPIO_InitStruct.Pin = GPIO_PIN_5;               /*pin to set as output*/
    GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;     /*input on mode faling edge interrupt*/
    GPIO_InitStruct.Pull = GPIO_NOPULL;             /*no pull-up niether pull-down*/
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;    /*pin speed*/
    /*use the previous parameters to set configuration on pin A5*/
    HAL_GPIO_Init( GPIOA, &GPIO_InitStruct );
    
    /*Enable interrupt vector EXTI4_15_IRQ where the CPU will jump if a input change
    happens on pins 4 to 15*/
    HAL_NVIC_SetPriority( EXTI4_15_IRQn, 2, 0 );
    HAL_NVIC_EnableIRQ( EXTI4_15_IRQn );

    while (1)
    {
        
    }
}

/* when the pin changes from high to low this function will be called by HAL_GPIO_EXTI_IRQHandler
which is in turn called from the EXTI4_15_IRQHandler interrupt vector*/
void HAL_GPIO_EXTI_Falling_Callback( uint16_t GPIO_Pin )
{
    /*do something while still in the ISR*/    
}

ints.c

/*Declare interrupt service rutine as it is declare in startup_stm32g0b1xx.s file
program will jump here every time the button has been pressed*/
void EXTI4_15_IRQHandler( void )
{
    /*HAL library functions that attend interrupt on inputs*/
    HAL_GPIO_EXTI_IRQHandler( GPIO_PIN_5 );
}