[ABANDONED] Using SystemViewer for a bare-metal application running on Cortex-M0 based device.

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

  • [ABANDONED] Using SystemViewer for a bare-metal application running on Cortex-M0 based device.

    Hi,

    Thanks for SystemViewer toolkit, and I'm trying to use it to inspect my system behavior, but without OS (bare-metal application).

    I read the two manuals; UM08027 and AN08003. and I did as described, but I think that I miss something because the SystemViewer desktop application cannot start recording.

    For my environment details: I'm using J-Link Pro (SystemViewer updated the version on the first start recording), a Cortex-M0 based µC (STM32F030), and J-Flash v5.02c.

    I set

    C Source Code

    1. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
    in SEGGER_SYSVIEW_Conf.f file.

    And In SEGGER_SYSVIEW_Config_NoOS.c I set configuration to:

    C Source Code

    1. #define SYSVIEW_APP_NAME "MY APP"

    C Source Code

    1. #define SYSVIEW_DEVICE_NAME "Cortex-M0"

    C Source Code

    1. #define SYSVIEW_TIMESTAMP_FREQ (SystemCoreClock)

    C Source Code

    1. #define SYSVIEW_CPU_FREQ (SystemCoreClock)

    C Source Code

    1. #define SYSVIEW_RAM_BASE (0x20000000)


    Also I copied the function SEGGER_SYSVIEW_X_GetTimestamp() from embOS_CM0.c and I incremented SEGGER_SYSVIEW_TickCnt in SysTick_Handler().

    Finally I called in my main function:

    C Source Code

    1. SEGGER_SYSVIEW_Conf(); /* Configure and initialize SystemView */

    and

    C Source Code

    1. SEGGER_SYSVIEW_Start();


    And I didn't miss to call

    C Source Code

    1. SEGGER_SYSVIEW_RecordEnterISR(); & SEGGER_SYSVIEW_RecordExitISR();
    in a periodic interrupt to record ISR events.

    Does I still missing something else?

    Thanks for your help :)
    --
    Ismail ZEMNI
  • Hi Ismail,

    From what I can tell your configuration looks almost good.

    When using SystemView with the SystemViewer, could you remove the call to SEGGER_SYSVIEW_Start()?

    This function is called by the SystemView module when SystemViewer connects to the target.
    Does this help?

    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.
  • Hi Johannes,

    Tkanks for your answer. Indeed my configuration was ok as you said except that I removed the call of SEGGER_SYSVIEW_Start();

    In fact the problem was that my application start at the second sector of the flash memory, and when I change it to start from the first sector it worked fine.

    Now, I just need to improve the result that I have. The first thing is that I didn't show Tasks name in the Timeline, I always have the address of Tasks function.

    I defined tasks in my SystemViwer firmware in this way:

    C Source Code

    1. SEGGER_SYSVIEW_OnTaskCreate((unsigned)Task1);
    2. Info.TaskID = (U32)Task1;
    3. Info.sName = "Task1";
    4. Info.Prio = 1;
    5. Info.StackBase = (U32)0x8006F00;
    6. Info.StackSize = 128;
    7. SEGGER_SYSVIEW_SendTaskInfo(&Info);
    8. SEGGER_SYSVIEW_SendTaskList();
    9. SEGGER_SYSVIEW_OnTaskStartReady((unsigned)Task1);



    And the second think is that I get a wrong timestamp evolution in my Timeline. something like a jump from 00:06:19.938128.911 to 00:15:16.753.525.286. My SEGGER_SYSVIEW_X_GetTimestamp() function I report timestamp in cycle period as implemented bellow. (HCLK=8Mhz => cycle period=125ns)

    C Source Code

    1. U32 SEGGER_SYSVIEW_X_GetTimestamp(void){
    2. U32 TickCount;
    3. U32 Cycles;
    4. U32 CyclesPerTick;
    5. //
    6. // Get the cycles of the current system tick.
    7. // SysTick is down-counting, subtract the current value from the number of cycles per tick.
    8. //
    9. CyclesPerTick = SysTick->LOAD + 1;
    10. Cycles = (CyclesPerTick - SysTick->VAL);
    11. //
    12. // Get the system tick count. ( SEGGER_SYSVIEW_TickCnt is incremented each 1ms)
    13. //
    14. TickCount = SEGGER_SYSVIEW_TickCnt;
    15. //
    16. // If a SysTick interrupt is pending increment the TickCount
    17. //
    18. if ( NVIC_GetPendingIRQ(SysTick_IRQn) != 0)
    19. { TickCount++; }
    20. Cycles += TickCount * CyclesPerTick;
    21. return Cycles;
    22. }
    Display All



    Thanks in advance,

    Kind Regards,
    Ismail ZEMNI
  • Hi Ismail,

    If you are calling

    C Source Code

    1. SEGGER_SYSVIEW_SendTaskInfo(&Info);
    2. SEGGER_SYSVIEW_SendTaskList();

    before SystemViewer is attached, the info is not stored.

    One way to provide the task information to SystemView is to pass a SEGGER_SYSVIEW_OS_API on SEGGER_SYSVIEW_Init()
    Which includes a callback for getting the task list.

    For the Timestamp, did you make sure to set the timestamp frequency in your SEGGER_SYSVIEW_Config_*.c?

    C Source Code

    1. // Frequency of the timestamp. Must match SEGGER_SYSVIEW_Conf.h
    2. #define SYSVIEW_TIMESTAMP_FREQ (8000000)


    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.