Hi I am Renjith. I am very new to keil IDE and also STM32f4 Discovery. While doing a GPIO project, i have got output through register configuration. The same project was done using stm32 standard gpio library, its showing linking error, I have tried my level best but could not rectify, so kindly please help....
#include "stm32f4xx.h" #include "stm32f4xx_rcc.h" #include "stm32f4xx_gpio.h" GPIO_InitTypeDef GPIO_InitDef; int main(void) { RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE); GPIO_InitDef.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14; GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitDef.GPIO_OType = GPIO_OType_PP; GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_InitDef.GPIO_Speed = GPIO_Speed_100MHz; //Initialize pins GPIO_Init(GPIOD, &GPIO_InitDef); //volatile int i; while (1) { GPIO_SetBits(GPIOD, GPIO_Pin_13 | GPIO_Pin_14); } }
And i got this error Rebuild target 'main' compiling Main.c... assembling startup_stm32f407xx.s... compiling system_stm32f4xx.c... linking... .\Objects\main.axf: Error: L6218E: Undefined symbol GPIO_Init (referred from main.o). .\Objects\main.axf: Error: L6218E: Undefined symbol GPIO_SetBits (referred from main.o). .\Objects\main.axf: Error: L6218E: Undefined symbol RCC_AHB1PeriphClockCmd (referred from main.o). Not enough information to list image symbols. Finished: 1 information, 0 warning and 3 error messages. ".\Objects\main.axf" - 3 Error(s), 0 Warning(s). Target not created. Build Time Elapsed: 00:00:04
Please help me to find a solution.
The OP is not using the HAL, but rather the SPL
Include files define the interface to the functions, they do not provide the code.
The project would need to have stm32f4xx_rcc.c and stm32f4xx_gpio.c added for the linker to get complete properly.