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.

CCS/TM4C129ENCPDT: Follow up Program Flow using LWIP_ASSERT and LWIP_DEBUGF statements

Part Number: TM4C129ENCPDT

Tool/software: Code Composer Studio

Hi,

I am using TM4C129EXL Evaluation Board with CCS 7.0.

I am trying to implement a web server from the device and control the board through the webpage exactly like the 'enet_io' example except that with my own custom made web page.

The 'enet_io' example program is written with many layers going deep one into another. Since many functions are called through interrupts and call back functions it is difficult to trace the program flow.

But in the program there are some statements like below:

LWIP_ASSERT("invalid socket state for poll", pcb->state != LISTEN);

LWIP_DEBUGF(HTTPD_DEBUG, ("httpd_init\n"));

I guess these can be used to understand the program flow. But I need to understand how these statements work. Whether the string statements inside the functions will be displayed through the configured UART or it will be displayed in a separate console window.

I checked with the UART COM port. The messages inside the functions are not getting displayed. Whether any MACROs need to be enabled? 

Thank You for your time!

  • Hi,

     Please go to the lwipopts.h and you can enable various LWIP debugs. See below for example. For example, I turn on IP, UDP and DHCP debugs. You can turn ON what you want. The debug messages will be output on the terminal example. Below is an example output.

    //*****************************************************************************
    //
    // ---------- Debugging options ----------
    //
    //*****************************************************************************
    #if 1
    #define U8_F "c"
    #define S8_F "c"
    #define X8_F "x"
    #define U16_F "u"
    #define S16_F "d"
    #define X16_F "x"
    #define U32_F "u"
    #define S32_F "d"
    #define X32_F "x"
    extern void UARTprintf(const char *pcString, ...);
    #define LWIP_PLATFORM_DIAG(msg) UARTprintf msg
    #define LWIP_PLATFORM_ASSERT(msg) \
        UARTprintf("ASSERT_FAIL at line %d of %s:\ %s\n", __LINE__, __FILE__, msg)
    #define LWIP_DEBUG  1
    #endif
    
    //#define LWIP_DBG_MIN_LEVEL              LWIP_DBG_LEVEL_OFF
    #define LWIP_DBG_MIN_LEVEL              LWIP_DBG_LEVEL_OFF
    //#define LWIP_DBG_MIN_LEVEL              LWIP_DBG_LEVEL_WARNING
    //#define LWIP_DBG_MIN_LEVEL              LWIP_DBG_LEVEL_SERIOUS
    //#define LWIP_DBG_MIN_LEVEL              LWIP_DBG_LEVEL_SEVERE
    
    //#define LWIP_DBG_TYPES_ON               LWIP_DBG_ON
    #define LWIP_DBG_TYPES_ON               (LWIP_DBG_ON|LWIP_DBG_TRACE|          \
                                             LWIP_DBG_STATE|LWIP_DBG_FRESH)
    
    //#define ETHARP_DEBUG                    LWIP_DBG_ON     // default is OFF
    //#define NETIF_DEBUG                     LWIP_DBG_ON     // default is OFF
    //#define PBUF_DEBUG                      LWIP_DBG_OFF
    //#define API_LIB_DEBUG                   LWIP_DBG_OFF
    //#define API_MSG_DEBUG                   LWIP_DBG_OFF
    //#define SOCKETS_DEBUG                   LWIP_DBG_OFF
    //#define ICMP_DEBUG                      LWIP_DBG_OFF
    //#define IGMP_DEBUG                      LWIP_DBG_OFF
    //#define INET_DEBUG                      LWIP_DBG_OFF
    #define IP_DEBUG                        LWIP_DBG_ON     // default is OFF
    //#define IP_REASS_DEBUG                  LWIP_DBG_OFF
    //#define RAW_DEBUG                       LWIP_DBG_OFF
    //#define MEM_DEBUG                       LWIP_DBG_OFF
    //#define MEMP_DEBUG                      LWIP_DBG_OFF
    //#define SYS_DEBUG                       LWIP_DBG_OFF
    //#define TCP_DEBUG                       LWIP_DBG_OFF
    //#define TCP_INPUT_DEBUG                 LWIP_DBG_OFF
    //#define TCP_FR_DEBUG                    LWIP_DBG_OFF
    //#define TCP_RTO_DEBUG                   LWIP_DBG_OFF
    //#define TCP_CWND_DEBUG                  LWIP_DBG_OFF
    //#define TCP_WND_DEBUG                   LWIP_DBG_OFF
    //#define TCP_OUTPUT_DEBUG                LWIP_DBG_OFF
    //#define TCP_RST_DEBUG                   LWIP_DBG_OFF
    //#define TCP_QLEN_DEBUG                  LWIP_DBG_OFF
    #define UDP_DEBUG                       LWIP_DBG_ON     // default is OFF
    //#define TCPIP_DEBUG                     LWIP_DBG_OFF
    //#define PPP_DEBUG                       LWIP_DBG_OFF
    //#define SLIP_DEBUG                      LWIP_DBG_OFF
    #define DHCP_DEBUG                      LWIP_DBG_ON     // default is OFF
    //#define AUTOIP_DEBUG                    LWIP_DBG_OFF
    //#define SNMP_MSG_DEBUG                  LWIP_DBG_OFF
    //#define SNMP_MIB_DEBUG                  LWIP_DBG_OFF
    //#define DNS_DEBUG                       LWIP_DBG_OFF
    
    #endif /* __LWIPOPTS_H__ */