嵌入式技术论坛
直播中

张艳

8年用户 1704经验值
私信 关注
[问答]

rt studio移植lwIP的前段增加PHY时编译报错?

各位前辈,想在rtt studio新建工程上移植lwIP,

rtconfig.h和stm32h7xx_hal_conf.h中的宏定义都开了,
利用cubemx定义了lan8720引脚,
之后分别拷贝了HAL_ETH_MspInit和SystemClock_Config更新了board.c和drv_clk.c文件,
并从gitee下载了drv_eth.c.h更新了工程,
编译后有3个错误,说是drv_eth.c和phy.h中的两个enum中的元素PHY_FULL_DUPLEX重复定义,

处理方法

把phy.h中的enum加extern作声明,enum的定义放到phy.c中。
之后编译出现6个错误,类似DMARxDscrTab、DMATxDscrTab、Rx_Buff重复定义,

Description Resource Path Location Type
multiple definition of `DMARxDscrTab' Ethernet line 0 C/C++ Problem

求助各位大咖,应该如何解决这个问题?

回帖(5)

张涛

2023-2-8 11:33:16
重复定义去除掉就好啊,如果是跟HAL库的宏重复了,建议改驱动的宏。毕竟宏就是一个标识名称,只要具体的值不变,代码在你手里,你可以改的。
举报

张艳

2023-2-8 11:33:27
您好,按照您的建议把cubemx/main.c中的重复定义都注释掉了,最后编译运行,总是弹框提示
"launching ethernet.stlink.debug has encountered a problem"
control信息如下:

Starting server with the following options:
        Persistent Mode            : Disabled
        LogFile Name               : debug.log
        Logging Level              : 31
        Listen Port Number         : 61235
        Status Refresh Delay       : 15s
        Verbose Mode               : Disabled
        SWD Debug                  : Enabled
Target connection mode: Default
Reading ROM table for AP 0 @0xe00fefd0
Hardware watchpoint supported by the target
COM frequency = 4000 kHz
ST-LINK Firmware version : V2J35M26
Device ID: 0x450
PC: 0x80166b0
ST-LINK device status: HALT_MODE
ST-LINK detects target voltage = 3.25 V
ST-LINK device status: HALT_MODE
ST-LINK device initialization OK
Waiting for debugger connection...
Waiting for connection on port 61235...
Accepted connection on port 61235...
Debugger connected
Wrapping read detected. Addr: 0xffffffff; Length: 4
Wrapping read detected. Addr: 0xffffffff; Length: 4
Enter STM32_AppReset() function
NVIC_DFSR_REG = 0x00000009
NVIC_CFGFSR_REG = 0x00000000
Debugger connection lost.
Shutting down...
您能帮忙看看是哪里出错了吗?
举报

张涛

2023-2-8 11:33:35
你没有连接好吧,可能是线松了
举报

张艳

2023-2-8 11:33:41
您好,应该不是线连接的问题,同样的硬件接线,不动,工程换成art-pi板例程,编译运行没有问题
举报

张涛

2023-2-8 11:33:48
你有可以用的工程就对比一下,看哪里设置错了
举报

更多回帖

发帖
×
20
完善资料,
赚取积分