17

IMXRT学习记录 – 官方代码运行无结果BUG分析

 4 years ago
source link: https://www.taterli.com/6873/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

一般来说,官方代码是给参考用的,但是,如果官方代码有BUG,那简直想打人.

比如下面这一个是温度监控的代码,TEMPMON_Init单步后,寄存器竟然没有任何改变?仿佛代码都被跳过了一样.

ENR7FvZ.png!web

首先我不认为是库函数有问题,这个外设非常简单,而人工设置寄存器也是可以用的,说明时钟配置也没问题(这个外设不需要时钟),然后切换到RAM调试,发现一点问题都没有.(注意对比上图地址空间)

7Nza2mm.png!web

可以判断,由于Flash调试引起的,可是,当程序规模变大,不得不用Flash调试啊.虽然说可以分块调试,但是也不方便.

然后尝试关键代码挪到我自己工程,竟然没有任何问题.

7N3Ibmu.png!web

最后对比发现是Debug Console问题,只要注释掉,就任何工程都没事,而我自己的最简工程,根本就没这个的处理.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK