Share: 借助OZone快速定位Hardfault

公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

Tip / 登入 to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
idream
Level 3
Level 3
50 sign-ins First comment on blog 10 replies posted

原帖:https://xarm.gitee.io/2023/02/12/PSoC4/Ozone/

上一篇:一直遗憾于PSoC Creator不支持J-Link,摸索了一种方法可以曲线使用J-Link下载PSoC4,虽不是完美,但也还算优雅~

这次连调试也有了,下载、仿真、debug一条龙,终于不再有遗憾,顺便还带来了更强大的快速定位Hardfault的功能,从此CmbackTrace成为路人了!

  1. OZone简介
    Segger的优秀产品,强大的debug工具,详情见:
    https://www.segger.com/products/development-tools/ozone-j-link-debugger/

  2. Creator工程将hex、elf文件copy至指定目录

    工程选项 / Build Settings / ARM GCC5.4… / User Command / post build中写入: .\copyHex.bat

    然后在工程目录文件下创建copyHex.bat,内容为:

    bat
    copy .\CortexM0p\ARM_GCC_541\Debug\P4RTT.hex ..\JlinkDLPSoC4\P4RTT.hex
    copy .\CortexM0p\ARM_GCC_541\Debug\P4RTT.elf ..\JlinkDLPSoC4\P4RTT.elf

    这样每次编译完成后会自动将生成的hex、elf文件copy至JlinkDLPSoC4目录下。

  3. 打开Ozone新建工程,导入elf文件,然后,然后还是见下图吧:

     

    OZone

    写一条异常访问的语句,然后调用它,然后就会进入Hardfault中断,在Call Statack中可以看到,进入Hardfault前的调用函数关系以及所在文件,甚至连第几行都显示出来了,强大的简直不要不要的!

  4. OZone调试所需要的仅仅一个elf文件即可,程序中不需要额外的增加代码。
    License:With a J-Link PLUS, PRO, ULTRA+, or with a J-Trace, Ozone is available for free.

    Enjoy it~

0 点赞
1 回复
idream
Level 3
Level 3
50 sign-ins First comment on blog 10 replies posted

终于不再头疼Hardfault了~

0 点赞