Problem with multiple format arguments when using SEGGER_RTT_printf

  • Hi

    I have the following:

    SEGGER_RTT_printf(0, "midnight_tick: last: %u, now: %u\r\n", last, now);
    SEGGER_RTT_printf(0, "midnight_tick: now: %u, last: %u\r\n", now, last);

    This prints:

    midnight_tick: last: 10957, now: 0
    midnight_tick: now: 10957, last: 0

    Note that the second argument is always printed as 0 but none of the args is 0. There is no concurrency involved, the arguments last and now dont change between the two calls.


    Sorry, if I am missing something trivial ...

    Kind regards
    Peter

  • Hi Peter,
    We are not aware of any such issue.

    I just gave it a quick try and it works without issues on my side, using an STM32F407VE:

    Code
    SEGGER_RTT_printf(0, "Some %u Test %u.\n", 123, 456);
    SEGGER_RTT_printf(0, "Some %u Test %u.\n", 456, 123);

    Resulted in the lines:
    Some 123 Test 456.
    Some 456 Test 123.

    Could you please provide a working sample showing the issue?
    Which MCU are you working with?
    Are you using the RTT source code from the latest release?
    https://www.segger.com/downloads/jlin…cumentationPack

    Best regards,
    Fabian

    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: https://www.segger.com/ticket/

    Or you can contact us via e-mail.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!