cancel
Showing results for 
Search instead for 
Did you mean: 

Error while running linker (USART)

fenice-6
Associate II
Posted on August 03, 2015 at 18:05

Hello,

I'm using theSTM32F030R8T6 microcontroller and IAR IDE. The following is a part of code that I'm using:


USART_InitTypeDef USART_InitStructure;

GPIO_InitTypeDef GPIO_InitStructure;


RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);


RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);


GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_1);

GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_1);


/* Configure USART1 pins: Rx and Tx ----------------------------*/

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;

GPIO_Init(GPIOA, &GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;

GPIO_Init(GPIOA, &GPIO_InitStructure);



USART_InitStructure.USART_BaudRate = 38400;

USART_InitStructure.USART_WordLength = USART_WordLength_8b;

USART_InitStructure.USART_StopBits = USART_StopBits_1;

USART_InitStructure.USART_Parity = USART_Parity_No;

USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

USART_Init(USART1, &USART_InitStructure);


USART_Cmd(USART1,ENABLE);

I put:

1.
#ifdef USE_STDPERIPH_DRIVER
2.
#include ''stm32f0xx_conf.h''
3.
#endif /* USE_STDPERIPH_DRIVER */

and in the project configuration i put STM32F0XX USE_STDPERIPH_DRIVER and this is the error: Error[Li005]: no definition for ''USART_Init'' [referenced from C:\Users\...\Debug\Obj\ filename.o] Error[Li005]: no definition for ''USART_Cmd'' [referenced from C:\Users\...\Debug\Obj\ filename.o] Error while running Linker Can you give me a little help?
2 REPLIES 2
Posted on August 03, 2015 at 18:15

Can you give me a little help?

You need to add stm32f0xx_usart.c to the files in your project. ie Add an existing file, browse to the directory with the library source in it.

Also you should just need to #include ''stm32f0xx.h'', this should pull in the conf.h file based on the define to use the peripheral libray

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
fenice-6
Associate II
Posted on August 03, 2015 at 18:27

Oh my god! You solved my problem in 1 minute! Thank you so much!