This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DK-TM4C129X: Retrieve IPs using UpdateBOOTP

Part Number: DK-TM4C129X
Other Parts Discussed in Thread: LMFLASHPROGRAMMER

Hi,

Boot_serial sits at 0x0 and an application starts at 0x4000.

What I am trying to do is once the application starts it accesses the Unix server to get it's own assigned IP and server IP before lwip_init() is called.

So, What I did modified ParseBOOTPReply() to retrieve IPs.

   //
   // Extract our IP address from the response.
   //
    *((uint32_t *)(void *)(&uip_hostaddr)) = psBOOTP->ui32YIAddr;
    //
    // Save a copy of the server assigned IP for lwip initialization
    //

	BOOTP_SERVER_ASSIGNED_IP = psBOOTP->ui32YIAddr;
	UARTprintf("BOOTP Assigned IP=%d \n",BOOTP_SERVER_ASSIGNED_IP);

    //
    // Extract the server address from the response.
    //
    *((uint32_t *)(void *)(&g_sServerAddr)) = psBOOTP->ui32SIAddr;

Once the application starts it calls lwipinit() and it calls ConfigureEent() and UpdateBOOTP()

        ConfigureEnet();
        UpdateBOOTP();				// call routine to perform BOOTP and
//        							// attain server assigned IP address


    	BOOTP_SERVER_ASSIGNED_IP = ntohl(BOOTP_SERVER_ASSIGNED_IP); 	// translate received network byte

    //
    // Initialize lwIP.
    //
//    lwIPInit(g_ui32SysClock, pui8MAC, 0, 0, 0, IPADDR_USE_DHCP);
    lwIPInit(g_ui32SysClock, pui8MAC, BOOTP_SERVER_ASSIGNED_IP, 0, 0, IPADDR_USE_STATIC);

This application has no issues to get board's IP, as it uses either flash or rom-based bootlaoder+DHCP.

However, if two functions are called to retrieve IPs using BOOOTP the application gets stuck.

Even I tried to start the application at 0x00 without bootloader to see if the above modules can get Ips,but it does not let me success.

Can you give me tips, helps, and anythings?

Regards,

