OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 3665|回复: 1

Not enough information to list image symbols.

[复制链接]

3

主题

17

帖子

0

精华

初级会员

Rank: 2

积分
96
金钱
96
注册时间
2020-9-30
在线时间
22 小时
发表于 2020-10-28 22:59:39 | 显示全部楼层 |阅读模式
串口接收程序,他报错说我重复定义函数,但是视频里面说这些函数是弱定义函数,可以重新定义的:
#include "sys.h"
#include "delay.h"
#include "usart.h"

UART_HandleTypeDef usart1_handler;
//′®¿úÅäÖÃoˉêy

u8 rdate[1];
void uart1_init ()
{
           usart1_handler.Instance=USART1;
                 usart1_handler.Init.BaudRate=115200;
           usart1_handler.Init.WordLength=USART_WORDLENGTH_8B;
     usart1_handler.Init.StopBits=USART_STOPBITS_1;
           usart1_handler.Init.HwFlowCtl=UART_HWCONTROL_NONE;
           usart1_handler.Init.Mode=UART_MODE_TX_RX; //êÕ·¢Ä£ê½
           usart1_handler.Init.Parity= USART_PARITY_NONE;
     HAL_UART_Init(&usart1_handler);//μ÷óÿa′®¿ú3õê¼»ˉoˉêy
       
}

void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{
   GPIO_InitTypeDef GPIO_Initure;
        if(huart->Instance==USART1)//èç1ûêÇ′®¿ú1£¬½øDD′®¿ú1 MSP3õê¼»ˉ,°å×óĬèÏ′®¿úò»êÇ×óÏ·½usb¿ú£¬
        {
                __HAL_RCC_GPIOA_CLK_ENABLE();                        //ê1ÄüGPIOAê±Öó
                __HAL_RCC_USART1_CLK_ENABLE();                        //ê1ÄüUSART1ê±Öó
       
                GPIO_Initure.Pin=GPIO_PIN_9;                        //PA9
                GPIO_Initure.Mode=GPIO_MODE_AF_PP;                //¸′óÃíÆíìêä3ö
                GPIO_Initure.Pull=GPIO_PULLUP;                        //éÏà-
                GPIO_Initure.Speed=GPIO_SPEED_FAST;                //¸ßËù
                GPIO_Initure.Alternate=GPIO_AF7_USART1;        //¸′óÃÎaUSART1
                HAL_GPIO_Init(GPIOA,&GPIO_Initure);                   //3õê¼»ˉPA9

                GPIO_Initure.Pin=GPIO_PIN_10;                        //PA10
                HAL_GPIO_Init(GPIOA,&GPIO_Initure);                   //3õê¼»ˉPA10
               
                HAL_NVIC_SetPriority(USART1_IRQn,3,3);       //éèÖÃÖD¶ÏóÅÏè¼¶   
                HAL_NVIC_EnableIRQ(USART1_IRQn);               //ê1ÄüÖD¶Ïí¨μà
               
        }
}
        void  USART1_IRQHandler(void)   //ÖD¶Ï·tÎñoˉêy
        {
       
          HAL_UART_IRQHandler(&usart1_handler);
                 HAL_UART_Receive_IT(&usart1_handler,rdate,sizeof(rdate));
       
        }
       
        void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
        {
           u8 rec;
                if(huart->Instance==USART1)
                {
                        rec=*((huart->pRxBuffPtr)-1);
                        //rec=rdate[0];
                HAL_UART_Transmit(&usart1_handler,&rec,1,1000);
                }
               
        }
       
       
int main(void)
{
       
        Cache_Enable();         //′ò¿aL1-cache
        HAL_Init();                                        //3õê¼»ˉHAL¿a
        Stm32_Clock_Init(432,25,2,9);   //éèÖÃê±Öó,216Mhz
        //Stm32_Clock_Init(360,25,2,8);   //éèÖÃê±Öó,216Mhz

   delay_init(216);
         
         uart1_init ();
         
         HAL_UART_Receive_IT(&usart1_handler,rdate,sizeof(rdate));    //ê1Äü½óêÕÖD¶Ï
                while (1)
                {
               
                //HAL_USART_Transmit(&usart1_handler,buff,sizeof(buff),1000);//1.¾ä±ú2.êy¾YÖ¸Õë3.òa·¢Ëí¶àéù¸ö×Ö½ú4.3¬ê±ê±¼ä
                //delay_ms(300);
                }
               
       
}

报错:
*** Using Compiler 'V5.06 update 3 (build 300)', folder: 'D:\ARM\ARMCC\Bin'
Build target 'Template'
compiling main.c...
linking...
..\OBJ\Template.axf: Error: L6200E: Symbol HAL_UART_MspInit multiply defined (by usart.o and main.o).
..\OBJ\Template.axf: Error: L6200E: Symbol HAL_UART_RxCpltCallback multiply defined (by usart.o and main.o).
..\OBJ\Template.axf: Error: L6200E: Symbol USART1_IRQHandler multiply defined (by usart.o and main.o).
Not enough information to list image symbols.
Not enough information to list the image map.
Finished: 2 information, 0 warning and 3 error messages.
"..\OBJ\Template.axf" - 3 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed:  00:00:04

求大佬解决
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

3

主题

17

帖子

0

精华

初级会员

Rank: 2

积分
96
金钱
96
注册时间
2020-9-30
在线时间
22 小时
 楼主| 发表于 2020-12-6 17:10:01 | 显示全部楼层
知道了,只要把usart里面的重定义给屏蔽就可以了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-23 11:58

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表