Search code examples
debuggingstm32segger-jlink

Using SEGGER SystemView with STM32


Currently I'm developing a project with FreeRTOS on a STM32L476VGT. Until now I've been debugging with Ozone(SEGGER) and J-Link (Edu and Ultra+)

Now I would like to "debug" or record system event using SystemView (SEGGER), but it's not working.

first of all some of the configurations I think there are important: 16Mhz HSE --> internal 80Mhz SysClk FreeRTOS V8.2.3

J-link (SCLK,SDIO & SWO connected)

Project created with cubeMx so ST HAl libraries are in use(I know that for many people is bloatware but is what it was when I get the project).

main.c

#include "SEGGER_SYSVIEW.h"

//// -- includes, prototypes and definitions

void main (void){

    /// -- Hardware init

    SEGGER_SYSVIEW_Init(1000, 80000000, 0, 0);
    SEGGER_SYSVIEW_Start();

    /// - tasks creation
    osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 128);
    defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);

    /* Start scheduler */
    osKernelStart();

}

I put only the basic lines of code that I have add to the project in order to use the SystemView.

under this lines I attache a screen capture of System Viewer.

enter image description here

EDIT 1:

I've created a new projet to tart from the beginning.

STM32L476RG yes R is another board with 3 leds cubemx : STM32L4 lib 1.10.0 FreeRTOS V9.0.0

main.c

int main(void)
{
    HAL_Init();
    SystemClock_Config();
    MX_GPIO_Init();

    SEGGER_SYSVIEW_Init(1000, 80000000, 0, 0);
    SEGGER_SYSVIEW_Start();

    osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 128);
    defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);

    osThreadDef(ledControlTask, ledcontrol, osPriorityNormal, 0, 128);
    ledControlTaskHandle = osThreadCreate(osThread(ledControlTask), NULL);

    osKernelStart();

    while (1)
    {
    }
}
void ledcontrol(void const * argument)
{
    for(;;)
    {
        HAL_GPIO_TogglePin(LED1_GPIO_Port,LED1_Pin);
        osDelay(500);
    }
}

Same result:

enter image description here

if I click STOP I get:

enter image description here

Also if I put as it's explain in SEGGER SystemView UM0802 pdf Manual:

SEGGER_SYSVIEW_Init(1000, 80000000, 0, 0);
SEGGER_SYSVIEW_Start();

for:

SEGGER_SYSVIEW_Conf();

I get same output

Many thanks,

Guillermo


Solution

  • Solved, RFM(UM08027_SystemView.pdf)!! I forgot to apply the freeRTOS patch file. There are some mismatches between the line in the patch and the line in the file.

    Now works perfect.

    enter image description here