Failure to deprecate __weak HAL_GPIO_EXT1_Callback ( uint16_t GPIO_Pin) in favour of my source
I'm working in STM32 CubeIDE with a Blue Pill board.
To control the size of main.c I have gathered groups of functions together in to several c/h pair files. One of the pairs is 'myirqcallbacks.c/h". At the moment I have two UART IRQs and an external pin IRQ callback in this c/h pair.
The UARTs work fine but the EXT IRQ fails to call my code. It runs the __weak copy in stm32f1xx_hal_gpio.c instead.
When the code was in main.c it ran OK.
It seems that the compiler can't see my EXT IRQ callback function so fails to deprecate the __weak copy of the callback. It can however see the two UART callback functions in there. Is there some difference in the structure of the GPIO and UART IRQs?
myirqcallbacks.h
/*
* myirqcallbacks.h
*
* Created on: 13 May 2020
* Author: Paul
*/
#ifndef SRC_MYIRQCALLBACKS_H_
#define SRC_MYIRQCALLBACKS_H_
void HAL_GPIO_EXT1_Callback ( uint16_t GPIO_Pin); // SIM Reset detected
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart); // Outgoing debug, control and up-the-line data.
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) ; // Data from SIM
#endif /* SRC_MYIRQCALLBACKS_H_ */myirqcallbacks.c
* myirqcallbacks.c
*
* Created on: 13 May 2020
* Author: Paul
*/
#include <circbuf.h>
#include "main.h"
#include "stdio.h"
#include "myfuncs.h"
#include "myirqcallbacks.h"
#include "globals.h"
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) // Outgoing debug, control and up-the-line data.
{
if( huart->Instance == huart1.Instance)
{
if( buf_tx1.count > 0)
{
uint8_t item;
cb_pop_front(&buf_tx1, &item );
if(HAL_UART_Transmit_IT(&huart1, &item, 1 )!= HAL_OK)
Error_Handler();
}
}
__NOP();// Check all data sent
}
//HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
void HAL_GPIO_EXT1_Callback ( uint16_t GPIO_Pin) //Reset UICC detected
{
if( GPIO_Pin == SIM_RST_Pin)
{
HAL_NVIC_ClearPendingIRQ(GPIO_Pin);
SIMState= SIM_STATE_ATR;
SIM_ATR_Processing = 1;
SIM_ATR_BytesExpected = 2; // +last byte will always be TK (CheckByte)
SIM_ATR_COUNT = 0;
debug("\nSIM-Reset! Proc. ATR\n");
}
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) // Data from SIM
{
if( huart->Instance == huart2.Instance)
{
uint8_t item;
if(HAL_UART_Receive_IT(&huart2, &item, 1)!=HAL_OK)
Error_Handler();
//cb_push_back(&buf_rx2, &item); // Still need to send this up the line, just using local copy to set speed and to debug
if(SIM_ATR_Processing)
processATRByte(item);
}
__NOP();// Check all data received
}I'm thinking this is more about my flaky c file structure knowledge than anything else but I've been on it for a couple of days now and any pointers would be very much appreciated.
