...
The code listing below shows you an example of configuring a trigger point when a button on the board is pressed:
Code Block | ||
---|---|---|
| ||
#define OS_CFG_TRACE_TRIG_MAX_TRIGS 16u #define OS_CFG_TRACE_TRIG_NAME_LEN 32u #define OS_CFG_TRACE_TRIG_TASK_STK_SIZE 128u #define OS_CFG_TRACE_TRIG_TASK_PRIO 20u #define OS_CFG_TRACE_TRIG_ID_SW1 1234u const OS_TRACE_TRIG_CFG_TBL OSTraceCfgTrigTbl[] = { {OS_CFG_TRACE_TRIG_ID_SW1, "Task # 1 (SWITCH 1)", 3} }; |
(2) trcConfig.h
From this file you can configure the name of the embedded target device by setting the macro SELECTED_PORT
. You can also configure the way the recorder behaves when the recording buffer gets full (e.g. TRACE_STORE_MODE_RING_BUFFER
or TRACE_STORE_MODE_STOP_WHEN_FULL
). At the same time, from this file you can configure the maximum number of events in the buffer and the maximum number of kernel objects to trace. The code listing below shows an example:
Code Block | ||
---|---|---|
| ||
#define SELECTED_PORT PORT_ARM_CortexM
#define TRACE_RECORDER_STORE_MODE TRACE_STORE_MODE_STOP_WHEN_FULL
#define EVENT_BUFFER_SIZE 1000
#define NTask 32
#define NISR 8
#define NQueue 32
#define NSemaphore 64
#define NMutex 8
#define NFlag 2
#define NMem 2 |
Note: Setting SELECTED_PORT
is very important. The options include the following:
...
In this file you need to verify that the macro to obtain the system clock frequency in Hertz exists in your project. It is usually a function that is part of your BSP. The code listing below shows an example:
Code Block | ||
---|---|---|
| ||
#define TRACE_CPU_CLOCK_HZ BSP_ClkFreqGet(BSP_CLK_ID_HCLK)
#define TRACE_PERIPHERAL_CLOCK_HZ BSP_ClkFreqGet(BSP_CLK_ID_HCLK) |