[SOLVED] Timeline not showing SysTick or Scheduler events

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

  • [SOLVED] Timeline not showing SysTick or Scheduler events

    Hi there!

    I'm trying to get Segger SysView working with FreeRTOS v10.3.1 on an ARM Cortex M0+. I applied the FreeRTOSV10_Core.patch by hand, added the example SEGGER_SYSVIEW_X_GetTimestamp() function and increment the SEGGER_SYSVIEW_TickCnt variable at the start of xPortSysTickHandler() in FreeRTOS/Source/portable/GCC/ARM_CM0/port.c as follows:


    C Source Code

    1. #ifdef CFG_SEGGER_SYSVIEW_ENABLED
    2. volatile uint32_t SEGGER_SYSVIEW_TickCnt;
    3. #endif
    4. void xPortSysTickHandler( void )
    5. {
    6. uint32_t ulPreviousMask;
    7. #ifdef CFG_SEGGER_SYSVIEW_ENABLED
    8. SEGGER_SYSVIEW_TickCnt++;
    9. #endif
    10. ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR();
    11. traceISR_ENTER();
    12. {
    13. /* Increment the RTOS tick. */
    14. if( xTaskIncrementTick() != pdFALSE )
    15. {
    16. traceISR_EXIT_TO_SCHEDULER();
    17. /* Pend a context switch. */
    18. portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
    19. }
    20. else
    21. {
    22. traceISR_EXIT();
    23. }
    24. }
    25. portCLEAR_INTERRUPT_MASK_FROM_ISR( ulPreviousMask );
    26. }
    Display All
    The SysTick and Scheduler events are shown correctly with timestamps in the event log but they are not displayed in the Timeline window:




    I also noticed that there is a "No runtime!" warning.

    Attached is "freertos_v10_3_1.SVDat" for inspection. It looks like my patch to FreeRTOS V10.3.1 was not completely successful. Any hints / tips on how to fix it would be much appreciated!

    Thanks in advance,
    Pieter
    piconomix.com
    Files
  • Hi everyone,

    I've identified and fixed the problem :)

    The Segger Systemview GUI is not able to cope with events that are not timestamped properly (sequentially).

    For the Cortex M0/M0+ the usual time stamping mechanism is to use SysTick (system timer). The problem is that FreeRTOS only configures and enables SysTick when vTaskStartScheduler() is called, so all Segger SysView events that happen before this are timestamped with the same zero value (0).



    This leads to a catch 22 situation, because I want to see events that lead up to starting the scheduler, but the events can not be timestamped properly without starting the scheduler.

    My solution was to ditch SysTick for time stamping and use TIM7 as a dedicated 1 us time stamping counter on the STM32. I can configure and start TIM7 before calling SEGGER_SYSVIEW_Init(). See here for my implementation:

    github.com/piconomix/piconomix…SYSVIEW_Config_FreeRTOS.c


    Feedback for the Segger R&D team: I noticed this comment in the documentation, but the implication should really be explained better:


    In case timestamp is not retrieved from cycle counter but from system timer, SEGGER_SYSVIEW_TickCnt must be incremented in the SysTick handler before any SYSVIEW event is generated.


    I guess what you mean to say is that the SysTick timestamping handler must be configured and running before generating any SYSVIEW events.

    Kind regards,
    Pieter
    piconomix.com

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

  • Hello Pieter,

    Thank you for your inquiry.

    piconomix wrote:

    Feedback for the Segger R&D team: I noticed this comment in the documentation, but the implication should really be explained better:


    In case timestamp is not retrieved from cycle counter but from system timer, SEGGER_SYSVIEW_TickCnt must be incremented in the SysTick handler before any SYSVIEW event is generated.


    I guess what you mean to say is that the SysTick timestamping handler must be configured and running before generating any SYSVIEW events.
    Correct. The documentation implies this with its wording, but we will review how the documentation can be improved in this regards.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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.