Confusion over copying post-mortem buffer

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

  • Confusion over copying post-mortem buffer

    I have been confused about how to copy the buffer to a file for a post-mortem recording. Temporarily I have been using just the buffer in order exactly as it is in memory which seems to mostly work (but there might be some issues where it seems that a particular task is running for 6 seconds---I do not believe that to be so).

    The manual states to first copy pBuffer + WrOff to the end of pBuffer, and then to append pBuffer till pBuffer + RdOff - 1.

    In this example, I am using the address in my system of 0xF05A0 for pBuffer. To explain the situation, my buffer is 8192 bytes and I have recorded only a few task create events. Upon pausing, WrOff is 366, and RdOff is 0. This would mean that I would copy 0xF070E to 0xF25A0, and then append 0xF05A0 to 0xFA59F. I am confused because: 1. According to segger.com/systemview-post-mortem-mode.html?p=1749 it looks like I have missed all of the data at the beginning of the queue, and 2. the second range goes backwards.

    Is there an explanation for how I should copy the buffer properly with this? Thanks.
  • Hi,

    The SystemView buffer is a ring buffer implementation.
    The newest data is written at WrOff, counted from the start of buffer memory, and wraps around at the end of the buffer.
    RdOff marks the start position to read valid data. Data can be read up to WrOff-1, and the wrap-around needs to be handled.

    With post-mortem mode it is assumed, that the target ran for longer time and the SystemView buffer is completely filled.
    In this case RdOff is WrOff+1.
    When the buffer is not completely filled, which is your case, you need to read only from RdOff to WrOff - 1.

    Best regards
    Johannes
    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.