This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

What's wrong with "SEGGER_RTT_printf" or "__DATE__,__TIME__"

I want printf the date and time when compiling code. But I drag on this error:

SEGGER_RTT_printf("%s %s.\r\n", __DATE__,__TIME__);

image description

compiler says:

image description

It's strange.I use keil MDK-ARM. image description

  • Hi,

    The first argument of SEGGER_RTT_printf() function should be the buffer index:

    SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...)
    

    You can set this to zero:

    SEGGER_RTT_printf(0, "%s %s.\r\n", __DATE__,__TIME__);
    

    Best regards,

    Jørgen

  • Thank you,Jorgen. My bad,actually I already use this format to print reset reason.

    SEGGER_RTT_printf(0, "RESET_REAS:%2x\r\n",(uint16_t)NRF_POWER->RESETREAS);