7 SystemView

7.1 What problems can SystemView be used to analyze?

SystemView is a visual analysis tool. As the performance of MCUs becomes stronger and the functions of embedded products become more complex, new challenges are posed for system debugging and analysis. Debugging a function or problem usually requires a lot of effort. SystemView is a powerful tool to help users debug and analyze the system, which can significantly shorten the development and debugging time and improve development efficiency.
RT-Thread provides the SystemView tool for system debugging and analysis.
The tool can see in detail each thread, each interrupt, and the time occupied by the CPU, making it especially suitable for finding places that occupy CPU resources. Here are examples of issues located with SystemView in the following two scenarios:
1,Occasional tearing of LCD display images was finally located using SystemView. It was found that when reading and writing Flash for data storage, the interrupts were turned off, causing one frame of data to be split into two frames for screen refresh due to the interrupts being turned off.
2,The I2C data transmission of TP was interrupted for 16ms. Using SystemView, it was determined that this 16ms was caused by two data transmissions within the interrupt of the LCD controller LCDC, resulting in an excessively long interrupt program.
具体参考RT-Thread 官网文档:
SystemView 分析工具 (rt-thread.org)

7.2 How to enable SystemView

1,SDK configuration: Hcpu’s menuconfig → Third party packages → SystemView: A Segger utility for analysis and trace the RTOS, all others use default configurations.
2,Hcpu的Serial console输入命令: rtt_show_address 会返回,RTT Control Block的地址,如下图:
alt text
3,Open the SystemView.exe software, menu -> Target -> Start Recording,
alt text

4,Make the selection as follows and fill in the address obtained in step 2.
alt text

5,After recording with Start Recording, you will see the following window:
alt text

6,Add Segger print to the SystemView serial port, the following code can be added in the SDK code:

extern void SEGGER_SYSVIEW_Print(const char* s);
 SEGGER_SYSVIEW_Print("A");

更多使用,请参考RT-Thread 官网文档或者DOC目录下文档

7.3 How to enable 52X SystemView

参考## 7.2的前提下,因为52X默认是UART_DGB,采用SifliUsartServer.exe转的jlink非常慢,没法正常连接SystemView,因此需要把PA18,PA19配置为jlink interface模式,修改如下:
1,In the BSP_PIN_Init function of the bsp_pinmux.c file, configure PA18 and P19 as jlink interfaces

#if 0
    // UART1
    HAL_PIN_Set(PAD_PA19, USART1_TXD, PIN_PULLUP, 1);
    HAL_PIN_Set(PAD_PA18, USART1_RXD, PIN_PULLUP, 1);
#else
    //SWD
    HAL_PIN_Set(PAD_PA18, SWDIO, PIN_PULLDOWN, 1);
    HAL_PIN_Set(PAD_PA19, SWCLK, PIN_PULLDOWN, 1);
    HAL_PIN_SetMode(PAD_PA18, 1, PIN_DIGITAL_IO_PULLDOWN);
    HAL_PIN_SetMode(PAD_PA19, 1, PIN_DIGITAL_IO_PULLDOWN);
#endif 

2,The log printing of hcpu is also changed to jlink’s segger printing
3,You can directly search for the _SEGGER_RTT variable in the compiled hcpu project bf0_ap.map file,

_SEGGER_RTT     0x603c3258   Data    168  SEGGER_RTT.o(Jlink_RTT)

3, Fill in the queried _SEGGER_RTT address 0x603c3258,
4, 52X crashes when connecting to SystemView. Originally placed on PSRAM, interaction with the host computer may cause psram cache anomalies, leading to crashes
*.o (Jlink_RTT, +First)  SEGGER_SYSVIEW.o (+RW +ZI) Put these two into sram.
alt text