的确, 我也发现这个问题了, 今天特意看看资料, 终于弄明白了.
你读取的这个地址是属于 DEBUG 的空间.
看看手册是这么说的:
All the debug components exist on the internal Private Peripheral Bus (PPB) and can
be accessed using privileged code
我想应该就是说, 用户代码是不能访问这个地址的数据的.
找到原因了,手册上有个note: The TRCENA bit of the Debug Exception and Monitor Control Register must be set before you can use the DWT. See Debug Exception and Monitor Control Register on page 10-8.
就是说在使用DWT之前,要先置位“调试及监视器控制寄存器”DEMCR的跟踪系统使能位“TRCENA”。
修改后,经测试程序可用~