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.

RM57L843: LwIP debug message #2

Part Number: RM57L843

Hi QJ,

Based on the previous thread, the customer added uartstdio.c and uartstdio.h. And he added below statements in lwipopts.h

#define LWIP_DEBUG       1

#define LWIP_PLATFORM_DIAG(message)  UARTprintf(message)

But compiler build failed.
Customer added below to  ..\lwIP-1.4.1\ports\hdk\include\arch\cc.h and now build completed successfully.

#if 1 ///added
/* Define (sn)printf formatters for these lwIP types */ #define U16_F "u"
#define S16_F "d"
#define X16_F "x"
#define U32_F "u"
#define S32_F "d"
#define X32_F "x"
#endif


But there are still two problems remain.
1) Debug messages are corrupted.
Alphabetical characters are shown properly, but %d, %c, %x, etc. are corrupted with strange characters.

2) After a few debug messages are shown, a data abort is generated inside UARTvprintf() in uartstdio.c.

Thanks and regards,
Koichiro Tashiro

  • Hi Koichiro-san,

    I did not find my original project for enabling the LWIP_DEBUG and printing DEBUG message to UART console.

    Give me some time to test it again. Thanks

  • There are 6 files in this zip, please add those files to your lwip project:

    uartstdio.h

    uartstdio.c

    ustdlib.h

    ustdlib.c

    w_config.h

    w_debug.h

    lwip_debug_utils.zip

  • Modify the lwipopts.h to define LWIP_PLATFORM_DIAG(..):

    /*****************************************************************************
    ** Debugging options
    *****************************************************************************/
    #if 1 //def DEBUG
    #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_DEBUG
    #endif

    #define LWIP_PLATFORM_DIAG(message) UARTprintf(message)

    6064.lwipopts.h