Skip to content

Commit ad1109b

Browse files
committed
add Interrupt SystemView API
1 parent ce5828b commit ad1109b

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Core/Src/stm32f4xx_it.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "stm32f4xx_it.h"
2323
/* Private includes ----------------------------------------------------------*/
2424
/* USER CODE BEGIN Includes */
25+
#include "SEGGER_SYSVIEW.h"
2526
/* USER CODE END Includes */
2627

2728
/* Private typedef -----------------------------------------------------------*/
@@ -183,11 +184,12 @@ void PendSV_Handler(void)
183184
void SysTick_Handler(void)
184185
{
185186
/* USER CODE BEGIN SysTick_IRQn 0 */
186-
187+
//SEGGER_SYSVIEW_TickCnt++;
188+
SEGGER_SYSVIEW_RecordEnterISR();
187189
/* USER CODE END SysTick_IRQn 0 */
188190
HAL_IncTick();
189191
/* USER CODE BEGIN SysTick_IRQn 1 */
190-
192+
SEGGER_SYSVIEW_RecordExitISR();
191193
/* USER CODE END SysTick_IRQn 1 */
192194
}
193195

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,16 @@ SystemView/SEGGER/SEGGER_SYSVIEW.c
2626

2727
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
2828
```
29-
6. 按照`[main.c](./Core/Src/main.c)`的方式使用`SystemView``API`即可;
29+
6. 按照`[main.c](./Core/Src/main.c)`的方式使用`SystemView``API`:
30+
- 在需要监测的函数前后调用`SEGGER_SYSVIEW_Recordxxx()``SEGGER_SYSVIEW_RecordEndCall()`;(不同的函参对应不同的`API`)
31+
- 在需要监测的中断前后调用`SEGGER_SYSVIEW_RecordEnterISR()``SEGGER_SYSVIEW_RecordExitISR()`;
3032
7. 编译并烧录运行,然后在电脑上打开`SystemView`,并点击左上角工具栏中的绿色三角形即可;
3133

3234
## 说明
3335
1. 必须使用`J-Link`才能使用`SystemView`;
34-
2. `JLink`只需要通过`SWDIO``SWCLK`以及`GND`三根线和`MCU`连接;
36+
2. `JLink`只需要通过`SWDIO``SWCLK`以及`GND`三根线和`MCU`连接;
37+
38+
## SystemView Overflow
39+
1.`SystemView`的记录停止,重新开始记录试试;
40+
2.`SysTick_Handler`中断处理函数中加上`SEGGER_SYSVIEW_TickCnt++;`
41+
3.`SEGGER_RTT_Conf.h`中的`BUFFER_SIZE_UP`加大;

0 commit comments

Comments
 (0)