本帖最后由 wangdbff 于 2018-4-21 00:34 编辑
了解了一下TraceAlyzer,其实是一个OS时序分析软件.不过强大的功能却要收费,这里看到有FreeRTOS使用的免费版本,下载来看看。
需要填写几个表单
实验的工程中要添加trace的支持代码,是按照中间件提供的,如下
这个目录是这个样子的
- readme.txt
- │ trcKernelPort.c
- │ trcSnapshotRecorder.c
- │ trcStreamingRecorder.c
- ├─config
- │ trcConfig.h // 整个Trace源码的配置文件.
- │ trcSnapshotConfig.h // 快照模式配置文件,和流模式对应文件选其一
- │ trcStreamingConfig.h // 流模式配置文件,和快照模式对应文件选其一
- ├─include
- │ trcHardwarePort.h // 所有硬件依赖关系。包含几个预定义的硬件端口,包括ARM Cortex-M,PIC32,Renesas RX等。
- │ trcKernelPort.h // FreeRTOS特定的定义,最值得注意的是跟踪钩子定义。
- │ trcPortDefines.h // 配置文件的各种常量定义
- │ trcRecorder.h // 公共API,开发者将以上两种模式进行了统一,用户使用时,只需要包含该文件即可!
- └─streamports // 该文件夹下就是流模式对应的不同接口方式的实现,以下任选其一即可
- ├─Jlink_RTT
- │ │ Readme.txt
- │ │ SEGGER_RTT.c
- │ │ SEGGER_RTT_Printf.c
- │ └─include
- │ SEGGER_RTT.h
- │ SEGGER_RTT_Conf.h
- │ trcStreamingPort.h
- ├─TCPIP
- │ │ Readme.txt
- │ │ trcStreamingPort.c
- │ └─include
- │ trcStreamingPort.h
- └─USB_CDC
- │ Readme.txt
- │ trcStreamingPort.c
- └─include
- trcStreamingPort.h
复制代码 另外要在trcConfig文件中修改一些内容,重点看有注释的地方。- #ifndef TRC_CONFIG_H
- #define TRC_CONFIG_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include "trcPortDefines.h"
- /******************************************************************************
- * Include of processor header file
- *
- * Here you may need to include the header file for your processor. This is
- * required at least for the ARM Cortex-M port, that uses the ARM CMSIS API.
- * Try that in case of build problems. Otherwise, remove the #error line below.
- *****************************************************************************/
- #include "stm32F2xx.h" // 这里根据需要添加自己的芯片的头文件
- //#error "Trace Recorder: Please include your processor´s header file here and remove this line."
- /*******************************************************************************
- * Configuration Macro: TRC_CFG_HARDWARE_PORT
- *
- * Specify what hardware port to use (i.e., the "timestamping driver").
- * All ARM Cortex-M MCUs are supported by "TRC_HARDWARE_PORT_ARM_Cortex_M".
- *
- * See trcSnapshotHardwarePort.h or trcStreamingHardwarePort.h for available
- * ports and information on how to define your own port, if not already present.
- ******************************************************************************/
- #define TRC_CFG_HARDWARE_PORT TRC_HARDWARE_PORT_ARM_Cortex_M // 选择芯片对应的类型
- /*******************************************************************************
- * Configuration Macro: TRC_CFG_RECORDER_MODE
- *
- * Specify what recording mode to use. Snapshot means that the data is saved in
- * an internal RAM buffer, for later upload. Streaming means that the data is
- * transferred continuously to the host PC.
- *
- * For more information, see http://percepio.com/2016/10/05/rtos-tracing/
- * and the Tracealyzer User Manual.
- *
- * Values:
- * TRC_RECORDER_MODE_SNAPSHOT
- * TRC_RECORDER_MODE_STREAMING
- ******************************************************************************/
- #define TRC_CFG_RECORDER_MODE TRC_RECORDER_MODE_STREAMING // 选择追踪模式(默认快照模式,这里我改成了流模式)
- /*******************************************************************************
- * Configuration Macro: TRC_CFG_RECORDER_BUFFER_ALLOCATION
- *
- * Specifies how the recorder's internal buffer is allocated (snapshot or
- * streaming). Note that CUSTOM is only supported in snapshot mode.
- *
- * TRC_RECORDER_BUFFER_ALLOCATION_STATIC - Static allocation
- * TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC - Allocated in vTraceEnable
- * TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM - Use vTraceSetRecorderDataBuffer
- ******************************************************************************/
- #define TRC_CFG_RECORDER_BUFFER_ALLOCATION TRC_RECORDER_BUFFER_ALLOCATION_STATIC
- /******************************************************************************
- * TRC_CFG_FREERTOS_VERSION
- *
- * Specify what version of FreeRTOS that is used (don't change unless using the
- * trace recorder library with an older version of FreeRTOS).
- *
- * TRC_FREERTOS_VERSION_7_3_OR_7_4 If using FreeRTOS v7.3.0 - v7.4.2
- * TRC_FREERTOS_VERSION_7_5_OR_7_6 If using FreeRTOS v7.5.0 - v7.6.0
- * TRC_FREERTOS_VERSION_8_X If using FreeRTOS v8.X.X
- * TRC_FREERTOS_VERSION_9_X If using FreeRTOS v9.X.X
- *****************************************************************************/
- #define TRC_CFG_FREERTOS_VERSION TRC_FREERTOS_VERSION_9_X // 这里根据自己的FreeRTOS版本修改
- /******************************************************************************
- * TRC_CFG_MAX_ISR_NESTING
- *
- * Defines how many levels of interrupt nesting the recorder can handle, in
- * case multiple ISRs are traced and ISR nesting is possible. If this
- * is exceeded, the particular ISR will not be traced and the recorder then
- * logs an error message. This setting is used to allocate an internal stack
- * for keeping track of the previous execution context (4 byte per entry).
- *
- * This value must be a non-zero positive constant, at least 1.
- *
- * Default value: 8
- *****************************************************************************/
- #define TRC_CFG_MAX_ISR_NESTING 8
- /* Specific configuration, depending on Streaming/Snapshot mode */
- #if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT)
- #include "trcSnapshotConfig.h"
- #elif (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
- #include "trcStreamingConfig.h"
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif /* _TRC_CONFIG_H */
复制代码 主函数中使能trcRecorder,后续就可以使用API了。
安装好下载的软件并输入lisense以后就可以配置上位机。
具体配置方法可以看其他朋友写好的,详细步骤要多图配套,往IAR中添加Tracealyzer 工具的时候直接默认的名字
选择后打开分析软件,从file中打来工程目录的money.hex文件就可以查看到该项目的运行情况。
我这里来只看下打开后的效果
的确很强大,可以图形化的跟踪系统和记录,。
|
楼主帮忙看一下,我的是IAR8.32.4,怎么没有你那项new tool啊
知道了,是我还没有在IAR添加这个工具,我再找一下方法吧,但我从Tracealyzer 4里面直接打开IAR编译生成的.bin问题,提示下面的错误,我是评估版本,已输入license