I created a project in MCUXpresso IDE v11.4.1_6260. Then I exported a SDK for i.MX RT1160 MCU (SDK_2_10_0_MIMXRT1166xxxxx.zip).
Then I successfully build an empty project.
Now I try to work with LWIP library – Ethernet.c
/*******************************************************************************
* Includes
******************************************************************************/
#include "lwip/opt.h"
#include "fsl_phy.h"
#include "lwip/apps/httpd.h"
#include "lwip/timeouts.h"
#include "lwip/init.h"
#include "netif/ethernet.h"
#include "enet_ethernetif.h"
#include "ksdk_mbedtls.h"
#include "fsl_phyksz8081.h"
#include "fsl_enet_mdio.h"
#include "fsl_gpio.h"
#include "fsl_iomuxc.h"
#include "fsl_cache.h"
#include "fsl_enet.h"
/*******************************************************************************
* Definitions
******************************************************************************/
#define USE_100M_ENET_PORT 1
/*! @brief The ENET0 PHY address. */
#define BOARD_ENET0_PHY_ADDRESS (0x02U) /* Phy address of enet port 0. */
/*! @brief The ENET1 PHY address. */
#define BOARD_ENET1_PHY_ADDRESS (0x01U) /* Phy address of enet port 1. */
/* IP address configuration. */
#define configIP_ADDR0 192
#define configIP_ADDR1 168
#define configIP_ADDR2 0
#define configIP_ADDR3 102
/* Netmask configuration. */
#define configNET_MASK0 255
#define configNET_MASK1 255
#define configNET_MASK2 255
#define configNET_MASK3 0
/* Gateway address configuration. */
#define configGW_ADDR0 192
#define configGW_ADDR1 168
#define configGW_ADDR2 0
#define configGW_ADDR3 100
/* MAC address configuration. */
#define configMAC_ADDR {0x02, 0x12, 0x13, 0x10, 0x15, 0x11}
/* Address of PHY interface. */
#define EXAMPLE_PHY_ADDRESS BOARD_ENET0_PHY_ADDRESS
/* PHY operations. */
#define EXAMPLE_PHY_OPS phyksz8081_ops
/* ENET instance select. */
#define EXAMPLE_NETIF_INIT_FN ethernetif0_init
/* MDIO operations. */
#define EXAMPLE_MDIO_OPS enet_ops
/*******************************************************************************
* Variables
******************************************************************************/
static mdio_handle_t mdioHandle = {.ops = &EXAMPLE_MDIO_OPS};
static phy_handle_t phyHandle = {.phyAddr = EXAMPLE_PHY_ADDRESS, .mdioHandle = &mdioHandle, .ops = &EXAMPLE_PHY_OPS};
struct netif netif;
int ret;
ip4_addr_t netif_ipaddr, netif_netmask, netif_gw;
ethernetif_config_t enet_config = {
.phyHandle = &phyHandle,
.macAddress = configMAC_ADDR,
};
gpio_pin_config_t gpio_config = {kGPIO_DigitalOutput, 0, kGPIO_NoIntmode};
/*******************************************************************************
* Functions
******************************************************************************/
static inline void BOARD_InitModuleClock(void)
{
const clock_sys_pll1_config_t sysPll1Config = {
.pllDiv2En = true,
};
CLOCK_InitSysPll1(&sysPll1Config);
#if USE_100M_ENET_PORT
clock_root_config_t rootCfg = {.mux = 4, .div = 10}; /* Generate 50M root clock. */
CLOCK_SetRootClock(kCLOCK_Root_Enet1, &rootCfg);
#else
clock_root_config_t rootCfg = {.mux = 4, .div = 4}; /* Generate 125M root clock. */
CLOCK_SetRootClock(kCLOCK_Root_Enet2, &rootCfg);
#endif
/* Select syspll2pfd3, 528*18/24 = 396M */
CLOCK_InitPfd(kCLOCK_PllSys2, kCLOCK_Pfd3, 24);
rootCfg.mux = 7;
rootCfg.div = 2;
CLOCK_SetRootClock(kCLOCK_Root_Bus, &rootCfg); /* Generate 198M bus clock. */
}
static inline void IOMUXC_SelectENETClock(void)
{
#if USE_100M_ENET_PORT
IOMUXC_GPR->GPR4 |= 0x3; /* 50M ENET_REF_CLOCK output to PHY and ENET module. */
#else
IOMUXC_GPR->GPR5 |= IOMUXC_GPR_GPR5_ENET1G_RGMII_EN_MASK; /* bit1:iomuxc_gpr_enet_clk_dir
bit0:GPR_ENET_TX_CLK_SEL(internal or OSC) */
#endif
}
void BOARD_ENETFlexibleConfigure(enet_config_t *config)
{
#if USE_100M_ENET_PORT
config->miiMode = kENET_RmiiMode;
#else
config->miiMode = kENET_RgmiiMode;
#endif
}
void ETH_Init(void)
{
BOARD_InitModuleClock();
IOMUXC_SelectENETClock();
}
But while building I get some errors
D:\Workspace_MCUXpresso_11.4\MIMXRT1166_EVK_Project\lwip\port/enet_ethernetif.h:89:5: error: unknown type name 'phy_handle_t'
D:\Workspace_MCUXpresso_11.4\MIMXRT1166_EVK_Project\phy/fsl_phyksz8081.h:40:14: error: unknown type name 'phy_operations_t'
D:\Workspace_MCUXpresso_11.4\MIMXRT1166_EVK_Project\phy/fsl_phyksz8081.h:66:27: error: unknown type name 'phy_handle_t'; did you mean 'enet_handle_t'?
phy_handle_t is defined in fsl_phy.h however I see
unknown type name 'phy_handle_t' I see in lwip/port/enet_ethernetif.h
What can be wrong?