你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

RTOS超低功耗平台应用---使用TraceAlyzer

[复制链接]
wangdbff 发布时间:2018-4-21 00:31
本帖最后由 wangdbff 于 2018-4-21 00:34 编辑

     了解了一下TraceAlyzer,其实是一个OS时序分析软件.不过强大的功能却要收费,这里看到有FreeRTOS使用的免费版本,下载来看看。
     需要填写几个表单
      E[M0`JYXC44EY2__T`(DPD2.png
       实验的工程中要添加trace的支持代码,是按照中间件提供的,如下
         HANPHYP@PP%2W4JKZLZXCN0.png
        这个目录是这个样子的

  1. readme.txt
  2. │  trcKernelPort.c
  3. │  trcSnapshotRecorder.c
  4. │  trcStreamingRecorder.c
  5. ├─config
  6. │      trcConfig.h                  // 整个Trace源码的配置文件.
  7. │      trcSnapshotConfig.h          // 快照模式配置文件,和流模式对应文件选其一
  8. │      trcStreamingConfig.h         // 流模式配置文件,和快照模式对应文件选其一
  9. ├─include
  10. │      trcHardwarePort.h            // 所有硬件依赖关系。包含几个预定义的硬件端口,包括ARM Cortex-M,PIC32,Renesas RX等。
  11. │      trcKernelPort.h              // FreeRTOS特定的定义,最值得注意的是跟踪钩子定义。
  12. │      trcPortDefines.h             // 配置文件的各种常量定义
  13. │      trcRecorder.h                // 公共API,开发者将以上两种模式进行了统一,用户使用时,只需要包含该文件即可!
  14. └─streamports                       // 该文件夹下就是流模式对应的不同接口方式的实现,以下任选其一即可
  15.     ├─Jlink_RTT
  16.     │  │  Readme.txt
  17.     │  │  SEGGER_RTT.c
  18.     │  │  SEGGER_RTT_Printf.c
  19.     │  └─include
  20.     │          SEGGER_RTT.h
  21.     │          SEGGER_RTT_Conf.h
  22.     │          trcStreamingPort.h
  23.     ├─TCPIP
  24.     │  │  Readme.txt
  25.     │  │  trcStreamingPort.c
  26.     │  └─include
  27.     │          trcStreamingPort.h
  28.     └─USB_CDC
  29.         │  Readme.txt
  30.         │  trcStreamingPort.c
  31.         └─include
  32.                 trcStreamingPort.h
复制代码
      另外要在trcConfig文件中修改一些内容,重点看有注释的地方。
  1. #ifndef TRC_CONFIG_H
  2. #define TRC_CONFIG_H

  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif

  6. #include "trcPortDefines.h"

  7. /******************************************************************************
  8. * Include of processor header file
  9. *
  10. * Here you may need to include the header file for your processor. This is
  11. * required at least for the ARM Cortex-M port, that uses the ARM CMSIS API.
  12. * Try that in case of build problems. Otherwise, remove the #error line below.
  13. *****************************************************************************/
  14. #include "stm32F2xx.h"      // 这里根据需要添加自己的芯片的头文件
  15. //#error "Trace Recorder: Please include your processor´s header file here and remove this line."

  16. /*******************************************************************************
  17. * Configuration Macro: TRC_CFG_HARDWARE_PORT
  18. *
  19. * Specify what hardware port to use (i.e., the "timestamping driver").
  20. * All ARM Cortex-M MCUs are supported by "TRC_HARDWARE_PORT_ARM_Cortex_M".
  21. *
  22. * See trcSnapshotHardwarePort.h or trcStreamingHardwarePort.h for available
  23. * ports and information on how to define your own port, if not already present.
  24. ******************************************************************************/
  25. #define TRC_CFG_HARDWARE_PORT TRC_HARDWARE_PORT_ARM_Cortex_M        // 选择芯片对应的类型

  26. /*******************************************************************************
  27. * Configuration Macro: TRC_CFG_RECORDER_MODE
  28. *
  29. * Specify what recording mode to use. Snapshot means that the data is saved in
  30. * an internal RAM buffer, for later upload. Streaming means that the data is
  31. * transferred continuously to the host PC.
  32. *
  33. * For more information, see http://percepio.com/2016/10/05/rtos-tracing/
  34. * and the Tracealyzer User Manual.
  35. *
  36. * Values:
  37. * TRC_RECORDER_MODE_SNAPSHOT
  38. * TRC_RECORDER_MODE_STREAMING
  39. ******************************************************************************/
  40. #define TRC_CFG_RECORDER_MODE TRC_RECORDER_MODE_STREAMING       // 选择追踪模式(默认快照模式,这里我改成了流模式)

  41. /*******************************************************************************
  42. * Configuration Macro: TRC_CFG_RECORDER_BUFFER_ALLOCATION
  43. *
  44. * Specifies how the recorder's internal buffer is allocated (snapshot or
  45. * streaming). Note that CUSTOM is only supported in snapshot mode.
  46. *
  47. * TRC_RECORDER_BUFFER_ALLOCATION_STATIC  - Static allocation
  48. * TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC - Allocated in vTraceEnable
  49. * TRC_RECORDER_BUFFER_ALLOCATION_CUSTOM  - Use vTraceSetRecorderDataBuffer
  50. ******************************************************************************/
  51. #define TRC_CFG_RECORDER_BUFFER_ALLOCATION TRC_RECORDER_BUFFER_ALLOCATION_STATIC

  52. /******************************************************************************
  53. * TRC_CFG_FREERTOS_VERSION
  54. *
  55. * Specify what version of FreeRTOS that is used (don't change unless using the
  56. * trace recorder library with an older version of FreeRTOS).
  57. *
  58. * TRC_FREERTOS_VERSION_7_3_OR_7_4              If using FreeRTOS v7.3.0 - v7.4.2
  59. * TRC_FREERTOS_VERSION_7_5_OR_7_6              If using FreeRTOS v7.5.0 - v7.6.0
  60. * TRC_FREERTOS_VERSION_8_X                     If using FreeRTOS v8.X.X
  61. * TRC_FREERTOS_VERSION_9_X                     If using FreeRTOS v9.X.X
  62. *****************************************************************************/
  63. #define TRC_CFG_FREERTOS_VERSION    TRC_FREERTOS_VERSION_9_X                // 这里根据自己的FreeRTOS版本修改

  64. /******************************************************************************
  65. * TRC_CFG_MAX_ISR_NESTING
  66. *
  67. * Defines how many levels of interrupt nesting the recorder can handle, in
  68. * case multiple ISRs are traced and ISR nesting is possible. If this
  69. * is exceeded, the particular ISR will not be traced and the recorder then
  70. * logs an error message. This setting is used to allocate an internal stack
  71. * for keeping track of the previous execution context (4 byte per entry).
  72. *
  73. * This value must be a non-zero positive constant, at least 1.
  74. *
  75. * Default value: 8
  76. *****************************************************************************/
  77. #define TRC_CFG_MAX_ISR_NESTING 8

  78. /* Specific configuration, depending on Streaming/Snapshot mode */
  79. #if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT)
  80. #include "trcSnapshotConfig.h"
  81. #elif (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
  82. #include "trcStreamingConfig.h"
  83. #endif

  84. #ifdef __cplusplus
  85. }
  86. #endif

  87. #endif /* _TRC_CONFIG_H */
复制代码
        主函数中使能trcRecorder,后续就可以使用API了。          3QT~EL7)@NO]H}KYET4}1OI.png          
         安装好下载的软件并输入lisense以后就可以配置上位机。
         具体配置方法可以看其他朋友写好的,详细步骤要多图配套,往IAR中添加Tracealyzer 工具的时候直接默认的名字
          5B0LT$_S[@NQZ(ILJGIATKD.png
        选择后打开分析软件,从file中打来工程目录的money.hex文件就可以查看到该项目的运行情况。
        我这里来只看下打开后的效果
          2F1~OXQ9GLVWBV(I2[~30E3.png
          的确很强大,可以图形化的跟踪系统和记录,。





收藏 评论3 发布时间:2018-4-21 00:31

举报

3个回答
50031185 回答时间:2018-9-5 11:50:14
根本不行, 运行后直接进入了硬件错误中断
0000000000000000001.jpg
忆古思贤 回答时间:2018-9-30 09:07:06
多谢分享,辛苦了
role_2099 回答时间:2019-7-4 11:30:08
本帖最后由 role_2099 于 2019-7-4 11:51 编辑

楼主帮忙看一下,我的是IAR8.32.4,怎么没有你那项new tool啊

2019-07-04_11-28-11.png

知道了,是我还没有在IAR添加这个工具,我再找一下方法吧,但我从Tracealyzer 4里面直接打开IAR编译生成的.bin问题,提示下面的错误,我是评估版本,已输入license
2019-07-04_11-48-53.png

所属标签

STM32团队

意法半导体微控制器和微处理器拥有广泛的产品线,包含低成本的8位单片机和基于ARM® Cortex®-M0、M0+、M3、M4、M33、M7及A7内核并具备丰富外设选择的32位微控制器及微处理器


最新内容

相似分享

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
st-img 微信公众号
st-img 手机版