A building project problem.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

A building project problem.

Jump to solution
2,645 Views
john71
Senior Contributor I

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?

 

0 Kudos
Reply
1 Solution
2,599 Views
john71
Senior Contributor I

Well..I ported SDK_2_9_0 instead of SDK_2_10_0 and now it's OK.

View solution in original post

0 Kudos
Reply
7 Replies
2,618 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @john71 ,

  Please run the SDK project directly:

SDK_2_10_0_MIMXRT1160-EVK\boards\evkmimxrt1160\lwip_examples

kerryzhou_0-1634107318445.png

The SDK project also has your mentioned phy_handle_t, so please check your path, you need to add phy path.

 

Best Regards,

Kerry

 

0 Kudos
Reply
2,614 Views
john71
Senior Contributor I

I have it included - /${ProjName}/phy.

I ported an example project from SDK - evkmimxrt1160_lwip_httpssrv_mbedTLS_bm_cm4.

Checked - all paths like /${ProjName}/... are present  

When I build it I get some errors also related to LWIP

 

Description Resource Path Location Type
request for member 'autoNeg' in something not a structure or union enet_ethernetif.c /MIMXRT1166_EVK_Project/lwip/port line 82 C/C++ Problem
request for member 'mdioHandle' in something not a structure or union enet_ethernetif.c /MIMXRT1166_EVK_Project/lwip/port line 84 C/C++ Problem
request for member 'mdioHandle' in something not a structure or union enet_ethernetif_kinetis.c /MIMXRT1166_EVK_Project/lwip/port line 386 C/C++ Problem
request for member 'phyAddr' in something not a structure or union enet_ethernetif.c /MIMXRT1166_EVK_Project/lwip/port line 81 C/C++ Problem
too few arguments to function 'PHY_GetLinkSpeedDuplex' enet_ethernetif.c /MIMXRT1166_EVK_Project/lwip/port line 119 C/C++ Problem
too few arguments to function 'PHY_GetLinkStatus' enet_ethernetif.c /MIMXRT1166_EVK_Project/lwip/port line 102 C/C++ Problem
too few arguments to function 'PHY_Init' enet_ethernetif.c /MIMXRT1166_EVK_Project/lwip/port line 90 C/C++ Problem
unknown type name 'phy_config_t'; did you mean 'enet_config_t'? enet_ethernetif.c /MIMXRT1166_EVK_Project/lwip/port line 74 C/C++ Problem

unknown type name 'phy_handle_t' enet_ethernetif.h /MIMXRT1166_EVK_Project/lwip/port line 89 C/C++ Problem

 It's not my first project in MCUXpresso. I've build some projects in the past

SDKs.png

 In MKV58F1M0xxx24 I also have LWIP and it compiles OK.

0 Kudos
Reply
2,605 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @john71 

Please use the cm7 project instead of the CM4, as to the RT1160, CM7 is the master core.

evkmimxrt1160_lwip_httpssrv_mbedTLS_bm_cm7.

But, even you use the evkmimxrt1160_lwip_httpssrv_mbedTLS_bm_cm4, you should still can build it:

This is my build result:

kerryzhou_0-1634201415025.png

Do you want to create a new project?

If yes, I recommend you based on evkmimxrt1160_lwip_httpssrv_mbedTLS_bm_cm7 directly, if you build this without issues, then you can copy past, or rename the project to your own project name, then based on it.

Best Regards,

Kerry

 

 

0 Kudos
Reply
2,600 Views
john71
Senior Contributor I

Well..I ported SDK_2_9_0 instead of SDK_2_10_0 and now it's OK.

0 Kudos
Reply
2,597 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @john71 

Thanks for your updated information.

If your issue is solved, please help to mark the correct answer, just to close this case, thanks.

Any new issues, welcome to create the new case.

 

Best Regards,

Kerry

0 Kudos
Reply
2,624 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @john71 ,

  Do you also add the path in the MCUXPresso project? Seems you lack the path.

 BTW, do you test the SDK code project directly for the lwip, that SDK project works OK, you can refer to the SDK project directly.

 

Wish it helps you!

Best Regards,

Kerry

0 Kudos
Reply
2,621 Views
john71
Senior Contributor I

Hi Kerry

How do I add the path? In Settings->Includes I see all the paths to libraries.

If I exclude my code from the project I get some errors in LWIP library any way

../lwip/port/enet_ethernetif.c:119:9: error: too few arguments to function 'PHY_GetLinkSpeedDuplex'

../lwip/port/enet_ethernetif.h:89:5: error: unknown type name 'phy_handle_t'

../lwip/port/enet_ethernetif_kinetis.c:386:43: error: request for member 'mdioHandle' in something not a structure or union

 

0 Kudos
Reply