diff --git a/Ubiquitous/XiZi_IIoT/board/imxrt1176-sbc/third_party_driver/ethernet/Kconfig b/Ubiquitous/XiZi_IIoT/board/imxrt1176-sbc/third_party_driver/ethernet/Kconfig index 5753d8854..7e37be3cd 100755 --- a/Ubiquitous/XiZi_IIoT/board/imxrt1176-sbc/third_party_driver/ethernet/Kconfig +++ b/Ubiquitous/XiZi_IIoT/board/imxrt1176-sbc/third_party_driver/ethernet/Kconfig @@ -6,3 +6,6 @@ config BOARD_NETWORK_USE_1G_ENET_PORT bool "Enable 1000M Enet Port" default y +config LWIP_REASSEMBLY_FRAG + bool + default y \ No newline at end of file diff --git a/Ubiquitous/XiZi_IIoT/board/imxrt1176-sbc/third_party_driver/ethernet/enet_ethernetif.c b/Ubiquitous/XiZi_IIoT/board/imxrt1176-sbc/third_party_driver/ethernet/enet_ethernetif.c index 641c66436..b7bf34f03 100644 --- a/Ubiquitous/XiZi_IIoT/board/imxrt1176-sbc/third_party_driver/ethernet/enet_ethernetif.c +++ b/Ubiquitous/XiZi_IIoT/board/imxrt1176-sbc/third_party_driver/ethernet/enet_ethernetif.c @@ -211,9 +211,10 @@ void ethernetif_phy_init(struct ethernetif *ethernetif, * * @param netif the lwip network interface structure for this ethernetif */ -void ethernetif_input(struct netif *netif) +void ethernetif_input(void *netif_arg) { struct pbuf *p; + struct netif *netif = (struct netif *)netif_arg; LWIP_ASSERT("netif != NULL", (netif != NULL)); diff --git a/Ubiquitous/XiZi_IIoT/board/imxrt1176-sbc/third_party_driver/include/enet_ethernetif.h b/Ubiquitous/XiZi_IIoT/board/imxrt1176-sbc/third_party_driver/include/enet_ethernetif.h index ca5ade06b..6c552e28c 100644 --- a/Ubiquitous/XiZi_IIoT/board/imxrt1176-sbc/third_party_driver/include/enet_ethernetif.h +++ b/Ubiquitous/XiZi_IIoT/board/imxrt1176-sbc/third_party_driver/include/enet_ethernetif.h @@ -159,7 +159,7 @@ err_t ethernetif1_init(struct netif *netif); * * @param netif the lwip network interface structure for this ethernetif */ -void ethernetif_input( struct netif *netif); +void ethernetif_input( void *netif_arg); int ETH_BSP_Config(void); void *ethernetif_config_enet_set(uint8_t enet_port); diff --git a/Ubiquitous/XiZi_IIoT/board/ok1052-c/third_party_driver/ethernet/enet_ethernetif.c b/Ubiquitous/XiZi_IIoT/board/ok1052-c/third_party_driver/ethernet/enet_ethernetif.c index 764637188..47039f742 100755 --- a/Ubiquitous/XiZi_IIoT/board/ok1052-c/third_party_driver/ethernet/enet_ethernetif.c +++ b/Ubiquitous/XiZi_IIoT/board/ok1052-c/third_party_driver/ethernet/enet_ethernetif.c @@ -198,9 +198,10 @@ void ethernetif_phy_init(struct ethernetif *ethernetif, * @param netif the lwip network interface structure for this ethernetif */ -void ethernetif_input(struct netif *netif) +void ethernetif_input(void *netif_arg) { struct pbuf *p; + struct netif *netif = (struct netif *)netif_arg; err_t ret = 0; LWIP_ASSERT("netif != NULL", (netif != NULL)); diff --git a/Ubiquitous/XiZi_IIoT/board/ok1052-c/third_party_driver/include/enet_ethernetif.h b/Ubiquitous/XiZi_IIoT/board/ok1052-c/third_party_driver/include/enet_ethernetif.h index 1a8abf2ab..7b8c20c95 100755 --- a/Ubiquitous/XiZi_IIoT/board/ok1052-c/third_party_driver/include/enet_ethernetif.h +++ b/Ubiquitous/XiZi_IIoT/board/ok1052-c/third_party_driver/include/enet_ethernetif.h @@ -179,7 +179,7 @@ err_t ethernetif1_init(struct netif *netif); * * @param netif the lwip network interface structure for this ethernetif */ -void ethernetif_input( struct netif *netif); +void ethernetif_input( void *netif_arg); void ETH_BSP_Config(void); void *ethernetif_config_enet_set(uint8_t enet_port); diff --git a/Ubiquitous/XiZi_IIoT/board/xidatong-arm32/third_party_driver/ethernet/enet_ethernetif.c b/Ubiquitous/XiZi_IIoT/board/xidatong-arm32/third_party_driver/ethernet/enet_ethernetif.c index 1b32163dd..292ee307b 100755 --- a/Ubiquitous/XiZi_IIoT/board/xidatong-arm32/third_party_driver/ethernet/enet_ethernetif.c +++ b/Ubiquitous/XiZi_IIoT/board/xidatong-arm32/third_party_driver/ethernet/enet_ethernetif.c @@ -201,9 +201,10 @@ void ethernetif_phy_init(struct ethernetif *ethernetif, * @param netif the lwip network interface structure for this ethernetif */ -void ethernetif_input(struct netif *netif) +void ethernetif_input(void *netif_arg) { struct pbuf *p; + struct netif *netif = (struct netif *)netif_arg; err_t ret = 0; LWIP_ASSERT("netif != NULL", (netif != NULL)); diff --git a/Ubiquitous/XiZi_IIoT/board/xidatong-arm32/third_party_driver/include/enet_ethernetif.h b/Ubiquitous/XiZi_IIoT/board/xidatong-arm32/third_party_driver/include/enet_ethernetif.h index fc96b93a2..7978b36b6 100755 --- a/Ubiquitous/XiZi_IIoT/board/xidatong-arm32/third_party_driver/include/enet_ethernetif.h +++ b/Ubiquitous/XiZi_IIoT/board/xidatong-arm32/third_party_driver/include/enet_ethernetif.h @@ -179,7 +179,7 @@ err_t ethernetif1_init(struct netif *netif); * * @param netif the lwip network interface structure for this ethernetif */ -void ethernetif_input( struct netif *netif); +void ethernetif_input( void *netif_arg); int ETH_BSP_Config(void); void *ethernetif_config_enet_set(uint8_t enet_port); diff --git a/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/config.mk b/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/config.mk index 53f596df6..a9bcb3314 100644 --- a/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/config.mk +++ b/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/config.mk @@ -5,15 +5,29 @@ export AFLAGS := -c -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections ### if use USB function, use special lds file because USB uses ITCM -ifeq ($(CONFIG_BSP_USING_USB),y) -export LFLAGS := -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi_xidatong.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link-usb.lds +ifeq ($(CONFIG_LIB_MUSLLIB), y) +export LFLAGS += -nostdlib -nostdinc # -fno-builtin -nodefaultlibs +export LIBCC := -lgcc +export LINK_MUSLLIB := $(KERNEL_ROOT)/lib/musllib/libmusl.a +endif + +ifeq ($(CONFIG_RESOURCES_LWIP), y) +export LINK_LWIP := $(KERNEL_ROOT)/resources/ethernet/LwIP/liblwip.a +endif + +ifeq ($(CONFIG_MCUBOOT_BOOTLOADER),y) +export LFLAGS += -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-xiwangtong-arm32-boot.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link-bootloader.lds +else ifeq ($(CONFIG_MCUBOOT_APPLICATION),y) +export LFLAGS += -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-xiwangtong-arm32-app.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link-application.lds +else ifeq ($(CONFIG_BSP_USING_USB),y) +export LFLAGS += -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-xiwangtong-arm32.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link-usb.lds else -export LFLAGS := -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi_xidatong.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link.lds +export LFLAGS += -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-xiwangtong-arm32.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link.lds endif export CXXFLAGS := -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g -export APPLFLAGS := -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi_app.map,-cref,-u, -T $(BSP_ROOT)/link_userspace.lds +export APPLFLAGS := -mcpu=cortex-m7 -mthumb -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-app.map,-cref,-u, -T $(BSP_ROOT)/link_userspace.lds export DEFINES := -DHAVE_CCONFIG_H -DCPU_MIMXRT1052CVL5B -DSKIP_SYSCLK_INIT -DEVK_MCIMXRM -DFSL_SDK_ENABLE_DRIVER_CACHE_CONTROL=1 -DXIP_EXTERNAL_FLASH=1 -D__STARTUP_INITIALIZE_NONCACHEDATA -D__STARTUP_CLEAR_BSS diff --git a/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/include/board.h b/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/include/board.h index 9e9e12d44..99deb8f14 100755 --- a/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/include/board.h +++ b/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/include/board.h @@ -51,6 +51,8 @@ void InitBoardHardware(void); /*! @brief The board name */ #define BOARD_NAME "IMXRT1050" +#define configMAC_ADDR {0x02, 0x12, 0x13, 0x10, 0x15, 0x11} + #define NVIC_PRIORITYGROUP_0 0x00000007U /*!< 0 bits for pre-emption priority 4 bits for subpriority */ #define NVIC_PRIORITYGROUP_1 0x00000006U /*!< 1 bits for pre-emption priority diff --git a/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/third_party_driver/ethernet/enet_ethernetif.c b/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/third_party_driver/ethernet/enet_ethernetif.c index 31d211a37..292ee307b 100755 --- a/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/third_party_driver/ethernet/enet_ethernetif.c +++ b/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/third_party_driver/ethernet/enet_ethernetif.c @@ -66,7 +66,7 @@ #include "netif/ethernet.h" #include "enet_ethernetif.h" #include "enet_ethernetif_priv.h" - +#include #include "fsl_enet.h" #include "fsl_phy.h" #include "fsl_gpio.h" @@ -92,6 +92,20 @@ void Time_Update_LwIP(void) { } +ethernetif_config_t enet_cfg = { + .phyAddress = BOARD_ENET0_PHY_ADDRESS, + .clockName = kCLOCK_CoreSysClk, + .macAddress = configMAC_ADDR, +#if defined(FSL_FEATURE_SOC_LPC_ENET_COUNT) && (FSL_FEATURE_SOC_LPC_ENET_COUNT > 0) + .non_dma_memory = non_dma_memory, +#endif /* FSL_FEATURE_SOC_LPC_ENET_COUNT */ +}; + +void *ethernetif_config_enet_set(uint8_t enet_port) +{ + return (void *)&enet_cfg; +} + void ethernetif_clk_init(void) { const clock_enet_pll_config_t config = {.enableClkOutput = true, .enableClkOutput25M = false, .loopDivider = 1}; @@ -113,7 +127,7 @@ void ethernetif_gpio_init(void) GPIO_WritePinOutput(GPIO1, 3, 1); } -void ETH_BSP_Config(void) +int ETH_BSP_Config(void) { static int flag = 0; if(flag == 0) @@ -122,6 +136,7 @@ void ETH_BSP_Config(void) ethernetif_gpio_init(); flag = 1; } + return 0; } void ethernetif_phy_init(struct ethernetif *ethernetif, @@ -186,9 +201,10 @@ void ethernetif_phy_init(struct ethernetif *ethernetif, * @param netif the lwip network interface structure for this ethernetif */ -void ethernetif_input(struct netif *netif) +void ethernetif_input(void *netif_arg) { struct pbuf *p; + struct netif *netif = (struct netif *)netif_arg; err_t ret = 0; LWIP_ASSERT("netif != NULL", (netif != NULL)); diff --git a/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/third_party_driver/include/connect_ethernet.h b/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/third_party_driver/include/connect_ethernet.h index 376c004fe..49f92d4c8 100755 --- a/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/third_party_driver/include/connect_ethernet.h +++ b/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/third_party_driver/include/connect_ethernet.h @@ -21,11 +21,13 @@ #ifndef __CONNECT_ETHERNET_H_ #define __CONNECT_ETHERNET_H_ +#include "enet_ethernetif.h" +#include "enet_ethernetif_priv.h" + #ifdef __cplusplus extern "C" { #endif - #ifndef sourceClock #define sourceClock CLOCK_GetFreq(kCLOCK_CoreSysClk) #endif diff --git a/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/third_party_driver/include/enet_ethernetif.h b/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/third_party_driver/include/enet_ethernetif.h index 8416d75bc..7978b36b6 100755 --- a/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/third_party_driver/include/enet_ethernetif.h +++ b/Ubiquitous/XiZi_IIoT/board/xiwangtong-arm32/third_party_driver/include/enet_ethernetif.h @@ -179,12 +179,14 @@ err_t ethernetif1_init(struct netif *netif); * * @param netif the lwip network interface structure for this ethernetif */ -void ethernetif_input( struct netif *netif); - -void ETH_BSP_Config(void); +void ethernetif_input( void *netif_arg); +int ETH_BSP_Config(void); +void *ethernetif_config_enet_set(uint8_t enet_port); int32 lwip_obtain_semaphore(struct netif *netif); +#define NETIF_ENET0_INIT_FUNC ethernetif0_init + #if defined(__cplusplus) } #endif /* __cplusplus */ diff --git a/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/lwipopts.h b/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/lwipopts.h index 5bbd27f95..6409f50f1 100644 --- a/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/lwipopts.h +++ b/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/lwipopts.h @@ -30,6 +30,8 @@ #ifndef __LWIPOPTS_H__ #define __LWIPOPTS_H__ +#include + /* ---------- Debug options ---------- */ #ifndef LWIP_DEBUG #define LWIP_DEBUG 1 diff --git a/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/sys_arch.c b/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/sys_arch.c index 281ad1f56..e491c5cb1 100644 --- a/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/sys_arch.c +++ b/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/sys_arch.c @@ -318,7 +318,6 @@ ip4_addr_t gw; void lwip_config_input(struct netif *net) { sys_thread_t th_id = 0; - extern void ethernetif_input(void *netif_arg); th_id = sys_thread_new("eth_input", ethernetif_input, net, LWIP_TASK_STACK_SIZE, 20); if (th_id >= 0) {