I am trying to run a simple tutorial (external interrupt example) on my NUCLEO-F746ZG board. I use STM32CubeMx software version 5.2.0 and Keil software version 5.28.0.0 as compiler. I get the following error:
EXTI_callback\EXTI_callback.axf: Error: L6218E: Undefined symbol ex0 (referred from stm32f7xx_it.o). Not enough information to list image symbols. Not enough information to list load addresses in the image map. Finished: 2 information, 0 warning and 1 error messages. Target not created.
where ex0 is a variable that is defined in main.c as
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
char ext0;
/* USER CODE END PV */
and it is used as the external variable inside the stm32f7xx_it.c as follows :
/* External variables --------------------------------------------------------*/
/* USER CODE BEGIN EV */
extern char ex0;
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
if ( GPIO_Pin == GPIO_PIN_13 ) {
ex0 = 1;
}
}
/* USER CODE END EV */
by using the HAL_GPIO_EXTI_Callback function I want to assign the value of 1 to the ex0 variable, whenever the blue push button (GPIO_PIN_13) is pressed on the NUCLEO-F746ZG board.
It seems the code can not find the reference to ex0 variable, while it is defined in the main.c file. I don't understand what is cause of this problem. Should I add some .h / .c files to the my project? In addition, many users have also complained about the "Error: L6218E: Undefined symbol VAR_NAME" when they have tried to compile their code with Keil Software. I have read some of them, but I didn't find the main reason behind this error. I appreciate those of you who can share their experience on how to solve this error.