fix LwIP ethernetif_input function error and fix Lwip compile error for BOARD imxrt1176/ok1052-c/xidatong-arm32/xiwangtong-arm32

This commit is contained in:
Liu_Weichao 2023-07-19 10:41:57 +08:00
parent 02b676e910
commit 2626acd70c
14 changed files with 61 additions and 18 deletions

View File

@ -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

View File

@ -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));

View File

@ -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);

View File

@ -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));

View File

@ -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);

View File

@ -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));

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -66,7 +66,7 @@
#include "netif/ethernet.h"
#include "enet_ethernetif.h"
#include "enet_ethernetif_priv.h"
#include <board.h>
#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));

View File

@ -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

View File

@ -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 */

View File

@ -30,6 +30,8 @@
#ifndef __LWIPOPTS_H__
#define __LWIPOPTS_H__
#include <xsconfig.h>
/* ---------- Debug options ---------- */
#ifndef LWIP_DEBUG
#define LWIP_DEBUG 1

View File

@ -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) {