本帖最后由 tpgf 于 2023-8-15 11:55 编辑
前言
mcu1-0是tda4 mcu域的一个r核,可用于ADAS(Advanced Driver Assistance Systems,高级驾驶辅助系统),汽车网络和通信,多媒体和信息娱乐系统,车载网关和控制单元。
ti官方已经提供了基于lwip协议栈的以太网参考程序,在rtos_sdk的pdk_jacinto_08_04_00_21/packages/ti/drv/enet/examples/enet_lwip_example路径,此例程可作为一个独立的app跑到mcu1-0上。在pdk_jacinto_08_04_00_21/packages/ti/build路径下make enet_lwip_example_freertos BOARD=j721e_evm CORE=mcu1_0编译。
此方法仅限于测试以太网,实际开发应在ti默认app上进行开发,代码路径vision_apps/platform/j721e/rtos/mcu1_0/main.c。
接下来的讲解仅限mcu1-0 跑rtos系统的,本人调试过的一些笔记和总结,仅限参考。
提示:以下是本篇文章正文内容,下面案例可供参考
一、参考例程
参考例程官方已给出详细讲解,它是作为一个独立的app存在的,不建议直接使用。而是编库再去调用。看了这个参考程序,整个流程跟下图大致相同。
二、如何编库
我将其编成enet_lwip_my.xer5f库,将其链接到mcu1-0。makefile文件参考
include $(PDK_INSTALL_PATH)/ti/drv/enet/examples/build/config.mk
MODULE_NAME = enet_lwip_my
# lwip example dir
SRCDIR += .
INCDIR += .
ifeq ($(BUILD_OS_TYPE),freertos)
ENET_CFLAGS += -DFREERTOS
endif
# List all the external components/interfaces, whose interface header files
# need to be included for this component
INCLUDE_EXTERNAL_INTERFACES += pdk
INCLUDE_INTERNAL_INTERFACES += lwipif_$(BUILD_OS_TYPE)
INCLUDE_INTERNAL_INTERFACES += lwipstack_$(BUILD_OS_TYPE)
INCLUDE_INTERNAL_INTERFACES += lwipcontrib_$(BUILD_OS_TYPE)
INCLUDE_INTERNAL_INTERFACES += lwipport_$(BUILD_OS_TYPE)
# List all the components required by the application
COMP_LIST_COMMON += enet enetsoc enetphy enet_example_utils_full$(ENET_OS_TYPE_POSTFIX)
COMP_LIST_COMMON += lwipif$(ENET_OS_TYPE_POSTFIX)
COMP_LIST_COMMON += lwipstack$(ENET_OS_TYPE_POSTFIX)
COMP_LIST_COMMON += lwipcontrib$(ENET_OS_TYPE_POSTFIX)
COMP_LIST_COMMON += lwipport$(ENET_OS_TYPE_POSTFIX)
# Enable TimeSync on SoCs that have support on Enet timesync PTP demo library
ifeq ($(SOC),$(filter $(SOC), j721e j7200 j721s2 j784s4))
ifeq ($(CORE),$(filter $(CORE), mcu2_0))
COMP_LIST_COMMON += enet_timesync_hal enet_timesync_ptp
CFLAGS_LOCAL_COMMON += -DENET_ENABLE_TIMESYNC
endif
endif
ifeq ($(SOC),$(filter $(SOC), am65xx))
ifeq ($(CORE),$(filter $(CORE), mcu1_0))
COMP_LIST_COMMON += enet_timesync_hal enet_timesync_ptp
CFLAGS_LOCAL_COMMON += -DENET_ENABLE_TIMESYNC
endif
endif
# Common source files and CFLAGS across all platforms and cores
SRCS_COMMON += main.c
SRCS_COMMON += test.c
SRCS_COMMON += udp_iperf.c
SRCS_COMMON += test_config_$(SOC).c
CFLAGS_LOCAL_COMMON += $(PDK_CFLAGS) $(ENET_CFLAGS)
# Common source files and CFLAGS across all platforms and cores
PACKAGE_SRCS_COMMON = makefile
PACKAGE_SRCS_COMMON += main.c test.c lwipcfg.h
PACKAGE_SRCS_COMMON += udp_iperf.c udp_iperf.h
PACKAGE_SRCS_COMMON += test_config_$(SOC).c test_config.h
# Core/SoC/platform specific source files and CFLAGS
# Example:
# SRCS_<core/SoC/platform-name> =
# CFLAGS_LOCAL_<core/SoC/platform-name> =
# Temporary override for "_SYS_SELECT_H" redefined warning
ifeq ($(CORE), mpu1_0)
CFLAGS_LOCAL_COMMON += -std=c99
endif
# Include common make files
ifeq ($(MAKERULEDIR), )
#Makerule path not defined, define this and assume relative path from ROOTDIR
MAKERULEDIR := $(ROOTDIR)/ti/build/makerules
export MAKERULEDIR
endif
include $(MAKERULEDIR)/common.mk
pdk_jacinto_08_04_00_21/packages/ti/drv/enet/enet_component.mk文件添加
export enet_lwip_my_COMP_LIST = enet_lwip_my
enet_lwip_my_RELPATH = ti/drv/enet/examples/enet_lwip_my
enet_lwip_my_PATH = $(PDK_ENET_COMP_PATH)/examples/enet_lwip_my
export enet_lwip_my_LIBNAME = enet_lwip_my
export enet_lwip_my_LIBPATH = $(PDK_ENET_COMP_PATH)/lib
export enet_lwip_my_MAKEFILE = -fmakefile
export enet_lwip_my_BOARD_DEPENDENCY = no
export enet_lwip_my_CORE_DEPENDENCY = no
enet_lwip_my_PKG_LIST = enet_lwip_my
enet_lwip_my_INCLUDE = $(enet_lwip_my_PATH)
export enet_lwip_my_SOCLIST = $(drvenet_SOCLIST)
export enet_lwip_my_$(SOC)CORELIST = $(drvenet$(SOC)_CORELIST)
enet_LIB_LIST += enet_lwip_my
在pdk_jacinto_08_04_00_21/packages/ti/build下make enet_lwip_my BOARD=j721e_evm CORE=mcu1_0可编出enet_lwip_my.xer5f库。
配置
*enetType = ENET_CPSW_2G;
*instId = 0U;
*macPort = ENET_MAC_PORT_1;
*boardId = ENETBOARD_CPB_ID;
mii->layerType = ENET_MAC_LAYER_GMII;
mii->sublayerType = ENET_MAC_SUBLAYER_REDUCED;
mii->variantType = ENET_MAC_VARIANT_NONE;
linkCfg->speed = ENET_SPEED_1GBIT;
linkCfg->duplexity = ENET_DUPLEX_FULL;
总结
此讲解仅限于本人条件mcu1-0的总结,以个人实际调试情况变通。
————————————————
版权声明:本文为CSDN博主「HQK666999」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_47300000/article/details/132081967
|