SystemView and freeRTOS

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

  • SystemView and freeRTOS

    Hi,

    We are attempting to use SystemView V2.5 with freeRTOS V9 CM3 port. The current plan is to use both real time record mode, and postmortem mode.

    This is the first I have ever worked with this tool and I am very impressed thus far, but after some initial testing I have a few questions.

    It looks like when running in postmortem mode the SystemView library maintains an array containing task information and status. However, it appears that the list is not being updated whenever a task is deleted. I am then seeing that this eventually leads to a hard fault when _cbSendTaskList calls uxTaskGetStackHighWaterMark with an invalid task handle. Is this the case, or have I missed something? Our application frequently deletes tasks and it looks like the library could be easily modified to handle this, but I wanted to make sure that I'm headed down the right road before putting in the effort.

    Also, when I import postmortem data, I usually have all zeros for the timestamps. Occasionally all of the timestamps show up so I am assuming that something is being corrupted, but I'm not sure where to start looking.

    Thanks,
    B. Gerold
  • Hi,

    Thanks for the positive feedback.

    You are right, in the SystemView FreeRTOS interface task information is only added or updated, but not removed.
    We will add this to the interface. find attached a preliminary version. Does this work for you?

    Regarding timestamps, the only reason why timestamps could be 0 is, when the timestamp configuration is not part of the recording.
    In the SystemView configuration make sure that SEGGER_SYSVIEW_SYNC_PERIOD_SHIFT fits with your SystemView buffer size.
    Try increasing your buffer size or decreasing SEGGER_SYSVIEW_SYNC_PERIOD_SHIFT.
    If this does not help, could you send a recording with corrupted timestamps?

    Regards
    Johannes
    Files
    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,

    Regarding the 0 timestamps:

    This can happen when the DWT unit is not enabled.
    On Cortex-M3/4 the timestamp is generated from the DWT->CYCCNT, so the cycle counter needs to be enabled and to do this the DWT needs to be enabled as well.
    This is usually done by the debugger, but can also be done by the application.

    if ((CoreDebug->DEMCR & CoreDebug_DEMCR_TRCENA_Msk) == 0) {
    CoreDebug->DEMCR |= 1 << CoreDebug_DEMCR_TRCENA_Pos; // Enable DWT in DEMCR if not done, yet.
    }
    DWT->CTRL |= 1 << DWT_CTRL_CYCCNTENA_Pos; // Enable CYCCNT in DWT_CTRL.

    When there has been a debug session running or you connected with J-Link before, and read the data without a reset,
    then the CYCCNT might have still been enabled and the application generated real timestamps.

    If you do not want to use the CYCCNT, you can of course configure SystemView for any other timestamp source, i.e. the SysTick, too.

    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.