Jin

  • Hello Jin,

    Are you trying to assign the IP address statically instead of the device negotiating the IP address with a DHCP server?

    If yes, then does the network support the provided IP address?
  • Hi Amit,

    I think so , since I added MAC address of this board and IP in bootptab,but not sure about where the server ip is needed to define. I guess the server ip just is added on the reply packets once the bootpd receives the bootp request.

    Actually, I tested boot_serial at 0x0 and placed an application starting at 0x4000 in the unix server, and the bootloader successfully received Ip and image file on the server.


    The problems is it doesn't retrieve assigned IP for the board. I checked which functions make the application stuck, and I am suspicious about updateBOOTP().

    As I calls only ConfigureEnet() with commented out updateBOOTP() for DHCP, it seems work, but add updateBOOTP() makes it stuck.

    Regards,
    Jin

  • Hello Jin,

    Jin Seo said:
    I think so , since I added MAC address of this board and IP in bootptab,but not sure about where the server ip is needed to define. I guess the server ip just is added on the reply packets once the bootpd receives the bootp request.

    Do you mean the LMFlashProgrammer?

  • HI Amit,

    No, the actual HP-UNIX server and bootpd associated with bootp. My application talks with bootpd running on UNix not LMFlash. It should work since bootp protocol follows the standards.Like I said before, I successfully received the assinged IP and image from the server as I used DHCP.

    The application's image file is located in other place(Unix server), and it is described in bootptab(configuration file for bootpd).

    Regards,
    Jin

  • Hello Jin,

    Instead of using the static address, did you try to replace the same with a DHCP acquired IP address. I am still trying to get my head around the implementation you have. Could you please list the steps for the process as 1-2-3 bullet items with expectation at each step and behavior of the system?
  • Hi Amit,

    This application works fine if DHCP is used regardless rom or flash-based bootloader.

    Since I need to extract board's assigned IP and server IP(Server IP will be used for sockets communication with other daemons).

    So What I did:

    1. modified ParseBOOTPReply() in bl_emac to retrieve the board IP and server IP.

       //
        // Extract our IP address from the response.
        //
        *((uint32_t *)(void *)(&uip_hostaddr)) = psBOOTP->ui32YIAddr;
        //
    	// Save a copy of the server assigned IP for lwip initialization
    	//
    
    	BOOTP_SERVER_ASSIGNED_IP = psBOOTP->ui32YIAddr;
    	UARTprintf("BOOTP Assigned IP=%d \n",BOOTP_SERVER_ASSIGNED_IP);
    
        //
        // Extract the server address from the response.
        //
        *((uint32_t *)(void *)(&g_sServerAddr)) = psBOOTP->ui32SIAddr;
        //
        // Save a copy of the CHGD reported server IP for address.c initializations
        //
        BOOTP_CHRGD_SERVER_ADDRESS = psBOOTP->ui32SIAddr;

    2. For the first time the application is initialized, it calls lwiptask_init() and inside of this fucntion initiates lwip by calling lwip_init(), which allows different mode like static/dhcp.

    Before calling lwip_init(), execute ConfigureEnet(), updateBOOTP() in bl_emac.

    //    EnetReconfig(120000000);
            ConfigureEnet();
            UpdateBOOTP();				// call routine to perform BOOTP and
    //        							// attain server assigned IP address
    
    
        	BOOTP_SERVER_ASSIGNED_IP = ntohl(BOOTP_SERVER_ASSIGNED_IP); 	// translate received network byte
    
        //
        // Initialize lwIP.
        //
    //    lwIPInit(g_ui32SysClock, pui8MAC, 0, 0, 0, IPADDR_USE_DHCP);
        lwIPInit(g_ui32SysClock, pui8MAC, BOOTP_SERVER_ASSIGNED_IP, 0, 0, IPADDR_USE_STATIC);

    For doing this, I changed LWIP_DHCP disabled in lwipopts.

    #define LWIP_DHCP                       0           // default is 0

    Also, changed the difnition of start/vector address in bl_config.h and .cmd ( I don't think this is necessary anyhow I did)

    #define APP_START_ADDRESS       0x00000000
    #define VTABLE_START_ADDRESS    0x00000000

    3. the application didn't even startup if the above functions are called.(it is same codes and should be called as I tested flash bootloader+dhcp)

    4. I commented out updateBOOTP() to see if configureEnet() was working, and it's fine- still start at 0x0 +dhcp, so lwip_init() set up for dhcp.

    5. Commented configureEnet() and uncommented updateBOOTP(),which didn't work(it was just stuck as application started)

    That's what I have tested so far.

    Acutually, it doesn't matter whether the mode of lwip_init() is dhcp or static for now, since I have tried to check the above two functions are working.

    Sorry, I forgot to say that bootp/tftp are covered by uip, so I configured the below in uip-conf,h

    //*****************************************************************************
    //
    // Turn on UDP support.
    //
    //*****************************************************************************
    #define UIP_CONF_UDP            1

    Regards,

    Jin

  • Hello Jin,

    Are you still trying to solve this issue?

    From what I understand, your application (not the bootloader), uses the uIP stack first (by calling ConfigureEnet and UpdateBOOTP functions) to get the IP address assigned to the DK-TM4C129x and the server IP address. If this is true, the following information is missing:

    What is the SysClock configured to? ConfigureEnet functions configure it to 120MHz. But wanted to make sure, that it is not configured to someother value some where else.

    How is the SysTick Interrupt handling the global variables required by BOOTP and TFTP protocols? Refer the function "SysTickIntHandler" in bl_emac.c file.

    Thanks,

    Sai

  • Hi Sai,

    SysClock runs at 120Mhz.

    This application runs on FreeRTOS and it seems to get through FreeRTOS in order to use SysTick interrupt, which I am now looking at.

    I am not sure the problem comes from SysTick interrupt but let me try.

    Regards,

    Jin

  • Hello Jin,

    Jin Seo said:
    This application runs on FreeRTOS

    I did not realize that before.

    Jin Seo said:
    and it seems to get through FreeRTOS in order to use SysTick interrupt, which I am now looking at.

    FreeRTOS allows inserting a tick hook. This callback function gets called every time the SysTick interrupt occurs.

    Jin Seo said:
    I am not sure the problem comes from SysTick interrupt but let me try.

    The SysTickIntHandler from the file "bl_emac.c" has the following code. I haven't spent time to look at what happens if these variables are not set correctly, but they are used all over the functions that you are calling. Better to handle them correctly.

    void
    SysTickIntHandler(void)
    {
        //
        // Increment the tick count.
        //
        g_ui32Ticks++;
        g_ui32PeriodicTimer += SYSTICKMS;
        g_ui32ARPTimer += SYSTICKMS;
    }

    Thanks,

    Sai