[SOLVED] SystemView _VPrintHost string format support

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] SystemView _VPrintHost string format support

    Hi Segger Team,

    we're having software that passes printf format strings with %s in the format string and we want to be able to pass this trough SystemView too (RTT already does support it).

    Currently we do patch the SystemView sources right now in the following way.



    EDIT:
    One thing to mention here is that %s format string then would only be working when formatted on target.
    Host functions only work liek expected with such format string when SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT is set.

    When disabled (default) the PC software does receives the format string with the %s and the char* converted to an integer.

    Then the behavior is the same like right now when using Host functions with a %s

    We also created a patch file: VPrintTarget-string-formatting.zip

    Be aware that this also includes the string NULL check discusses for RTT in this thread.

    It would be nice, if this patch could get part of the official SystemView release.

    Thanks :)

    Best regards
    Philipp Häfele

    The post was edited 1 time, last by ifmPhilipp ().

  • Hello Phillip,

    Thank you for sharing.
    On first glance this looks good.
    We will run some tests on it and if everything passes it will most likely be added to the official release.

    Best regards,
    Nino
    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: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Nino,

    sounds great.

    You maybe want to add the discussed "(null)" printing discussed in SEGGER_RTT_vprintf / SEGGER_RTT_printf string format NULL check

    C Source Code

    1. if(s == NULL) {
    2. _StoreChar(&BufferDesc, '(');
    3. _StoreChar(&BufferDesc, 'n');
    4. _StoreChar(&BufferDesc, 'u');
    5. _StoreChar(&BufferDesc, 'l');
    6. _StoreChar(&BufferDesc, 'l');
    7. _StoreChar(&BufferDesc, ')');
    8. break;
    9. }
    Best regards

    Philipp

    The post was edited 1 time, last by ifmPhilipp: characters need to be in single quotes instead of double onces " => ' ().