Hello,
I created a project on STM32F407ZET6 with Keil µVision V5 14.0.0.
When build project I have these errors:
compiling main.c... compiling os_app_hooks.c... linking... .\Flash\Obj\output.axf: Error: L6218E: Undefined symbol UART1_Init (referred from bsp.o). .\Flash\Obj\output.axf: Error: L6218E: Undefined symbol UART3_Init (referred from bsp.o). .\Flash\Obj\output.axf: Error: L6218E: Undefined symbol UART1_RxDMA_ReceiveLeftStr (referred from main.o). Not enough information to list image symbols. Finished: 1 information, 0 warning and 3 error messages. ".\Flash\Obj\output.axf" - 3 Error(s), 3 Warning(s). Target not created. Build Time Elapsed: 00:00:33
I have included .h files, and added .c files to project group.
Thanks!
Looks like you're still at least one file short. You need to find which file has these USART functions and add that to your project. If you already have the file make sure you have the right defines passed into the compiler.
USART functions files(bsp_uart.c) have added to project, main.c and bsp.c have included "bsp_uart.h". The problem are not simple as they look like.
some codes in main.c:
#include "includes.h" #include "bsp.h"
some codes in bsp.c:
some codes in bsp.h:
#ifndef _BSP_H_ #define _BSP_H_ typedef float fp32; typedef double fp64; #include <stm32f4xx.h> #include "bsp_gpio.h" #include "bsp_fsmc_sram.h" #include "bsp_led.h" #include "bsp_i2c_gpio.h" #include "bsp_eeprom_24xx.h" #include "bsp_spi_flash.h" #include "bsp_dac.h" #include "COMM_Q.h" #include "bsp_uart.h" #include "bsp_dwt.h" #include "dRAM_proto.h" #include "ChannelData.h"
some codes in bsp_uart.h:
/***************************** USART1 Declaration *****************************/ u8 UART1_Init(void); void UART1_GPIO_Config(void); void UART1_Config(void); void UART1_DMA_Config(void); void UART1_NVIC_Config(void); void DMA2_Stream7_IRQHandler(void); void DMA2_Stream5_IRQHandler(void); void UART1_RxDMA_ReceiveLeftStr(void); void UART1_SendData(COMM_Q_char *dp); COMM_Q_Status UART1_GetAllString(COMM_Q_char *dp); COMM_Q_Status UART1_GetDefineString(COMM_Q_char *dp, COMM_Q_char ch); void UART1_RemoveAllSendData(void); /*************************** End USART1 Declaration ***************************/ /***************************** USART3 Declaration *****************************/ u8 UART3_Init(void); void UART3_GPIO_Config(void); void UART3_Config(void); void UART3_DMA_Config(void); void UART3_NVIC_Config(void); void DMA1_Stream3_IRQHandler(void); void DMA1_Stream1_IRQHandler(void); void UART3_RxDMA_ReceiveLeftStr(void); void UART3_SendData(COMM_Q_char *dp); COMM_Q_Status UART3_GetAllString(COMM_Q_char *dp); COMM_Q_Status UART3_GetDefineString(COMM_Q_char *dp, COMM_Q_char ch); void UART3_RemoveAllSendData(void); /*************************** End USART3 Declaration ***************************/
OK, but where is the code in bsp_uart.c?
Is that dependent on a define? For whatever reason the body of the functions are not getting compiled. This should be apparent with careful evaluation of the source.
Because have writed description, so there's no post codes.
some codes in bsp_uart.c:
#include "bsp.h" /***************************** USART1 Definition *****************************/ static OS_EVENT *UART1Sem; static UART_Data_t Uart1_Data; static COMM_Q_char UART1_RxTmpBuf[UART1_FIFO_LENGTH + 1]; static DMA_InitTypeDef DMA_UART1TxStructure; static DMA_InitTypeDef DMA_UART1RxStructure; /*************************** End USART1 Definition ***************************/ /***************************** USART3 Definition *****************************/ static OS_EVENT *UART3Sem; static UART_Data_t Uart3_Data; /*************************** End USART3 Definition ***************************/ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // USART1 Function // USART1 work with DMA mode using DMA2_Stream5 and DMA2_Stream7. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ /*+++++ association code +++++*/ /****************************************************************************** * UART1_Init() * * Description : Initialize the USART1 peripheral. * Argument(s) : none. * Return(s) : TRUE or FALSE. * Caller(s) : BSP_Init(). * Note(s) : none ******************************************************************************/ u8 UART1_Init(void) { COMM_Q_Status tmpSts; UART1_GPIO_Config(); UART1_Config(); UART1_DMA_Config(); UART1_NVIC_Config(); tmpSts = COMM_QCreate(&Uart1_Rx_Q, Uart1_Data.RxBuffer, UART1_RxBufferSize); if (tmpSts == COMM_Q_FAILURE) { return FALSE; } tmpSts = COMM_QCreate(&Uart1_Tx_Q, Uart1_Data.TxBuffer, UART1_TxBufferSize); if (tmpSts == COMM_Q_FAILURE) { return FALSE; } UART1Sem = OSSemCreate(1); if (UART1Sem == NULL) { return FALSE; } return TRUE; } /*+++++ association code +++++*/ /****************************************************************************** * UART3_Init() * * Description : Initialize the USART3 peripheral. * Argument(s) : none. * Return(s) : TRUE or FALSE. * Caller(s) : BSP_Init(). * Note(s) : none ******************************************************************************/ u8 UART3_Init(void) { COMM_Q_Status tmpSts; UART3_GPIO_Config(); UART3_Config(); UART3_DMA_Config(); UART3_NVIC_Config(); tmpSts = COMM_QCreate(&Uart3_Rx_Q, Uart3_Data.RxBuffer, UART3_RxBufferSize); if (tmpSts == COMM_Q_FAILURE) { return FALSE; } tmpSts = COMM_QCreate(&Uart3_Tx_Q, Uart3_Data.TxBuffer, UART3_TxBufferSize); if (tmpSts == COMM_Q_FAILURE) { return FALSE; } UART3Sem = OSSemCreate(1); if (UART3Sem == NULL) { return FALSE; } return TRUE; } /*+++++ association code +++++*/ /****************************************************************************** * UART1_RxDMA_ReceiveLeftStr() * * Description : * Argument(s) : none. * Return(s) : none. * Caller(s) : none. * Note(s) : none ******************************************************************************/ void UART1_RxDMA_ReceiveLeftStr(void) { u16 i; COMM_QPushStr(&Uart1_Rx_Q, UART1_RxTmpBuf); DMA_Cmd(DMA2_Stream5, DISABLE); DMA_UART1RxStructure.DMA_MemoryBaseAddr = (u32)UART1_RxTmpBuf; DMA_UART1RxStructure.DMA_BufferSize = (u32)UART1_FIFO_LENGTH; DMA_Init(DMA2_Stream5, &DMA_UART1RxStructure); DMA_Cmd(DMA2_Stream5, ENABLE); for (i=0; i<UART1_FIFO_LENGTH+1; i++) { UART1_RxTmpBuf[i] = 0; } }
Finded the reason of error.
Click the right mouse button to view file "bsp_uart.c" options, The 'Path' is wrong, correct path and rebuild project, compiling is OK.
Hello! I solved this problem.You maybe no adding Uart .c source files.