Skip to content

Commit 18e9b4d

Browse files
committed
Configuration and First SystemView Integration
- Configurations are made in Micrium and SystemView configuration files. - STM32 ST-Link is converted to J-Link using ST-Link Reflash. - Systemview conf and start function calls are added to the main function, just after the OSInit call. - Ideally, start the program in debugger mode and put a breakpoint to the first line after SEGGER_SYSVIEW_Start call. Proceed to the breakpoint and start tracing in SystemView program. ST-Link Reflash: https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/
1 parent 36f9484 commit 18e9b4d

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

Micrium with SystemView/Core/Src/main.c

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

2627
/* USER CODE END Includes */
2728

@@ -115,6 +116,9 @@ int main(void)
115116
OSInit(&err);
116117
checkError(&err);
117118

119+
SEGGER_SYSVIEW_Conf();
120+
SEGGER_SYSVIEW_Start();
121+
118122

119123
/* Create task starter broadcaster semaphore */
120124
OSSemCreate(&StartSem, "Start Semaphore", 1, &err);

Micrium with SystemView/Micrium/Cfg/os_cfg.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#define OS_CFG_APP_HOOKS_EN 1u /* Enable (1) or Disable (0) application specific hooks */
3232
#define OS_CFG_ARG_CHK_EN 1u /* Enable (1) or Disable (0) argument checking */
3333
#define OS_CFG_CALLED_FROM_ISR_CHK_EN 1u /* Enable (1) or Disable (0) check for called from ISR */
34-
#define OS_CFG_DBG_EN 0u /* Enable (1) or Disable (0) debug code/variables */
34+
#define OS_CFG_DBG_EN 1u /* Enable (1) or Disable (0) debug code/variables */
3535
#define OS_CFG_TICK_EN 1u /* Enable (1) or Disable (0) the kernel tick */
3636
#define OS_CFG_DYN_TICK_EN 0u /* Enable (1) or Disable (0) the Dynamic Tick */
3737
#define OS_CFG_INVALID_OS_CALLS_CHK_EN 1u /* Enable (1) or Disable (0) checks for invalid kernel calls */
@@ -112,8 +112,8 @@
112112

113113

114114
/* ------------------------- TRACE RECORDER ---------------------------- */
115-
#define OS_CFG_TRACE_EN 0u /* Enable (1) or Disable (0) uC/OS-III Trace instrumentation */
116-
#define OS_CFG_TRACE_API_ENTER_EN 0u /* Enable (1) or Disable (0) uC/OS-III Trace API enter instrumentation */
117-
#define OS_CFG_TRACE_API_EXIT_EN 0u /* Enable (1) or Disable (0) uC/OS-III Trace API exit instrumentation */
115+
#define OS_CFG_TRACE_EN 1u /* Enable (1) or Disable (0) uC/OS-III Trace instrumentation */
116+
#define OS_CFG_TRACE_API_ENTER_EN 1u /* Enable (1) or Disable (0) uC/OS-III Trace API enter instrumentation */
117+
#define OS_CFG_TRACE_API_EXIT_EN 1u /* Enable (1) or Disable (0) uC/OS-III Trace API exit instrumentation */
118118

119119
#endif

Micrium with SystemView/SEGGER/Config/SEGGER_SYSVIEW_Config_uCOSIII.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ Revision: $Rev: 9599 $
5454
*/
5555
#include "SEGGER_SYSVIEW.h"
5656
#include "os.h"
57-
#include "bsp_clock.h"
57+
#include "stm32f4xx.h"
58+
//#include "bsp_clock.h"
5859

5960
extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
6061

@@ -70,13 +71,13 @@ extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
7071
// The target device name
7172
#define SYSVIEW_DEVICE_NAME "Cortex-M Device"
7273

73-
74+
CPU_ERR local_err;
7475

7576
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_GET_TIMESTAMP in SEGGER_SYSVIEW_Conf.h
76-
#define SYSVIEW_TIMESTAMP_FREQ (BSP_ClkFreqGet(BSP_CLK_ID_SYSCLK))
77+
#define SYSVIEW_TIMESTAMP_FREQ (CPU_TS_TmrFreqGet(&local_err))
7778

7879
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
79-
#define SYSVIEW_CPU_FREQ (BSP_ClkFreqGet(BSP_CLK_ID_SYSCLK))
80+
#define SYSVIEW_CPU_FREQ (SystemCoreClock)
8081

8182
// The lowest RAM address used for IDs (pointers)
8283
#define SYSVIEW_RAM_BASE (0x20000000)

0 commit comments

Comments
 (0)