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.

TM4C1294NCPDT: I want to add new UDP sending and receiving operations to the flash ethernet bootloader.

Part Number: TM4C1294NCPDT


The flash ethernet bootloader sends BOOTP periodically and always waits to receive a BOOTP, but how can I write code to send and receive arbitrary UDP in parallel?

I would like to set a certain value in the device's user register in advance using a separate program, write a flash Ethernet bootloader to the TM4C129, and use UDP communication to obtain the user register value.
  • Hi Muneto-san,

      BOOTP is based on UDP protocol. If you look at the TivaWare Ethernet bootloader, you will find that BOOTP request is sent using uIP stack. Please refer to the bl_emac.c file in C:\ti\TivaWare_C_Series-2.2.0.295\boot_loader\bl_emac.c where uip_udp_send(sizeof(tBOOTPPacket)) is the function to send the BOOTP request. The uIP stack is an open-source implementation of the TCP/IP network protocol stack intended for its small memory footprint. The uIP stack can be found in C:\ti\TivaWare_C_Series-2.2.0.295\third_party\uip-1.0\uip. You can reference how uip_udp_send() is used to implement your application specific requirements in your custom bootloader. 

    static void
    SendBOOTPRequest(void)
    {
        uint8_t *pui8Packet = (uint8_t *)uip_appdata;
        tBOOTPPacket *psBOOTP = (tBOOTPPacket *)uip_appdata;
        uint32_t ui32Idx;
    
        //
        // Zero fill the BOOTP request packet.
        //
        for(ui32Idx = 0; ui32Idx < sizeof(tBOOTPPacket); ui32Idx++)
        {
            pui8Packet[ui32Idx] = 0;
        }
    
        //
        // Construct a BOOTP request.
        //
        psBOOTP->ui8Op = BOOTP_REQUEST;
    
        //
        // Set the hardware type to Ethernet.
        //
        psBOOTP->ui8HType = 0x01;
    
        //
        // Set the hardware address length to 6.
        //
        psBOOTP->ui8HLen = 0x06;
    
        //
        // Choose a random number for the transaction ID.
        //
        psBOOTP->ui32XID = g_ui32XID = RandomNumber();
    
        //
        // Set the number of seconds since we started.
        //
        psBOOTP->ui16Secs = HTONS(g_ui32Ticks / SYSTICKHZ);
    
        //
        // Fill in the Ethernet MAC address.
        //
        for(ui32Idx = 0; ui32Idx < 6; ui32Idx++)
        {
            psBOOTP->pui8CHAddr[ui32Idx] = g_sMACAddr.addr[ui32Idx];
        }
    
        //
        // Set the server name if defined.
        //
    #ifdef ENET_BOOTP_SERVER
        for(ui32Idx = 0;
            (psBOOTP->pcSName[ui32Idx] = ENET_BOOTP_SERVER[ui32Idx]) != 0;
            ui32Idx++)
        {
        }
    #endif
    
        //
        // Send the BOOTP request packet.
        //
        uip_udp_send(sizeof(tBOOTPPacket));
    }