浏览代码

[components][cputime]to be able trace before use DWT.|使用 DWT 之前必须先使能跟踪系统.

guozhanxin 7 年之前
父节点
当前提交
e2c89ec0f5
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      components/drivers/cputime/cputime_cortexm.c

+ 3 - 0
components/drivers/cputime/cputime_cortexm.c

@@ -54,6 +54,9 @@ int cortexm_cputime_init(void)
     /* check support bit */
     if ((DWT->CTRL & (1UL << DWT_CTRL_NOCYCCNT_Pos)) == 0) 
     {
+        /* enable trace*/
+        CoreDebug->DEMCR |= (1UL << CoreDebug_DEMCR_TRCENA_Pos);
+        
         /* whether cycle counter not enabled */
         if ((DWT->CTRL & (1UL << DWT_CTRL_CYCCNTENA_Pos)) == 0) 
         {